mirror of
https://github.com/wneessen/go-mail.git
synced 2024-12-22 10:40:39 +01:00
Refactor TLSPolicy documentation and String method
Updated the TLSPolicy type documentation to improve clarity and consistency. Enhanced the String method with detailed commentary and return value explanation, ensuring it better adheres to the fmt.Stringer interface.
This commit is contained in:
parent
6ce5c2a860
commit
f0388ec600
1 changed files with 12 additions and 5 deletions
17
tls.go
17
tls.go
|
@ -4,25 +4,32 @@
|
|||
|
||||
package mail
|
||||
|
||||
// TLSPolicy type describes a int alias for the different TLS policies we allow
|
||||
// TLSPolicy is a type wrapper for an int type and describes the different TLS policies we allow.
|
||||
type TLSPolicy int
|
||||
|
||||
const (
|
||||
// TLSMandatory requires that the connection to the server is
|
||||
// encrypting using STARTTLS. If the server does not support STARTTLS
|
||||
// the connection will be terminated with an error
|
||||
// the connection will be terminated with an error.
|
||||
TLSMandatory TLSPolicy = iota
|
||||
|
||||
// TLSOpportunistic tries to establish an encrypted connection via the
|
||||
// STARTTLS protocol. If the server does not support this, it will fall
|
||||
// back to non-encrypted plaintext transmission
|
||||
// back to non-encrypted plaintext transmission.
|
||||
TLSOpportunistic
|
||||
|
||||
// NoTLS forces the transaction to be not encrypted
|
||||
// NoTLS forces the transaction to be not encrypted.
|
||||
NoTLS
|
||||
)
|
||||
|
||||
// String is a standard method to convert a TLSPolicy into a printable format
|
||||
// String satisfies the fmt.Stringer interface for the TLSPolicy type.
|
||||
//
|
||||
// This function returns a string representation of the TLSPolicy. It matches the policy
|
||||
// value to predefined constants and returns the corresponding string. If the policy does
|
||||
// not match any known values, it returns "UnknownPolicy".
|
||||
//
|
||||
// Returns:
|
||||
// - A string representing the TLSPolicy.
|
||||
func (p TLSPolicy) String() string {
|
||||
switch p {
|
||||
case TLSMandatory:
|
||||
|
|
Loading…
Reference in a new issue