From 8161f48c1563e0c003fe98c17b44bc7967a2b50f Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 4 Oct 2021 23:21:59 -0300 Subject: [PATCH] apply gofmt --- dht/contact.go | 12 ++++++------ dht/rpc.go | 2 +- extras/util/strings.go | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dht/contact.go b/dht/contact.go index 53fcd23..cd01179 100644 --- a/dht/contact.go +++ b/dht/contact.go @@ -44,14 +44,14 @@ func (c Contact) String() string { func (c Contact) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { - ID string - IP string - Port int + ID string + IP string + Port int PeerPort int }{ - ID: c.ID.Hex(), - IP: c.IP.String(), - Port: c.Port, + ID: c.ID.Hex(), + IP: c.IP.String(), + Port: c.Port, PeerPort: c.PeerPort, }) } diff --git a/dht/rpc.go b/dht/rpc.go index 4158d19..6342f8e 100644 --- a/dht/rpc.go +++ b/dht/rpc.go @@ -102,7 +102,7 @@ type RpcIterativeFindValueArgs struct { type RpcIterativeFindValueResult struct { Contacts []Contact FoundValue bool - Values []Contact + Values []Contact } func (rpc *rpcReceiver) IterativeFindValue(r *http.Request, args *RpcIterativeFindValueArgs, result *RpcIterativeFindValueResult) error { diff --git a/extras/util/strings.go b/extras/util/strings.go index 9000b29..091a58e 100644 --- a/extras/util/strings.go +++ b/extras/util/strings.go @@ -21,6 +21,7 @@ func NormalizeName(s string) string { c := cases.Fold() return c.String(norm.NFD.String(s)) } + // ReverseBytesInPlace reverse the bytes. thanks, Satoshi 😒 func ReverseBytesInPlace(s []byte) { for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {