move pkg to github.com/go-gost/core

This commit is contained in:
ginuerzh
2022-03-16 20:38:26 +08:00
parent 0a41b70ef4
commit 2864480296
114 changed files with 106 additions and 8330 deletions

View File

@ -10,8 +10,8 @@ import (
"time"
"github.com/go-gost/config"
"github.com/go-gost/gost/v3/pkg/metadata"
"github.com/go-gost/gost/v3/pkg/registry"
"github.com/go-gost/core/metadata"
"github.com/go-gost/core/registry"
)
var (
@ -34,14 +34,12 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) {
if v := os.Getenv("GOST_PROFILING"); v != "" {
cfg.Profiling = &config.ProfilingConfig{
Enable: true,
Addr: v,
Addr: v,
}
}
if v := os.Getenv("GOST_METRICS"); v != "" {
cfg.Metrics = &config.MetricsConfig{
Enable: true,
Addr: v,
Addr: v,
}
}

View File

@ -7,9 +7,9 @@ import (
"github.com/go-gost/api"
"github.com/go-gost/config"
"github.com/go-gost/config/parsing"
"github.com/go-gost/gost/v3/pkg/logger"
"github.com/go-gost/gost/v3/pkg/registry"
"github.com/go-gost/gost/v3/pkg/service"
"github.com/go-gost/core/logger"
"github.com/go-gost/core/registry"
"github.com/go-gost/core/service"
metrics "github.com/go-gost/metrics/service"
)

View File

@ -9,7 +9,7 @@ import (
"runtime"
"github.com/go-gost/config"
"github.com/go-gost/gost/v3/pkg/logger"
"github.com/go-gost/core/logger"
"github.com/go-gost/metrics"
)
@ -63,8 +63,7 @@ func main() {
}
if metricsAddr != "" {
cfg.Metrics = &config.MetricsConfig{
Enable: true,
Addr: metricsAddr,
Addr: metricsAddr,
}
}
} else {
@ -89,7 +88,7 @@ func main() {
os.Exit(0)
}
if cfg.Profiling != nil && cfg.Profiling.Enable {
if cfg.Profiling != nil {
go func() {
addr := cfg.Profiling.Addr
if addr == "" {
@ -113,7 +112,7 @@ func main() {
}()
}
if cfg.Metrics != nil && cfg.Metrics.Enable {
if cfg.Metrics != nil {
metrics.SetGlobal(metrics.NewMetrics())
if cfg.Metrics.Addr != "" {
s, err := buildMetricsService(cfg.Metrics)

View File

@ -2,27 +2,27 @@ package main
import (
// core components
_ "github.com/go-gost/gost/v3/pkg/connector/forward"
_ "github.com/go-gost/gost/v3/pkg/connector/http"
_ "github.com/go-gost/gost/v3/pkg/connector/socks/v4"
_ "github.com/go-gost/gost/v3/pkg/connector/socks/v5"
_ "github.com/go-gost/core/connector/forward"
_ "github.com/go-gost/core/connector/http"
_ "github.com/go-gost/core/connector/socks/v4"
_ "github.com/go-gost/core/connector/socks/v5"
_ "github.com/go-gost/gost/v3/pkg/dialer/tcp"
_ "github.com/go-gost/gost/v3/pkg/dialer/tls"
_ "github.com/go-gost/gost/v3/pkg/dialer/udp"
_ "github.com/go-gost/core/dialer/tcp"
_ "github.com/go-gost/core/dialer/tls"
_ "github.com/go-gost/core/dialer/udp"
_ "github.com/go-gost/gost/v3/pkg/handler/auto"
_ "github.com/go-gost/gost/v3/pkg/handler/forward/local"
_ "github.com/go-gost/gost/v3/pkg/handler/forward/remote"
_ "github.com/go-gost/gost/v3/pkg/handler/http"
_ "github.com/go-gost/gost/v3/pkg/handler/socks/v4"
_ "github.com/go-gost/gost/v3/pkg/handler/socks/v5"
_ "github.com/go-gost/core/handler/auto"
_ "github.com/go-gost/core/handler/forward/local"
_ "github.com/go-gost/core/handler/forward/remote"
_ "github.com/go-gost/core/handler/http"
_ "github.com/go-gost/core/handler/socks/v4"
_ "github.com/go-gost/core/handler/socks/v5"
_ "github.com/go-gost/gost/v3/pkg/listener/rtcp"
_ "github.com/go-gost/gost/v3/pkg/listener/rudp"
_ "github.com/go-gost/gost/v3/pkg/listener/tcp"
_ "github.com/go-gost/gost/v3/pkg/listener/tls"
_ "github.com/go-gost/gost/v3/pkg/listener/udp"
_ "github.com/go-gost/core/listener/rtcp"
_ "github.com/go-gost/core/listener/rudp"
_ "github.com/go-gost/core/listener/tcp"
_ "github.com/go-gost/core/listener/tls"
_ "github.com/go-gost/core/listener/udp"
// extended components
_ "github.com/go-gost/x/connector/http2"

View File

@ -11,7 +11,7 @@ import (
"time"
"github.com/go-gost/config"
tls_util "github.com/go-gost/gost/v3/pkg/common/util/tls"
tls_util "github.com/go-gost/core/common/util/tls"
)
func buildDefaultTLSConfig(cfg *config.TLSConfig) {