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)
| 81 | // - ":80" |
| 82 | // - "*" |
| 83 | func (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 |
no test coverage detected