mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-16 03:34:45 +00:00
23 lines
303 B
Go
23 lines
303 B
Go
|
package core
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
func ipEqualOrInRange(ip net.IP, ips []interface{}) bool {
|
||
|
for _, item := range ips {
|
||
|
switch titem := item.(type) {
|
||
|
case net.IP:
|
||
|
if titem.Equal(ip) {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
case *net.IPNet:
|
||
|
if titem.Contains(ip) {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|