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

Function patternMatches

mux.go:10–18  ·  view source on GitHub ↗

match a listen pattern to an address string of the form HOST:PORT

(pattern string, addr net.Addr)

Source from the content-addressed store, hash-verified

8
9// match a listen pattern to an address string of the form HOST:PORT
10func patternMatches(pattern string, addr net.Addr) bool {
11 if pattern == "*" {
12 return true
13 }
14 if strings.HasPrefix(pattern, ":") && strings.HasSuffix(addr.String(), pattern) {
15 return true
16 }
17 return false
18}
19
20// mux dispatches network connections to listeners according to patterns
21type mux struct {

Callers 2

notifyTCPMethod · 0.85
notifyUDPMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected