mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-26 09:02:57 +08:00
Merge pull request #953 from gravitl/feature_v0.12.2_list_id
Feature v0.12.2 list
This commit is contained in:
commit
94d843c3bd
2 changed files with 6 additions and 1 deletions
|
@ -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,12 +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:"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
|
||||
|
@ -69,6 +73,7 @@ func getNetwork(network string) (Network, error) {
|
|||
}
|
||||
return Network{
|
||||
Name: network,
|
||||
ID: cfg.Node.ID,
|
||||
Peers: peers,
|
||||
CurrentNode: Peer{
|
||||
Name: cfg.Node.Name,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue