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

Fix hanging health #677

Merged
merged 4 commits into from
Feb 4, 2021
Merged
Changes from all commits
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: 13 additions & 0 deletions internal/vpn/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func NewClient(cfg ClientConfig, appCl *app.Client) (*Client, error) {
return nil, fmt.Errorf("error getting RF IP: %w", err)
}

utIP, err := uptimeTrackerIPFromEnv()
if err != nil {
return nil, fmt.Errorf("error getting UT IP: %w", err)
}

stcpEntities, err := stcpEntitiesFromEnv()
if err != nil {
return nil, fmt.Errorf("error getting STCP entities: %w", err)
Expand All @@ -99,6 +104,10 @@ func NewClient(cfg ClientConfig, appCl *app.Client) (*Client, error) {
directIPs = append(directIPs, arIP)
}

if utIP != nil {
directIPs = append(directIPs, utIP)
}

const (
serverDialInitBO = 1 * time.Second
serverDialMaxBO = 10 * time.Second
Expand Down Expand Up @@ -552,6 +561,10 @@ func rfIPFromEnv() (net.IP, error) {
return ipFromEnv(RFAddrEnvKey)
}

func uptimeTrackerIPFromEnv() (net.IP, error) {
return ipFromEnv(UptimeTrackerAddrEnvKey)
}

func tpRemoteIPsFromEnv() ([]net.IP, error) {
var ips []net.IP
ipsLenStr := os.Getenv(TPRemoteIPsLenEnvKey)
Expand Down