From 4761139fbc9b1e31c16818d90447a4a1d38c7f48 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 6 Nov 2017 22:42:16 +0100 Subject: [PATCH] comments --- common/net/destination.go | 3 +++ common/net/net.go | 2 +- common/net/system.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/net/destination.go b/common/net/destination.go index 7709b5c95..f7f5b720b 100644 --- a/common/net/destination.go +++ b/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 } diff --git a/common/net/net.go b/common/net/net.go index bd0188c26..4d41e90af 100644 --- a/common/net/net.go +++ b/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 diff --git a/common/net/system.go b/common/net/system.go index 6edc4ca4a..65d7b8bb0 100644 --- a/common/net/system.go +++ b/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