Skip to content

Commit

Permalink
fix: auth with CFMA compile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Jul 26, 2024
1 parent 4051ea5 commit 40c9829
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions listener/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40c9829

Please sign in to comment.