Unverified Commit 58dded76 authored by Eric_Lee's avatar Eric_Lee Committed by GitHub

support tcp proxy (#72)

parent 88935357
...@@ -24,6 +24,7 @@ require ( ...@@ -24,6 +24,7 @@ require (
github.com/leonelquinteros/gotext v1.4.0 github.com/leonelquinteros/gotext v1.4.0
github.com/mattn/go-runewidth v0.0.4 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/olekukonko/tablewriter v0.0.1 github.com/olekukonko/tablewriter v0.0.1
github.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994
github.com/pkg/errors v0.8.1 github.com/pkg/errors v0.8.1
github.com/pkg/sftp v1.10.0 github.com/pkg/sftp v1.10.0
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
......
...@@ -66,6 +66,8 @@ github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7 ...@@ -66,6 +66,8 @@ github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994 h1:3ssKn22MN6oLH+l2iimsBdCliSgELXTBWWR+yooB2lQ=
github.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994/go.mod h1:6/gX3+E/IYGa0wMORlSMla999awQFdbaeQCHjSMKIzY=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.0 h1:DGA1KlA9esU6WcicH+P8PxFZOl15O6GYtab1cIJdOlE= github.com/pkg/sftp v1.10.0 h1:DGA1KlA9esU6WcicH+P8PxFZOl15O6GYtab1cIJdOlE=
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"net" "net"
"github.com/gliderlabs/ssh" "github.com/gliderlabs/ssh"
"github.com/pires/go-proxyproto"
"github.com/jumpserver/koko/pkg/auth" "github.com/jumpserver/koko/pkg/auth"
"github.com/jumpserver/koko/pkg/config" "github.com/jumpserver/koko/pkg/config"
...@@ -36,7 +37,12 @@ func StartServer() { ...@@ -36,7 +37,12 @@ func StartServer() {
} }
// Set sftp handler // Set sftp handler
sshServer.SetSubsystemHandler("sftp", handler.SftpHandler) sshServer.SetSubsystemHandler("sftp", handler.SftpHandler)
logger.Fatal(sshServer.ListenAndServe()) ln, err := net.Listen("tcp", addr)
if err != nil {
logger.Fatal(err)
}
proxyListener := &proxyproto.Listener{Listener: ln}
logger.Fatal(sshServer.Serve(proxyListener))
} }
func StopServer() { func StopServer() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment