Skip to content

Commit

Permalink
disable host local ip
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Jansson <[email protected]>
  • Loading branch information
andreasjansson committed Jan 6, 2021
1 parent 0f63da3 commit 5af9906
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions go/pkg/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"math/rand"
"net"
"os/user"
"strings"
"time"
Expand Down Expand Up @@ -214,13 +213,7 @@ func (p *Project) CreateExperiment(args CreateExperimentArgs, async bool, workCh
return nil, errors.IncompatibleRepositoryVersion(p.repository.RootURL())
}

hostIP, err := localIP()
host := ""
if err == nil {
host = hostIP.String()
} else {
console.Warn("Failed to determine host IP: %s", err)
}
host := "" // currently disabled and unused
currentUser, err := user.Current()
username := ""
if err == nil {
Expand Down Expand Up @@ -404,26 +397,3 @@ func generateRandomID() string {
}
return b.String()
}

// Get local IP address of this machine
func localIP() (net.IP, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, iface := range ifaces {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, addr := range addrs {
switch v := addr.(type) {
case *net.IPNet:
return v.IP, nil
case *net.IPAddr:
return v.IP, nil
}
}
}
return nil, fmt.Errorf("No local IP address found")
}

0 comments on commit 5af9906

Please sign in to comment.