Skip to content

Commit

Permalink
Add error log
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat committed May 11, 2020
1 parent 12fe7d4 commit 89298bc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tunnel/cmd/localproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ func main() {
log.Fatal("error: one of -proxy-endpoint or -region must be specified")
}

proxyOpt := func(opt *tunnel.ProxyOptions) error {
opt.InsecureSkipVerify = *noSSLHostVerify
opt.Scheme = *proxyScheme
return nil
proxyOpts := []tunnel.ProxyOption{
func(opt *tunnel.ProxyOptions) error {
opt.InsecureSkipVerify = *noSSLHostVerify
opt.Scheme = *proxyScheme
return nil
},
tunnel.WithErrorHandler(tunnel.ErrorHandlerFunc(func(err error) {
log.Print(err)
})),
}

switch {
Expand All @@ -49,15 +54,15 @@ func main() {
if err != nil {
log.Fatalf("error: %v", err)
}
err = tunnel.ProxySource(listener, endpoint, *accessToken, proxyOpt)
err = tunnel.ProxySource(listener, endpoint, *accessToken, proxyOpts...)
if err != nil {
log.Fatalf("error: %v", err)
}

case *destinationApp != "" && *sourcePort == 0:
err := tunnel.ProxyDestination(func() (io.ReadWriteCloser, error) {
return net.Dial("tcp", *destinationApp)
}, endpoint, *accessToken, proxyOpt)
}, endpoint, *accessToken, proxyOpts...)
if err != nil {
log.Fatalf("error: %v", err)
}
Expand Down

0 comments on commit 89298bc

Please sign in to comment.