From 95ed5a5ff8501554af5fbf2977f41eeea2303bac Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sat, 23 Feb 2019 00:01:23 +0100 Subject: [PATCH] comments --- app/dns/nameserver.go | 4 ++++ common/crypto/aes.go | 2 ++ transport/internet/kcp/dialer.go | 1 + 3 files changed, 7 insertions(+) diff --git a/app/dns/nameserver.go b/app/dns/nameserver.go index b26c21ff..123336e7 100644 --- a/app/dns/nameserver.go +++ b/app/dns/nameserver.go @@ -15,8 +15,12 @@ type IPOption struct { IPv6Enable bool } +// Client is the interface for DNS client. type Client interface { + // Name of the Client. Name() string + + // QueryIP sends IP queries to its configured server. QueryIP(ctx context.Context, domain string, option IPOption) ([]net.IP, error) } diff --git a/common/crypto/aes.go b/common/crypto/aes.go index 94a49735..b2415b3e 100644 --- a/common/crypto/aes.go +++ b/common/crypto/aes.go @@ -25,10 +25,12 @@ func NewAesStreamMethod(key []byte, iv []byte, f func(cipher.Block, []byte) ciph return f(aesBlock, iv) } +// NewAesCTRStream creates a stream cipher based on AES-CTR. func NewAesCTRStream(key []byte, iv []byte) cipher.Stream { return NewAesStreamMethod(key, iv, cipher.NewCTR) } +// NewAesGcm creates a AEAD cipher based on AES-GCM. func NewAesGcm(key []byte) cipher.AEAD { block, err := aes.NewCipher(key) common.Must(err) diff --git a/transport/internet/kcp/dialer.go b/transport/internet/kcp/dialer.go index 55b3922f..b0531b50 100644 --- a/transport/internet/kcp/dialer.go +++ b/transport/internet/kcp/dialer.go @@ -47,6 +47,7 @@ func fetchInput(ctx context.Context, input io.Reader, reader PacketReader, conn } } +// DialKCP dials a new KCP connections to the specific destination. func DialKCP(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (internet.Connection, error) { dest.Network = net.Network_UDP newError("dialing mKCP to ", dest).WriteToLog()