MCPcopy Create free account
hub / github.com/Invisv-Privacy/masque / NewClient

Function NewClient

http2/client.go:73–98  ·  view source on GitHub ↗

NewClient creates a new Client instance with the provided parameters.

(config ClientConfig)

Source from the content-addressed store, hash-verified

71
72// NewClient creates a new Client instance with the provided parameters.
73func NewClient(config ClientConfig) *Client {
74 l := make(map[string]bool)
75 for _, s := range config.LowLatencyAddrs {
76 l[s] = true
77 }
78
79 redactedConfig := config
80 redactedConfig.AuthToken = "REDACTED"
81
82 c := &Client{
83 proxyAddr: config.ProxyAddr,
84 authToken: config.AuthToken,
85 h2Transport: nil,
86 h2Conns: []*gohttp2.ClientConn{},
87 tlsConn: nil,
88 tlsTimeout: masque.MaxTLSDialTimeout,
89 tcpReqs: map[uint64]*Conn{},
90 udpReqs: map[uint64]*Conn{},
91 certData: config.CertData,
92 prot: config.Prot,
93 lowLatencyAddrs: l,
94 logger: config.Logger.With("config", redactedConfig),
95 ignoreCert: config.IgnoreCert,
96 }
97 return c
98}
99
100// ConnectToProxy connects the Client to the proxy.
101func (c *Client) ConnectToProxy() error {

Callers 2

TestCreateTCPStreamFunction · 0.70
TestCreateUDPStreamFunction · 0.70

Calls

no outgoing calls

Tested by 2

TestCreateTCPStreamFunction · 0.56
TestCreateUDPStreamFunction · 0.56