MCPcopy
hub / github.com/monasticacademy/httptap / HandleTCP

Method HandleTCP

mux.go:83–92  ·  view source on GitHub ↗

HandleTCP register a handler to be called each time a new connection is intercepted matching the given filter pattern. Pattern can a hostname, a :port, a hostname:port, or "*" for everything". For example: - "example.com" - "example.com:80" - ":80" - "*"

(pattern string, handler tcpHandlerFunc)

Source from the content-addressed store, hash-verified

81// - ":80"
82// - "*"
83func (s *mux) HandleTCP(pattern string, handler tcpHandlerFunc) {
84 s.HandleTCPRequest(pattern, func(r TCPRequest) {
85 conn, err := r.Accept()
86 if err != nil {
87 errorf("error accepting connection: %v", err)
88 return
89 }
90 handler(conn)
91 })
92}
93
94// HandleTCPRequest register a handler to be called each time a new connection is intercepted matching the
95// given filter pattern. Unlike HandleTCP, the handler can control whether the connection is accepted or

Callers 1

MainFunction · 0.95

Calls 3

HandleTCPRequestMethod · 0.95
errorfFunction · 0.70
AcceptMethod · 0.65

Tested by

no test coverage detected