mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 10:43:13 +08:00
fix: fix lan-allowed-ips
does not take effect
This commit is contained in:
parent
20658f6eac
commit
9e57e7d29b
@ -36,7 +36,9 @@ func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additions ...inbound.Addition) (*Listener, error) {
|
func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additions ...inbound.Addition) (*Listener, error) {
|
||||||
|
isDefault := false
|
||||||
if len(additions) == 0 {
|
if len(additions) == 0 {
|
||||||
|
isDefault = true
|
||||||
additions = []inbound.Addition{
|
additions = []inbound.Addition{
|
||||||
inbound.WithInName("DEFAULT-HTTP"),
|
inbound.WithInName("DEFAULT-HTTP"),
|
||||||
inbound.WithSpecialRules(""),
|
inbound.WithSpecialRules(""),
|
||||||
@ -71,7 +73,7 @@ func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additi
|
|||||||
t.SetKeepAlive(false)
|
t.SetKeepAlive(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(additions) == 2 { // only apply on default listener
|
if isDefault { // only apply on default listener
|
||||||
if !inbound.IsRemoteAddrDisAllowed(conn.RemoteAddr()) {
|
if !inbound.IsRemoteAddrDisAllowed(conn.RemoteAddr()) {
|
||||||
_ = conn.Close()
|
_ = conn.Close()
|
||||||
continue
|
continue
|
||||||
|
@ -37,7 +37,9 @@ func (l *Listener) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) {
|
func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) {
|
||||||
|
isDefault := false
|
||||||
if len(additions) == 0 {
|
if len(additions) == 0 {
|
||||||
|
isDefault = true
|
||||||
additions = []inbound.Addition{
|
additions = []inbound.Addition{
|
||||||
inbound.WithInName("DEFAULT-MIXED"),
|
inbound.WithInName("DEFAULT-MIXED"),
|
||||||
inbound.WithSpecialRules(""),
|
inbound.WithSpecialRules(""),
|
||||||
@ -62,7 +64,7 @@ func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(additions) == 2 { // only apply on default listener
|
if isDefault { // only apply on default listener
|
||||||
if !inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
|
if !inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
|
||||||
_ = c.Close()
|
_ = c.Close()
|
||||||
continue
|
continue
|
||||||
|
@ -35,7 +35,9 @@ func (l *Listener) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) {
|
func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) {
|
||||||
|
isDefault := false
|
||||||
if len(additions) == 0 {
|
if len(additions) == 0 {
|
||||||
|
isDefault = true
|
||||||
additions = []inbound.Addition{
|
additions = []inbound.Addition{
|
||||||
inbound.WithInName("DEFAULT-SOCKS"),
|
inbound.WithInName("DEFAULT-SOCKS"),
|
||||||
inbound.WithSpecialRules(""),
|
inbound.WithSpecialRules(""),
|
||||||
@ -59,7 +61,7 @@ func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(additions) == 2 { // only apply on default listener
|
if isDefault { // only apply on default listener
|
||||||
if !inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
|
if !inbound.IsRemoteAddrDisAllowed(c.RemoteAddr()) {
|
||||||
_ = c.Close()
|
_ = c.Close()
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user