MCPcopy
hub / github.com/golang/net / NewServer

Function NewServer

internal/sockstest/server.go:183–192  ·  view source on GitHub ↗

NewServer returns a new server. The provided authFunc and cmdFunc must parse requests and return appropriate replies to clients.

(authFunc, cmdFunc func(io.ReadWriter, []byte) error)

Source from the content-addressed store, hash-verified

181// The provided authFunc and cmdFunc must parse requests and return
182// appropriate replies to clients.
183func NewServer(authFunc, cmdFunc func(io.ReadWriter, []byte) error) (*Server, error) {
184 var err error
185 s := new(Server)
186 s.ln, err = nettest.NewLocalListener("tcp")
187 if err != nil {
188 return nil, err
189 }
190 go s.serve(authFunc, cmdFunc)
191 return s, nil
192}
193
194// NoAuthRequired handles a no-authentication-required signaling.
195func NoAuthRequired(rw io.ReadWriter, b []byte) error {

Callers 4

TestFromURLFunction · 0.92
TestSOCKS5Function · 0.92
TestDialFunction · 0.92
TestDialFunction · 0.92

Calls 2

NewLocalListenerFunction · 0.92
serveMethod · 0.45

Tested by 4

TestFromURLFunction · 0.74
TestSOCKS5Function · 0.74
TestDialFunction · 0.74
TestDialFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…