Eliminated usages with net.IP unless correct in context

This commit is contained in:
David Vennik
2022-12-24 14:11:47 +00:00
parent 548fda244e
commit 76f56b863c
3 changed files with 10 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
package client
import (
"net"
"net/netip"
"github.com/Indra-Labs/indra"
"github.com/Indra-Labs/indra/pkg/ifc"
@@ -19,7 +19,7 @@ var (
)
type Client struct {
net.IP
*netip.AddrPort
Prv *prv.Key
Pub *pub.Key
*node.Node
@@ -32,14 +32,14 @@ type Client struct {
qu.C
}
func New(tpt ifc.Transport, nodes node.Nodes) (c *Client, e error) {
func New(tpt ifc.Transport, no *node.Node, nodes node.Nodes) (c *Client, e error) {
var p *prv.Key
if p, e = prv.GenerateKey(); check(e) {
return
}
pubKey := pub.Derive(p)
var n *node.Node
n, _ = node.New(nil, pubKey, nil, tpt)
n, _ = node.New(no.AddrPort, pubKey, nil, tpt)
c = &Client{
Node: n,
Nodes: nodes,

View File

@@ -4,7 +4,6 @@ package node
import (
"fmt"
"net"
"net/netip"
"github.com/Indra-Labs/indra"
@@ -93,8 +92,8 @@ func (n Nodes) DeleteByID(ii nonce.ID) (nn Nodes, e error) {
return n, e
}
// DeleteByIP deletes a node identified by a net.IP.
func (n Nodes) DeleteByIP(ip net.IP) (nn Nodes, e error) {
// DeleteByAddrPort deletes a node identified by a netip.AddrPort.
func (n Nodes) DeleteByAddrPort(ip netip.AddrPort) (nn Nodes, e error) {
e = fmt.Errorf("node with ip %v not found", ip)
nn = n
for i := range n {

View File

@@ -10,11 +10,11 @@ var (
// GitRef is the gitref, as in refs/heads/branchname.
GitRef = "refs/heads/main"
// ParentGitCommit is the commit hash of the parent HEAD.
ParentGitCommit = "6ee53acb90e5a9d67a327f8794745a0fac1b7e7e"
ParentGitCommit = "bdda61da0b46433a5dce707abd7f1b6063266e42"
// BuildTime stores the time when the current binary was built.
BuildTime = "2022-12-24T14:07:35Z"
BuildTime = "2022-12-24T14:11:47Z"
// SemVer lists the (latest) git tag on the build.
SemVer = "v0.0.229"
SemVer = "v0.0.230"
// PathBase is the path base returned from runtime caller.
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
// Major is the major number from the tag.
@@ -22,7 +22,7 @@ var (
// Minor is the minor number from the tag.
Minor = 0
// Patch is the patch version number from the tag.
Patch = 229
Patch = 230
)
// Version returns a pretty printed version information string.