@@ -37,14 +37,14 @@ const (
3737 //NdmzBridge is the name of the ipv4 routing bridge in the host namespace
3838 NdmzBridge = "br-ndmz"
3939
40- //dmzNamespace name of the dmz namespace
41- dmzNamespace = "ndmz"
40+ //DmzNamespace name of the dmz namespace
41+ DmzNamespace = "ndmz"
4242
4343 ndmzNsMACDerivationSuffix6 = "-ndmz6"
4444 ndmzNsMACDerivationSuffix4 = "-ndmz4"
4545
46- // dmzPub4 ipv4 public interface
47- dmzPub4 = "npub4"
46+ // DmzPub4 ipv4 public interface
47+ DmzPub4 = "npub4"
4848 // dmzPub6 ipv6 public interface
4949 dmzPub6 = "npub6"
5050
@@ -69,7 +69,7 @@ func New(nodeID string, public *netlink.Bridge) DMZ {
6969}
7070
7171func (d * dmzImpl ) Namespace () string {
72- return dmzNamespace
72+ return DmzNamespace
7373}
7474
7575// Create create the NDMZ network namespace and configure its default routes and addresses
@@ -85,9 +85,9 @@ func (d *dmzImpl) Create(ctx context.Context) error {
8585 // master will actually be `zos`. In that case, we can't plug the physical
8686 // iface, but need to create a veth pair between br-pub and zos.
8787
88- netNS , err := namespace .GetByName (dmzNamespace )
88+ netNS , err := namespace .GetByName (DmzNamespace )
8989 if err != nil {
90- netNS , err = namespace .Create (dmzNamespace )
90+ netNS , err = namespace .Create (DmzNamespace )
9191 if err != nil {
9292 return errors .Wrap (err , "failed to create ndmz namespace" )
9393 }
@@ -103,7 +103,7 @@ func (d *dmzImpl) Create(ctx context.Context) error {
103103 return errors .Wrapf (err , "ndmz: could not node create pub iface 6" )
104104 }
105105
106- if err := createPubIface4 (dmzPub4 , d .nodeID , netNS ); err != nil {
106+ if err := createPubIface4 (DmzPub4 , d .nodeID , netNS ); err != nil {
107107 return errors .Wrapf (err , "ndmz: could not create pub iface 4" )
108108 }
109109
@@ -134,7 +134,7 @@ func (d *dmzImpl) Create(ctx context.Context) error {
134134 }
135135
136136 z := zinit .Default ()
137- dhcpMon := NewDHCPMon (dmzPub4 , dmzNamespace , z )
137+ dhcpMon := NewDHCPMon (DmzPub4 , DmzNamespace , z )
138138 go func () {
139139 _ = dhcpMon .Start (ctx )
140140 }()
@@ -144,7 +144,7 @@ func (d *dmzImpl) Create(ctx context.Context) error {
144144
145145// Delete deletes the NDMZ network namespace
146146func (d * dmzImpl ) Delete () error {
147- netNS , err := namespace .GetByName (dmzNamespace )
147+ netNS , err := namespace .GetByName (DmzNamespace )
148148 if err == nil {
149149 if err := namespace .Delete (netNS ); err != nil {
150150 return errors .Wrap (err , "failed to delete ndmz network namespace" )
@@ -230,7 +230,7 @@ func (d *dmzImpl) AttachNR(networkID, nrNSName string, ipamLeaseDir string) erro
230230
231231func (d * dmzImpl ) GetIPFor (inf string ) ([]net.IPNet , error ) {
232232
233- netns , err := namespace .GetByName (dmzNamespace )
233+ netns , err := namespace .GetByName (DmzNamespace )
234234 if err != nil {
235235 return nil , err
236236 }
@@ -262,7 +262,7 @@ func (d *dmzImpl) GetIPFor(inf string) ([]net.IPNet, error) {
262262func (d * dmzImpl ) GetIP (family int ) ([]net.IPNet , error ) {
263263 var links []string
264264 if family == netlink .FAMILY_V4 || family == netlink .FAMILY_ALL {
265- links = append (links , dmzPub4 )
265+ links = append (links , DmzPub4 )
266266 }
267267 if family == netlink .FAMILY_V6 || family == netlink .FAMILY_ALL {
268268 links = append (links , dmzPub6 )
@@ -272,7 +272,7 @@ func (d *dmzImpl) GetIP(family int) ([]net.IPNet, error) {
272272 return nil , nil
273273 }
274274
275- netns , err := namespace .GetByName (dmzNamespace )
275+ netns , err := namespace .GetByName (DmzNamespace )
276276 if err != nil {
277277 return nil , err
278278 }
@@ -305,7 +305,7 @@ func (d *dmzImpl) GetIP(family int) ([]net.IPNet, error) {
305305
306306// Get gateway to given destination ip
307307func (d * dmzImpl ) GetDefaultGateway (destination net.IP ) (net.IP , error ) {
308- netns , err := namespace .GetByName (dmzNamespace )
308+ netns , err := namespace .GetByName (DmzNamespace )
309309 if err != nil {
310310 return nil , err
311311 }
@@ -378,7 +378,7 @@ func (d *dmzImpl) Interfaces() ([]types.IfaceInfo, error) {
378378 }
379379
380380 // get the ndmz network namespace
381- ndmz , err := namespace .GetByName (dmzNamespace )
381+ ndmz , err := namespace .GetByName (DmzNamespace )
382382 if err != nil {
383383 return nil , err
384384 }
@@ -398,10 +398,10 @@ func waitIP4() error {
398398 ctx , cancel := context .WithTimeout (context .Background (), 30 * time .Second )
399399 defer cancel ()
400400
401- probe , err := dhcp .Probe (ctx , dmzPub4 )
401+ probe , err := dhcp .Probe (ctx , DmzPub4 )
402402
403403 if err != nil {
404- return errors .Wrapf (err , "error while proping interface '%s'" , dmzPub4 )
404+ return errors .Wrapf (err , "error while proping interface '%s'" , DmzPub4 )
405405 }
406406 if len (probe .IP ) != 0 && len (probe .Router ) != 0 {
407407 return nil
@@ -554,7 +554,7 @@ func applyFirewall() error {
554554 return errors .Wrap (err , "failed to build nft rule set" )
555555 }
556556
557- if err := nft .Apply (& buf , dmzNamespace ); err != nil {
557+ if err := nft .Apply (& buf , DmzNamespace ); err != nil {
558558 return errors .Wrap (err , "failed to apply nft rule set" )
559559 }
560560
0 commit comments