-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for SNI/Host proxy loadbalancing
Adding stdinproxy option (to support ssh host loadbalancing on Windows) Removing statically assigned ports from the dyn pool (issue #1)
- Loading branch information
Showing
11 changed files
with
457 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"io" | ||
"net" | ||
"os" | ||
"time" | ||
|
||
"github.com/urfave/cli/v2" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func stdinProxy(ctx *cli.Context) error { | ||
loglevel := log.DebugLevel | ||
if l, err := log.ParseLevel(loglevelstr); err == nil { | ||
loglevel = l | ||
} | ||
|
||
log.SetFormatter(&log.TextFormatter{ | ||
FullTimestamp: true, | ||
}) | ||
log.SetLevel(loglevel) | ||
log.SetOutput(os.Stdout) | ||
|
||
doProxy() | ||
|
||
//c := make(chan os.Signal, 2) | ||
//signal.Notify(c, os.Interrupt, syscall.SIGTERM) | ||
|
||
//<-c | ||
|
||
return nil | ||
} | ||
|
||
func doProxy() error { | ||
tcpAddr, err := net.ResolveTCPAddr("tcp", serviceendpoint) | ||
if err != nil { | ||
log.Errorf("session: [%s], failed to resolve endpoint [%s]", tcpAddr.String(), err.Error()) | ||
return err | ||
} | ||
|
||
d := net.Dialer{Timeout: 5 * time.Second} | ||
backConn, err := d.Dial("tcp", tcpAddr.String()) | ||
if err != nil { | ||
log.Errorf("session: [%s], failed to connect to [%s]", tcpAddr.String(), err.Error()) | ||
return err | ||
} | ||
|
||
go io.Copy(backConn, os.Stdin) | ||
io.Copy(os.Stdout, backConn) | ||
|
||
return nil | ||
} |
Oops, something went wrong.