Add whitelist/blacklist support for relay
This commit is contained in:
parent
4712d6c9dd
commit
e16ac5a58a
7
relay.go
7
relay.go
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user