match a listen pattern to an address string of the form HOST:PORT
(pattern string, addr net.Addr)
| 8 | |
| 9 | // match a listen pattern to an address string of the form HOST:PORT |
| 10 | func 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 |
| 21 | type mux struct { |