mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
19 lines
451 B
Go
19 lines
451 B
Go
package proxy
|
|
|
|
import (
|
|
"github.com/google/tcpproxy"
|
|
"github.com/rancher/k3s/pkg/daemons/config"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func Run(config *config.Node) error {
|
|
logrus.Infof("Starting proxy %s -> %s", config.LocalAddress, config.ServerAddress)
|
|
var proxy tcpproxy.Proxy
|
|
proxy.AddRoute(config.LocalAddress, tcpproxy.To(config.ServerAddress))
|
|
go func() {
|
|
err := proxy.Run()
|
|
logrus.Fatalf("TLS proxy stopped: %v", err)
|
|
}()
|
|
return nil
|
|
}
|