Browse Source

add comments to exported func

vcptr 6 years ago
parent
commit
59e3a2a67c
3 changed files with 8 additions and 0 deletions
  1. 2 0
      app/dns/dnscommon.go
  2. 5 0
      app/dns/dohdns.go
  3. 1 0
      infra/conf/v2ray.go

+ 2 - 0
app/dns/dnscommon.go

@@ -13,6 +13,7 @@ import (
 	dns_feature "v2ray.com/core/features/dns"
 )
 
+// Fqdn normalize domain make sure it ends with '.'
 func Fqdn(domain string) string {
 	if len(domain) > 0 && domain[len(domain)-1] == '.' {
 		return domain
@@ -25,6 +26,7 @@ type record struct {
 	AAAA *IPRecord
 }
 
+// IPRecord is a cacheable item for a resolved domain
 type IPRecord struct {
 	ReqID  uint16
 	IP     []net.Address

+ 5 - 0
app/dns/dohdns.go

@@ -40,6 +40,7 @@ type DoHNameServer struct {
 	name       string
 }
 
+// NewDoHNameServer creates DOH client object for remote resolving
 func NewDoHNameServer(dohHost string, dohPort uint32, dispatcher routing.Dispatcher, clientIP net.IP) (*DoHNameServer, error) {
 
 	dohAddr := net.ParseAddress(dohHost)
@@ -100,6 +101,7 @@ func NewDoHNameServer(dohHost string, dohPort uint32, dispatcher routing.Dispatc
 	return s, nil
 }
 
+// NewDoHLocalNameServer creates DOH client object for local resolving
 func NewDoHLocalNameServer(dohHost string, dohPort uint32, clientIP net.IP) *DoHNameServer {
 
 	if dohPort == 0 {
@@ -135,10 +137,12 @@ func baseDOHNameServer(dohHost string, dohPort uint32, prefix string, clientIP n
 	return s
 }
 
+// Name returns client name
 func (s *DoHNameServer) Name() string {
 	return s.name
 }
 
+// DialContext offer dispatched connection through core routing
 func (s *DoHNameServer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
 
 	dest := s.dohDests[dice.Roll(len(s.dohDests))]
@@ -153,6 +157,7 @@ func (s *DoHNameServer) DialContext(ctx context.Context, network, addr string) (
 	), nil
 }
 
+// Cleanup clears expired items from cache
 func (s *DoHNameServer) Cleanup() error {
 	now := time.Now()
 	s.Lock()

+ 1 - 0
infra/conf/v2ray.go

@@ -79,6 +79,7 @@ type MuxConfig struct {
 	Concurrency int16 `json:"concurrency"`
 }
 
+// Build creates MultiplexingConfig, Concurrency < 0 completely disables mux.
 func (m *MuxConfig) Build() *proxyman.MultiplexingConfig {
 	if m.Concurrency < 0 {
 		return nil