fix: auth with CFMA compile issue

This commit is contained in:
wwqgtxx 2024-07-26 10:55:03 +08:00
parent 4051ea522a
commit 40c9829328

View File

@ -33,10 +33,20 @@ func (l *Listener) Close() 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
if len(additions) == 0 {
isDefault = true