Add whitelist/blacklist support for relay

This commit is contained in:
Hubix9 2021-02-05 17:32:01 +01:00 committed by ginuerzh
parent 4712d6c9dd
commit e16ac5a58a

View File

@ -203,6 +203,13 @@ func (h *relayHandler) Handle(conn net.Conn) {
if udp { if udp {
network = "udp" network = "udp"
} }
if !Can(network, raddr, h.options.Whitelist, h.options.Blacklist) {
resp.Status = relay.StatusForbidden
resp.WriteTo(conn)
log.Logf("[relay] %s -> %s : relay to %s is forbidden",
conn.RemoteAddr(), conn.LocalAddr(), raddr)
return
}
ctx := context.TODO() ctx := context.TODO()
var cc net.Conn var cc net.Conn