1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-28 23:06:14 -04:00

prefer Network over string

This commit is contained in:
v2ray 2016-02-06 18:03:42 +01:00
parent 45db388e3f
commit 4bb1d822af
2 changed files with 6 additions and 6 deletions

View File

@ -165,5 +165,5 @@ func NewNetworkMatcher(network *v2net.NetworkList) *NetworkMatcher {
} }
func (this *NetworkMatcher) Apply(dest v2net.Destination) bool { func (this *NetworkMatcher) Apply(dest v2net.Destination) bool {
return this.network.HasNetwork(v2net.Network(dest.Network())) return this.network.HasNetwork(dest.Network())
} }

View File

@ -2,7 +2,7 @@ package net
// Destination represents a network destination including address and protocol (tcp / udp). // Destination represents a network destination including address and protocol (tcp / udp).
type Destination interface { type Destination interface {
Network() string // Protocol of communication (tcp / udp) Network() Network // Protocol of communication (tcp / udp)
Address() Address // Address of destination Address() Address // Address of destination
Port() Port Port() Port
String() string // String representation of the destination String() string // String representation of the destination
@ -28,8 +28,8 @@ type tcpDestination struct {
port Port port Port
} }
func (dest *tcpDestination) Network() string { func (dest *tcpDestination) Network() Network {
return "tcp" return TCPNetwork
} }
func (dest *tcpDestination) Address() Address { func (dest *tcpDestination) Address() Address {
@ -74,8 +74,8 @@ type udpDestination struct {
port Port port Port
} }
func (dest *udpDestination) Network() string { func (dest *udpDestination) Network() Network {
return "udp" return UDPNetwork
} }
func (dest *udpDestination) Address() Address { func (dest *udpDestination) Address() Address {