feat: Add LAN allowed and disallowed IP configurations (#861)

This commit is contained in:
Kuingsmile
2023-12-12 04:39:11 -08:00
committed by wwqgtxx
parent 3cf865e5f0
commit 7ee6809257
8 changed files with 103 additions and 3 deletions

View File

@@ -71,6 +71,12 @@ func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additi
t.SetKeepAlive(false)
}
}
if len(additions) == 0 { // only apply on default listener
if inbound.IsRemoteAddrDisAllowed(conn.RemoteAddr()) {
_ = conn.Close()
continue
}
}
go HandleConn(conn, tunnel, c, additions...)
}
}()

View File

@@ -62,6 +62,12 @@ func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener
}
continue
}
if len(additions) == 0 { // only apply on default listener
if inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
_ = c.Close()
continue
}
}
go handleConn(c, tunnel, ml.cache, additions...)
}
}()

View File

@@ -59,6 +59,12 @@ func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener
}
continue
}
if len(additions) == 0 { // only apply on default listener
if inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
_ = c.Close()
continue
}
}
go handleSocks(c, tunnel, additions...)
}
}()