|  | @@ -7,15 +7,16 @@ import (
 | 
											
												
													
														|  |  	"github.com/v2ray/v2ray-core/common/log"
 |  |  	"github.com/v2ray/v2ray-core/common/log"
 | 
											
												
													
														|  |  )
 |  |  )
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -// Address represents a network address to be communicated with. It may be an IP address or domain address, not both. This interface doesn't resolve IP address for a given domain.
 |  | 
 | 
											
												
													
														|  | 
 |  | +// Address represents a network address to be communicated with. It may be an IP address or domain
 | 
											
												
													
														|  | 
 |  | +// address, not both. This interface doesn't resolve IP address for a given domain.
 | 
											
												
													
														|  |  type Address interface {
 |  |  type Address interface {
 | 
											
												
													
														|  | -	IP() net.IP // IP of this Address
 |  | 
 | 
											
												
													
														|  | -	Domain() string // Domain of this Address
 |  | 
 | 
											
												
													
														|  | -	Port() uint16 // Port of this Address
 |  | 
 | 
											
												
													
														|  | 
 |  | +	IP() net.IP        // IP of this Address
 | 
											
												
													
														|  | 
 |  | +	Domain() string    // Domain of this Address
 | 
											
												
													
														|  | 
 |  | +	Port() uint16      // Port of this Address
 | 
											
												
													
														|  |  	PortBytes() []byte // Port in bytes, network byte order
 |  |  	PortBytes() []byte // Port in bytes, network byte order
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -	IsIPv4() bool // True if this Address is an IPv4 address
 |  | 
 | 
											
												
													
														|  | -	IsIPv6() bool // True if this Address is an IPv6 address
 |  | 
 | 
											
												
													
														|  | 
 |  | +	IsIPv4() bool   // True if this Address is an IPv4 address
 | 
											
												
													
														|  | 
 |  | +	IsIPv6() bool   // True if this Address is an IPv6 address
 | 
											
												
													
														|  |  	IsDomain() bool // True if this Address is an domain address
 |  |  	IsDomain() bool // True if this Address is an domain address
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	String() string // String representation of this Address
 |  |  	String() string // String representation of this Address
 | 
											
										
											
												
													
														|  | @@ -32,10 +33,12 @@ func IPAddress(ip []byte, port uint16) Address {
 | 
											
												
													
														|  |  	case net.IPv6len:
 |  |  	case net.IPv6len:
 | 
											
												
													
														|  |  		return IPv6Address{
 |  |  		return IPv6Address{
 | 
											
												
													
														|  |  			PortAddress: PortAddress{port: port},
 |  |  			PortAddress: PortAddress{port: port},
 | 
											
												
													
														|  | -			ip:          [16]byte{ip[0], ip[1], ip[2], ip[3],
 |  | 
 | 
											
												
													
														|  | -			                      ip[4], ip[5], ip[6], ip[7],
 |  | 
 | 
											
												
													
														|  | -			                      ip[8], ip[9], ip[10], ip[11],
 |  | 
 | 
											
												
													
														|  | -			                      ip[12], ip[13], ip[14], ip[15]},
 |  | 
 | 
											
												
													
														|  | 
 |  | +			ip: [16]byte{
 | 
											
												
													
														|  | 
 |  | +				ip[0], ip[1], ip[2], ip[3],
 | 
											
												
													
														|  | 
 |  | +				ip[4], ip[5], ip[6], ip[7],
 | 
											
												
													
														|  | 
 |  | +				ip[8], ip[9], ip[10], ip[11],
 | 
											
												
													
														|  | 
 |  | +				ip[12], ip[13], ip[14], ip[15],
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  	default:
 |  |  	default:
 | 
											
												
													
														|  |  		panic(log.Error("Unknown IP format: %v", ip))
 |  |  		panic(log.Error("Unknown IP format: %v", ip))
 |