mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 07:53:14 +08:00
fix: auth with CFMA compile issue
This commit is contained in:
parent
4051ea522a
commit
40c9829328
@ -33,10 +33,20 @@ 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) {
|
||||||
return NewWithAuthenticate(addr, tunnel, authStore.Authenticator(), additions...)
|
return NewWithAuthenticator(addr, tunnel, authStore.Authenticator(), additions...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticator auth.Authenticator, additions ...inbound.Addition) (*Listener, error) {
|
// NewWithAuthenticate
|
||||||
|
// never change type traits because it's used in CFMA
|
||||||
|
func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additions ...inbound.Addition) (*Listener, error) {
|
||||||
|
authenticator := authStore.Authenticator()
|
||||||
|
if !authenticate {
|
||||||
|
authenticator = nil
|
||||||
|
}
|
||||||
|
return NewWithAuthenticator(addr, tunnel, authenticator, additions...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWithAuthenticator(addr string, tunnel C.Tunnel, authenticator auth.Authenticator, additions ...inbound.Addition) (*Listener, error) {
|
||||||
isDefault := false
|
isDefault := false
|
||||||
if len(additions) == 0 {
|
if len(additions) == 0 {
|
||||||
isDefault = true
|
isDefault = true
|
||||||
|
Loading…
Reference in New Issue
Block a user