mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
17 lines
255 B
Go
17 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
|
||
|
}
|