add sshd listener

This commit is contained in:
ginuerzh
2022-01-26 15:53:33 +08:00
parent a134026e76
commit 04dfc8c4c3
39 changed files with 1101 additions and 848 deletions

View File

@ -274,6 +274,13 @@ func buildServiceConfig(url *url.URL) (*config.ServiceConfig, error) {
Metadata: md,
}
if svc.Handler.Type == "sshd" {
svc.Handler.Auths = nil
}
if svc.Listener.Type == "sshd" {
svc.Listener.Auths = auths
}
return svc, nil
}
@ -354,6 +361,13 @@ func buildNodeConfig(url *url.URL) (*config.NodeConfig, error) {
Metadata: md,
}
if node.Connector.Type == "sshd" {
node.Connector.Auth = nil
}
if node.Dialer.Type == "sshd" {
node.Dialer.Auth = auth
}
return node, nil
}

View File

@ -91,6 +91,7 @@ func buildService(cfg *config.Config) (services []*service.Service) {
ln := registry.GetListener(svc.Listener.Type)(
listener.AddrOption(svc.Addr),
listener.ChainOption(chains[svc.Listener.Chain]),
listener.AuthsOption(authsFromConfig(svc.Listener.Auths...)...),
listener.TLSConfigOption(tlsConfig),
listener.LoggerOption(listenerLogger),

View File

@ -37,7 +37,6 @@ import (
_ "github.com/go-gost/gost/pkg/handler/dns"
_ "github.com/go-gost/gost/pkg/handler/forward/local"
_ "github.com/go-gost/gost/pkg/handler/forward/remote"
_ "github.com/go-gost/gost/pkg/handler/forward/ssh"
_ "github.com/go-gost/gost/pkg/handler/http"
_ "github.com/go-gost/gost/pkg/handler/http2"
_ "github.com/go-gost/gost/pkg/handler/redirect"
@ -47,6 +46,7 @@ import (
_ "github.com/go-gost/gost/pkg/handler/socks/v5"
_ "github.com/go-gost/gost/pkg/handler/ss"
_ "github.com/go-gost/gost/pkg/handler/ss/udp"
_ "github.com/go-gost/gost/pkg/handler/sshd"
_ "github.com/go-gost/gost/pkg/handler/tap"
_ "github.com/go-gost/gost/pkg/handler/tun"
@ -65,6 +65,7 @@ import (
_ "github.com/go-gost/gost/pkg/listener/rtcp"
_ "github.com/go-gost/gost/pkg/listener/rudp"
_ "github.com/go-gost/gost/pkg/listener/ssh"
_ "github.com/go-gost/gost/pkg/listener/sshd"
_ "github.com/go-gost/gost/pkg/listener/tap"
_ "github.com/go-gost/gost/pkg/listener/tcp"
_ "github.com/go-gost/gost/pkg/listener/tls"