(url stun.URI, networkTypes []NetworkType)
| 78 | } |
| 79 | |
| 80 | func turnNetworkTypesForURL(url stun.URI, networkTypes []NetworkType) []NetworkType { |
| 81 | proto := effectiveURLProtoType(url) |
| 82 | res := []NetworkType{} |
| 83 | |
| 84 | for _, networkType := range configuredNetworkTypes(networkTypes) { |
| 85 | switch proto { |
| 86 | case stun.ProtoTypeUDP: |
| 87 | if networkType.IsUDP() { |
| 88 | res = append(res, networkType) |
| 89 | } |
| 90 | case stun.ProtoTypeTCP: |
| 91 | if networkType.IsTCP() { |
| 92 | res = append(res, networkType) |
| 93 | } |
| 94 | default: |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | return res |
| 99 | } |
| 100 | |
| 101 | // Close a net.Conn and log if we have a failure. |
| 102 | func closeConnAndLog(c io.Closer, log logging.LeveledLogger, msg string, args ...any) { |
no test coverage detected
searching dependent graphs…