mirror of https://github.com/v2ray/v2ray-core
comments
parent
57648c145c
commit
4761139fbc
|
@ -41,14 +41,17 @@ func UDPDestination(address Address, port Port) Destination {
|
|||
}
|
||||
}
|
||||
|
||||
// NetAddr returns the network address in this Destination in string form.
|
||||
func (d Destination) NetAddr() string {
|
||||
return d.Address.String() + ":" + d.Port.String()
|
||||
}
|
||||
|
||||
// String returns the strings form of this Destination.
|
||||
func (d Destination) String() string {
|
||||
return d.Network.URLPrefix() + ":" + d.NetAddr()
|
||||
}
|
||||
|
||||
// IsValid returns true if this Destination is valid.
|
||||
func (d Destination) IsValid() bool {
|
||||
return d.Network != Network_Unknown
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Package net contains common network utilities.
|
||||
// Package net is a drop-in replacement to Golang's net package, with some more functionalities.
|
||||
package net
|
||||
|
||||
//go:generate go run $GOPATH/src/v2ray.com/core/tools/generrorgen/main.go -pkg net -path Net
|
||||
|
|
|
@ -2,6 +2,7 @@ package net
|
|||
|
||||
import "net"
|
||||
|
||||
// DialTCP is an injectable function. Default to net.DialTCP
|
||||
var DialTCP = net.DialTCP
|
||||
var DialUDP = net.DialUDP
|
||||
var DialUnix = net.DialUnix
|
||||
|
|
Loading…
Reference in New Issue