MCPcopy Create free account
hub / github.com/eth-easl/dirigent / GetLocalIP

Function GetLocalIP

pkg/network/ip.go:32–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30)
31
32func GetLocalIP() string {
33 cmd := exec.Command("bash", "-c", "/usr/bin/netstat -ie | grep -B1 '10.0.1' | sed -n 2p | tr -s ' ' | cut -d ' ' -f 3")
34 stdout, err := cmd.Output()
35
36 if err != nil {
37 logrus.Fatal(err)
38 }
39
40 ip := string(stdout)
41 ip = ip[0 : len(ip)-1]
42
43 return ip
44}

Callers 2

mainFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected