mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
16 lines
255 B
Go
16 lines
255 B
Go
package smtp
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
// AddressLiteral returns an IPv4 or IPv6 address literal for use in SMTP.
|
|
func AddressLiteral(ip net.IP) string {
|
|
// ../rfc/5321:2309
|
|
s := "["
|
|
if ip.To4() == nil {
|
|
s += "IPv6:"
|
|
}
|
|
s += ip.String() + "]"
|
|
return s
|
|
}
|