Darien Raymond 8 anos atrás
pai
commit
4761139fbc
3 arquivos alterados com 5 adições e 1 exclusões
  1. 3 0
      common/net/destination.go
  2. 1 1
      common/net/net.go
  3. 1 0
      common/net/system.go

+ 3 - 0
common/net/destination.go

@@ -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 - 1
common/net/net.go

@@ -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

+ 1 - 0
common/net/system.go

@@ -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