Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom ports #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkg/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net"
"net/http"
"runtime"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -79,8 +80,10 @@ func InitConnection(server string, cfg *config.Config, tlsConfig *tls.Config) (*
config.Bool(cfg.IPv6 && bool(cfg.F5Config.Object.IPv6)),
cfg.F5Config.Object.UrZ,
)

serverIPs, err := net.LookupIP(server)
servername := strings.SplitN(server, ":", -1)[0]
serverport := strings.SplitN(server, ":", -1)[1]
log.Printf("Eggz: Server: %q", servername)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Eggz?

serverIPs, err := net.LookupIP(servername)
if err != nil || len(serverIPs) == 0 {
return nil, fmt.Errorf("failed to resolve %s: %s", server, err)
}
Expand Down Expand Up @@ -111,12 +114,12 @@ func InitConnection(server string, cfg *config.Config, tlsConfig *tls.Config) (*
}
l.HTTPConn, err = dtls.Dial("udp", addr, conf)
if err != nil {
return nil, fmt.Errorf("failed to dial %s:%s: %s", server, cfg.F5Config.Object.TunnelPortDTLS, err)
return nil, fmt.Errorf("failed to dial %s:%s: %s", servername, cfg.F5Config.Object.TunnelPortDTLS, err)
}
} else {
l.HTTPConn, err = tls.Dial("tcp", fmt.Sprintf("%s:443", server), tlsConfig)
l.HTTPConn, err = tls.Dial("tcp", fmt.Sprintf("%s:%s", servername, serverport), tlsConfig)
if err != nil {
return nil, fmt.Errorf("failed to dial %s:443: %s", server, err)
return nil, fmt.Errorf("failed to dial %s:%s: %s", servername, serverport, err)
}
}

Expand Down