diff --git a/clab/config.go b/clab/config.go index 5e8d49996..ac40a55a4 100644 --- a/clab/config.go +++ b/clab/config.go @@ -68,7 +68,7 @@ type NodeConfig struct { Ports []string `yaml:"ports,omitempty"` // list of port bindings MgmtIPv4 string `yaml:"mgmt_ipv4,omitempty"` // user-defined IPv4 address in the management network MgmtIPv6 string `yaml:"mgmt_ipv6,omitempty"` // user-defined IPv6 address in the management network - Share []string `yaml:"share,omitempty"` // list of ports to share with mysocketctl + Publish []string `yaml:"publish,omitempty"` // list of ports to publish with mysocketctl Env map[string]string `yaml:"env,omitempty"` // environment variables User string `yaml:"user,omitempty"` // linux user used in a container @@ -130,7 +130,7 @@ type Node struct { TLSKey string TLSAnchor string NSPath string // network namespace path for this node - Share []string //list of ports to share with mysocketctl + Publish []string //list of ports to publish with mysocketctl } // Link is a struct that contains the information of a link between 2 containers @@ -374,14 +374,14 @@ func (c *CLab) userInit(nodeCfg *NodeConfig, kind string) string { return "" } -func (c *CLab) shareInit(nodeCfg *NodeConfig, kind string) []string { +func (c *CLab) publishInit(nodeCfg *NodeConfig, kind string) []string { switch { - case len(nodeCfg.Share) != 0: - return nodeCfg.Share - case len(c.Config.Topology.Kinds[kind].Share) != 0: - return c.Config.Topology.Kinds[kind].Share - case len(c.Config.Topology.Defaults.Share) != 0: - return c.Config.Topology.Defaults.Share + case len(nodeCfg.Publish) != 0: + return nodeCfg.Publish + case len(c.Config.Topology.Kinds[kind].Publish) != 0: + return c.Config.Topology.Kinds[kind].Publish + case len(c.Config.Topology.Defaults.Publish) != 0: + return c.Config.Topology.Defaults.Publish } return nil } @@ -424,7 +424,7 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error { user := c.userInit(&nodeCfg, node.Kind) - node.Share = c.shareInit(&nodeCfg, node.Kind) + node.Publish = c.publishInit(&nodeCfg, node.Kind) switch node.Kind { case "ceos": diff --git a/clab/mysocketio.go b/clab/mysocketio.go index d8d263a40..c3692661e 100644 --- a/clab/mysocketio.go +++ b/clab/mysocketio.go @@ -19,13 +19,13 @@ func createMysocketTunnels(ctx context.Context, c *CLab, node *Node) error { } for _, n := range c.Nodes { - if len(n.Share) == 0 { + if len(n.Publish) == 0 { continue } - for _, socket := range n.Share { + for _, socket := range n.Publish { split := strings.Split(socket, "/") if len(split) > 2 { - log.Warnf("wrong mysocketio share definition %s. should be type/port-number, i.e. tcp/22", socket) + log.Warnf("wrong mysocketio publish section %s. should be type/port-number, i.e. tcp/22", socket) } t := split[0] // type p := split[1] // port diff --git a/cmd/inspect.go b/cmd/inspect.go index b3a3dbcaf..eef3a410e 100644 --- a/cmd/inspect.go +++ b/cmd/inspect.go @@ -105,7 +105,7 @@ func toTableData(det []containerDetails) [][]string { func printContainerInspect(c *clab.CLab, containers []types.Container, bridgeName string, format string) { contDetails := make([]containerDetails, 0, len(containers)) - // do not print shared sockets unless mysocketio kind is found + // do not print published ports unless mysocketio kind is found printMysocket := false var mysocketCID string @@ -190,7 +190,7 @@ func printContainerInspect(c *clab.CLab, containers []types.Container, bridgeNam if len(stderr) > 0 { log.Infof("errors during listing mysocketio sockets: %s", string(stderr)) } - fmt.Println("Shared sockets:") + fmt.Println("Published ports:") fmt.Println(string(stdout)) } diff --git a/docs/manual/shared-sockets.md b/docs/manual/published-ports.md similarity index 78% rename from docs/manual/shared-sockets.md rename to docs/manual/published-ports.md index fd13ca24e..3d1404fe9 100644 --- a/docs/manual/shared-sockets.md +++ b/docs/manual/published-ports.md @@ -1,13 +1,13 @@ Containerlab labs are typically deployed in the isolated environments, such as company's internal network, cloud instance or even a laptop. The nodes deployed in a lab can happily talk to each other and, if needed, can reach Internet in the outbound direction. -But sometimes it is really needed to let your lab nodes be reachable over Internet securely and privately in the incoming direction. There are many use cases that warrant such _exposure_, some of the most notable are: +But sometimes it is really needed to let your lab nodes be reachable over Internet securely and privately in the incoming direction. There are many use cases that warrant such _publishing_, some of the most notable are: * create a lab in your environment and share it with a customer/colleague on-demand in no time * make an interactive demo/training where certain nodes' are shared with an audience for hand-on experience * share a private lab with someone to collaborate * expose management interfaces (gNMI, NETCONF, SNMP) to test integration with collectors deployed outside of your lab environment -Containerlab made all of these use cases possible by integrating with [mysocket.io](https://mysocket.io) service. Mysocket.io provides personal tunnels for https/https/tls/tcp sockets over global anycast[^1] network spanning US, Europe and Asia. +Containerlab made all of these use cases possible by integrating with [mysocket.io](https://mysocket.io) service. Mysocket.io provides personal tunnels for https/https/tls/tcp ports over global anycast[^1] network spanning US, Europe and Asia. To make a certain port of a certain node available via mysocket.io tunnel a single line in the topology definition file is all that's needed: @@ -17,15 +17,15 @@ topology: nodes: r1: kind: srl - share: - - tcp/22 # tcp port 22 will be exposed - - tcp/57400 # tcp port 57400 will be exposed - - http/10200 # http service running over 10200 will be exposed + publish: + - tcp/22 # tcp port 22 will be published + - tcp/57400 # tcp port 57400 will be published + - http/10200 # http service running over 10200 will be published ``` -