mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
add comments to exported func
This commit is contained in:
parent
ceb77ac8f5
commit
59e3a2a67c
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user