diff --git a/cmd/gost/config.go b/cmd/gost/config.go index 19cc0f2..0e2ce44 100644 --- a/cmd/gost/config.go +++ b/cmd/gost/config.go @@ -19,6 +19,7 @@ import ( limiter_parser "github.com/go-gost/x/config/parsing/limiter" recorder_parser "github.com/go-gost/x/config/parsing/recorder" resolver_parser "github.com/go-gost/x/config/parsing/resolver" + router_parser "github.com/go-gost/x/config/parsing/router" sd_parser "github.com/go-gost/x/config/parsing/sd" service_parser "github.com/go-gost/x/config/parsing/service" xlogger "github.com/go-gost/x/logger" @@ -86,6 +87,14 @@ func buildService(cfg *config.Config) (services []service.Service) { } } + for _, routerCfg := range cfg.Routers { + if h := router_parser.ParseRouter(routerCfg); h != nil { + if err := registry.RouterRegistry().Register(routerCfg.Name, h); err != nil { + log.Fatal(err) + } + } + } + for _, sdCfg := range cfg.SDs { if h := sd_parser.ParseSD(sdCfg); h != nil { if err := registry.SDRegistry().Register(sdCfg.Name, h); err != nil { diff --git a/go.mod b/go.mod index 7b207ce..a52302e 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.21 replace github.com/templexxx/cpu v0.0.7 => github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a require ( - github.com/go-gost/core v0.0.0-20231118102540-486f2cee616a - github.com/go-gost/x v0.0.0-20231118102809-88cc6ff4d5ba + github.com/go-gost/core v0.0.0-20231119062035-6b01698ea9f4 + github.com/go-gost/x v0.0.0-20231119062321-74639e9c4e78 github.com/judwhite/go-svc v1.2.1 gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) @@ -28,7 +28,7 @@ require ( github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-gost/gosocks4 v0.0.1 // indirect github.com/go-gost/gosocks5 v0.4.0 // indirect - github.com/go-gost/plugin v0.0.0-20231118102615-bfe81cbb44b6 // indirect + github.com/go-gost/plugin v0.0.0-20231119062132-d959ab54847f // indirect github.com/go-gost/relay v0.4.1-0.20230916134211-828f314ddfe7 // indirect github.com/go-gost/tls-dissector v0.0.2-0.20220408131628-aac992c27451 // indirect github.com/go-playground/locales v0.14.1 // indirect diff --git a/go.sum b/go.sum index 7de98b5..2a19281 100644 --- a/go.sum +++ b/go.sum @@ -94,20 +94,20 @@ github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SU github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gost/core v0.0.0-20231118102540-486f2cee616a h1:bGpcollgZpuI0ct6FdJxZ2k7ipu4T6qrQbHc+ZbI29I= -github.com/go-gost/core v0.0.0-20231118102540-486f2cee616a/go.mod h1:ndkgWVYRLwupVaFFWv8ML1Nr8tD3xhHK245PLpUDg4E= +github.com/go-gost/core v0.0.0-20231119062035-6b01698ea9f4 h1:dWj03ofZottHxRi6+oQ17CRgOr8qw/egg0cSpSSpQsk= +github.com/go-gost/core v0.0.0-20231119062035-6b01698ea9f4/go.mod h1:ndkgWVYRLwupVaFFWv8ML1Nr8tD3xhHK245PLpUDg4E= github.com/go-gost/gosocks4 v0.0.1 h1:+k1sec8HlELuQV7rWftIkmy8UijzUt2I6t+iMPlGB2s= github.com/go-gost/gosocks4 v0.0.1/go.mod h1:3B6L47HbU/qugDg4JnoFPHgJXE43Inz8Bah1QaN9qCc= github.com/go-gost/gosocks5 v0.4.0 h1:EIrOEkpJez4gwHrMa33frA+hHXJyevjp47thpMQsJzI= github.com/go-gost/gosocks5 v0.4.0/go.mod h1:1G6I7HP7VFVxveGkoK8mnprnJqSqJjdcASKsdUn4Pp4= -github.com/go-gost/plugin v0.0.0-20231118102615-bfe81cbb44b6 h1:1zFWxk8mmTewdDzzZutO4nremhQ6N93PWdB3FrLfbaQ= -github.com/go-gost/plugin v0.0.0-20231118102615-bfe81cbb44b6/go.mod h1:qXr2Zm9Ex2ATqnWuNUzVZqySPMnuIihvblYZt4MlZLw= +github.com/go-gost/plugin v0.0.0-20231119062132-d959ab54847f h1:V5m5plmwkIt16B251Eg2cK2UOJ1IRe4fNuWdTCqn8ek= +github.com/go-gost/plugin v0.0.0-20231119062132-d959ab54847f/go.mod h1:qXr2Zm9Ex2ATqnWuNUzVZqySPMnuIihvblYZt4MlZLw= github.com/go-gost/relay v0.4.1-0.20230916134211-828f314ddfe7 h1:qAG1OyjvdA5h221CfFSS3J359V3d2E7dJWyP29QoDSI= github.com/go-gost/relay v0.4.1-0.20230916134211-828f314ddfe7/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8= github.com/go-gost/tls-dissector v0.0.2-0.20220408131628-aac992c27451 h1:xj8gUZGYO3nb5+6Bjw9+tsFkA9sYynrOvDvvC4uDV2I= github.com/go-gost/tls-dissector v0.0.2-0.20220408131628-aac992c27451/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs= -github.com/go-gost/x v0.0.0-20231118102809-88cc6ff4d5ba h1:sPRZZZqPKSeWv8vtCFjizHq5smKzxj0xroOX6JflYQc= -github.com/go-gost/x v0.0.0-20231118102809-88cc6ff4d5ba/go.mod h1:kHksGQnE5Yo4QvERFnGqM5P20L7tYrnkcpdlCpk+XXw= +github.com/go-gost/x v0.0.0-20231119062321-74639e9c4e78 h1:eTJYSFoJFZYQwmJK4zPtDiIcwDffrZS2dZp6Z0D0aY8= +github.com/go-gost/x v0.0.0-20231119062321-74639e9c4e78/go.mod h1:CRFbJMYqHgZC+4YLdx7xizg+7jED/JSdZsEwuWTigTI= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=