Skip to content

Commit 2688840

Browse files
fix mycelium ip peers (#24)
* fix mycelium ip peers to get the addresses from public namespace in case public node * fix resources.go linting
1 parent 61d5882 commit 2688840

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pkg/netlight/resource/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import (
1111
"github.com/containernetworking/plugins/pkg/ns"
1212
"github.com/pkg/errors"
1313
localPkg "github.com/threefoldtech/zosbase/pkg"
14+
"github.com/threefoldtech/zosbase/pkg/netbase/nft"
1415
"github.com/threefoldtech/zosbase/pkg/netlight/bridge"
1516
"github.com/threefoldtech/zosbase/pkg/netlight/ifaceutil"
1617
"github.com/threefoldtech/zosbase/pkg/netlight/namespace"
1718
"github.com/threefoldtech/zosbase/pkg/netlight/options"
1819
"github.com/threefoldtech/zosbase/pkg/netlight/tuntap"
19-
"github.com/threefoldtech/zosbase/pkg/netbase/nft"
2020
"github.com/threefoldtech/zosbase/pkg/zinit"
2121
"github.com/vishvananda/netlink"
2222
)

pkg/network/nr/net_resource.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import (
3939

4040
const (
4141
myceliumInterfaceName = "br-my"
42+
publicNamespaceName = "public"
43+
publicInterfaceName = "public"
4244
)
4345

4446
var (
@@ -308,8 +310,14 @@ func (nr *NetResource) SetMycelium() (err error) {
308310
"--peers",
309311
}
310312

311-
// set mycelium public addresses are the private peers
312-
ips, err := baseifaceutil.GetIPsForIFace(ndmz.DmzPub4, ndmz.DmzNamespace)
313+
// set mycelium public addresses as the private peers
314+
mycNamespace, mycInterface := ndmz.DmzNamespace, ndmz.DmzPub4
315+
if namespace.Exists(publicNamespaceName) {
316+
mycNamespace = publicNamespaceName
317+
mycInterface = publicInterfaceName
318+
}
319+
320+
ips, err := baseifaceutil.GetIPsForIFace(mycInterface, mycNamespace)
313321
if err != nil {
314322
return errors.Wrap(err, "failed to get IPs for npub4")
315323
}

0 commit comments

Comments
 (0)