From 4cd75f29853cdd03c3556f9ea4c9319a3df1845e Mon Sep 17 00:00:00 2001 From: 0xdcarns Date: Tue, 22 Mar 2022 14:18:23 -0400 Subject: [PATCH 1/2] initial commit --- netclient/functions/list.go | 10 ++++++++-- serverctl/iptables.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netclient/functions/list.go b/netclient/functions/list.go index 4ff08cd5..a0d4655b 100644 --- a/netclient/functions/list.go +++ b/netclient/functions/list.go @@ -24,6 +24,9 @@ type Peer struct { type Network struct { Name string `json:"name"` + ID string `json:"id"` + OS string `json:"os"` + Version string `json:"version"` CurrentNode Peer `json:"current_node"` Peers []Peer `json:"peers"` } @@ -68,8 +71,11 @@ func getNetwork(network string) (Network, error) { return Network{}, fmt.Errorf("listing peers for network %v: %w", network, err) } return Network{ - Name: network, - Peers: peers, + Name: network, + ID: cfg.Node.ID, + OS: cfg.Node.OS, + Version: cfg.Node.Version, + Peers: peers, CurrentNode: Peer{ Name: cfg.Node.Name, Interface: cfg.Node.Interface, diff --git a/serverctl/iptables.go b/serverctl/iptables.go index 084d256e..00317a19 100644 --- a/serverctl/iptables.go +++ b/serverctl/iptables.go @@ -84,7 +84,7 @@ func setForwardPolicy() error { // port forward from an entry, can contain a dns name for lookup func iptablesPortForward(entry string, inport string, outport string, isIP bool) error { - logger.Log(1, "forwarding "+entry+" traffic from host port "+inport+" to container port "+outport) + logger.Log(2, "forwarding "+entry+" traffic from host port "+inport+" to container port "+outport) var address string if !isIP { From a477eaa767f1b392b08e4d385934e6cbedc2c1e2 Mon Sep 17 00:00:00 2001 From: 0xdcarns Date: Tue, 22 Mar 2022 15:33:38 -0400 Subject: [PATCH 2/2] added local node ID's to list command --- netclient/functions/list.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/netclient/functions/list.go b/netclient/functions/list.go index a0d4655b..7c9ece94 100644 --- a/netclient/functions/list.go +++ b/netclient/functions/list.go @@ -14,6 +14,7 @@ import ( "google.golang.org/grpc/metadata" ) +// Peer - the peer struct for list type Peer struct { Name string `json:"name"` Interface string `json:"interface,omitempty"` @@ -22,15 +23,15 @@ type Peer struct { PublicEndpoint string `json:"public_endpoint,omitempty"` } +// Network - the local node network representation for list command type Network struct { Name string `json:"name"` - ID string `json:"id"` - OS string `json:"os"` - Version string `json:"version"` + ID string `json:"node_id"` CurrentNode Peer `json:"current_node"` Peers []Peer `json:"peers"` } +// List - lists the current peers for the local node with name and node ID func List(network string) error { nets := []Network{} var err error @@ -71,11 +72,9 @@ func getNetwork(network string) (Network, error) { return Network{}, fmt.Errorf("listing peers for network %v: %w", network, err) } return Network{ - Name: network, - ID: cfg.Node.ID, - OS: cfg.Node.OS, - Version: cfg.Node.Version, - Peers: peers, + Name: network, + ID: cfg.Node.ID, + Peers: peers, CurrentNode: Peer{ Name: cfg.Node.Name, Interface: cfg.Node.Interface,