clash/constant/addr.go

28 lines
366 B
Go
Raw Normal View History

2018-06-10 14:50:03 +00:00
package constant
2018-06-11 10:36:39 +00:00
import (
"net"
)
2018-06-10 14:50:03 +00:00
// Socks addr type
const (
AtypIPv4 = 1
AtypDomainName = 3
AtypIPv6 = 4
)
// Addr is used to store connection address
type Addr struct {
AddrType int
Host string
2018-06-11 10:36:39 +00:00
IP *net.IP
2018-06-10 14:50:03 +00:00
Port string
}
2018-06-11 10:36:39 +00:00
func (addr *Addr) String() string {
if addr.Host == "" {
return addr.IP.String()
}
return addr.Host
}