add ClientAddr for websocket conn
This commit is contained in:
+13
-3
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/go-gost/core/auth"
|
||||||
"github.com/go-gost/core/logger"
|
"github.com/go-gost/core/logger"
|
||||||
"github.com/go-gost/core/service"
|
"github.com/go-gost/core/service"
|
||||||
"github.com/go-gost/x/api"
|
"github.com/go-gost/x/api"
|
||||||
@@ -151,10 +152,19 @@ func buildService(cfg *config.Config) (services []service.Service) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildAPIService(cfg *config.APIConfig) (service.Service, error) {
|
func buildAPIService(cfg *config.APIConfig) (service.Service, error) {
|
||||||
auther := auth_parser.ParseAutherFromAuth(cfg.Auth)
|
var authers []auth.Authenticator
|
||||||
if cfg.Auther != "" {
|
if auther := auth_parser.ParseAutherFromAuth(cfg.Auth); auther != nil {
|
||||||
auther = registry.AutherRegistry().Get(cfg.Auther)
|
authers = append(authers, auther)
|
||||||
}
|
}
|
||||||
|
if cfg.Auther != "" {
|
||||||
|
authers = append(authers, registry.AutherRegistry().Get(cfg.Auther))
|
||||||
|
}
|
||||||
|
|
||||||
|
var auther auth.Authenticator
|
||||||
|
if len(authers) > 0 {
|
||||||
|
auther = auth.AuthenticatorGroup(authers...)
|
||||||
|
}
|
||||||
|
|
||||||
return api.NewService(
|
return api.NewService(
|
||||||
cfg.Addr,
|
cfg.Addr,
|
||||||
api.PathPrefixOption(cfg.PathPrefix),
|
api.PathPrefixOption(cfg.PathPrefix),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ toolchain go1.22.2
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-gost/core v0.1.7
|
github.com/go-gost/core v0.1.7
|
||||||
github.com/go-gost/x v0.2.5
|
github.com/go-gost/x v0.2.6
|
||||||
github.com/judwhite/go-svc v1.2.1
|
github.com/judwhite/go-svc v1.2.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ github.com/go-gost/relay v0.5.0 h1:JG1tgy/KWiVXS0ukuVXvbM0kbYuJTWxYpJ5JwzsCf/c=
|
|||||||
github.com/go-gost/relay v0.5.0/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8=
|
github.com/go-gost/relay v0.5.0/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8=
|
||||||
github.com/go-gost/tls-dissector v0.1.1 h1:2zUOTPzCQAUQ54Rpy0UEi3JPMQSYsIFSeFeKrzmkCoU=
|
github.com/go-gost/tls-dissector v0.1.1 h1:2zUOTPzCQAUQ54Rpy0UEi3JPMQSYsIFSeFeKrzmkCoU=
|
||||||
github.com/go-gost/tls-dissector v0.1.1/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
|
github.com/go-gost/tls-dissector v0.1.1/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
|
||||||
github.com/go-gost/x v0.2.5 h1:G3V3BBFPLdEbFz2+yD4F/Y6o0gUq6LfNT+PQnYqFsb0=
|
github.com/go-gost/x v0.2.6 h1:VPXx3vEW6LYfvhMqq7y4i4YVTos1K6l0KEYQdLZxKa0=
|
||||||
github.com/go-gost/x v0.2.5/go.mod h1:X8T1VmysaCsmwBDI7ytFiAta1eRVZb4aj4XMg9dncjQ=
|
github.com/go-gost/x v0.2.6/go.mod h1:X8T1VmysaCsmwBDI7ytFiAta1eRVZb4aj4XMg9dncjQ=
|
||||||
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
||||||
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
|
|||||||
Reference in New Issue
Block a user