Skip to content

Commit

Permalink
Expose ExternalIP()
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia committed Oct 10, 2018
1 parent 2cc848e commit 4265cb3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func GenTxCmd(ctx *Context, cdc *codec.Codec, appInit AppInit) *cobra.Command {

ip := viper.GetString(FlagIP)
if len(ip) == 0 {
eip, err := externalIP()
eip, err := ExternalIP()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion server/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func testnetWithConfig(config *cfg.Config, cdc *codec.Codec, appInit AppInit) er
func getIP(i int) (ip string, err error) {
ip = viper.GetString(startingIPAddress)
if len(ip) == 0 {
ip, err = externalIP()
ip, err = ExternalIP()
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.Raw

// https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go
// TODO there must be a better way to get external IP
func externalIP() (string, error) {
func ExternalIP() (string, error) {
ifaces, err := net.Interfaces()
if err != nil {
return "", err
Expand Down

0 comments on commit 4265cb3

Please sign in to comment.