Skip to content

Commit

Permalink
fix: remove useless log (bittorrent#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunbenxin authored and Yrp committed Jan 7, 2022
1 parent a5b0120 commit 2e06c3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 4 additions & 8 deletions bindata/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package bindata
import (
"bytes"
"errors"
"fmt"

"github.com/ip2location/ip2location-go/v9"
"github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -58,16 +57,13 @@ func CountryShortCodeByIP(addr string) (string, error) {

func CountryShortCode(addr multiaddr.Multiaddr) (string, error) {
ipv4, err := addr.ValueForProtocol(multiaddr.P_IP4)
if err != nil {
fmt.Printf("get ipv4 err:%+v", err)
} else {
if err == nil {
return CountryShortCodeByIP(ipv4)
}

ipv6, err := addr.ValueForProtocol(multiaddr.P_IP6)
if err != nil {
fmt.Printf("get ipv6 err:%+v", err)
return "", err
if err == nil {
return CountryShortCodeByIP(ipv6)
}
return CountryShortCodeByIP(ipv6)
return "", err
}
4 changes: 1 addition & 3 deletions core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ var swarmPeersCmd = &cmds.Command{
}

// fill int short country code by ip address
if code, err := bindata.CountryShortCode(c.Address()); err != nil {
fmt.Printf("get country short code err:%+v", err)
} else {
if code, err := bindata.CountryShortCode(c.Address()); err == nil {
ci.CountryShort = code
}

Expand Down

0 comments on commit 2e06c3e

Please sign in to comment.