@@ -603,18 +603,22 @@ func getIPConfig(v *viper.Viper) (node.IPConfig, error) {
603
603
return node.IPConfig {}, fmt .Errorf ("only one of --%s and --%s can be given" , PublicIPKey , PublicIPResolutionServiceKey )
604
604
}
605
605
606
+ // Define default configuration
607
+ ipConfig := node.IPConfig {
608
+ IPUpdater : dynamicip .NewNoUpdater (),
609
+ IPResolutionFreq : ipResolutionFreq ,
610
+ Nat : nat .NewNoRouter (),
611
+ ListenHost : v .GetString (StakingHostKey ),
612
+ }
613
+
606
614
if publicIP != "" {
607
615
// User specified a specific public IP to use.
608
616
ip := net .ParseIP (publicIP )
609
617
if ip == nil {
610
618
return node.IPConfig {}, fmt .Errorf ("invalid IP Address %s" , publicIP )
611
619
}
612
- return node.IPConfig {
613
- IPPort : ips .NewDynamicIPPort (ip , stakingPort ),
614
- IPUpdater : dynamicip .NewNoUpdater (),
615
- IPResolutionFreq : ipResolutionFreq ,
616
- Nat : nat .NewNoRouter (),
617
- }, nil
620
+ ipConfig .IPPort = ips .NewDynamicIPPort (ip , stakingPort )
621
+ return ipConfig , nil
618
622
}
619
623
if ipResolutionService != "" {
620
624
// User specified to use dynamic IP resolution.
@@ -630,18 +634,9 @@ func getIPConfig(v *viper.Viper) (node.IPConfig, error) {
630
634
if err != nil {
631
635
return node.IPConfig {}, fmt .Errorf ("couldn't resolve public IP: %w" , err )
632
636
}
633
- ipPort := ips .NewDynamicIPPort (ip , stakingPort )
634
-
635
- return node.IPConfig {
636
- IPPort : ipPort ,
637
- IPUpdater : dynamicip .NewUpdater (
638
- ipPort ,
639
- resolver ,
640
- ipResolutionFreq ,
641
- ),
642
- IPResolutionFreq : ipResolutionFreq ,
643
- Nat : nat .NewNoRouter (),
644
- }, nil
637
+ ipConfig .IPPort = ips .NewDynamicIPPort (ip , stakingPort )
638
+ ipConfig .IPUpdater = dynamicip .NewUpdater (ipConfig .IPPort , resolver , ipResolutionFreq )
639
+ return ipConfig , nil
645
640
}
646
641
647
642
// User didn't specify a public IP to use, and they didn't specify a public IP resolution
@@ -651,13 +646,10 @@ func getIPConfig(v *viper.Viper) (node.IPConfig, error) {
651
646
if err != nil {
652
647
return node.IPConfig {}, fmt .Errorf ("public IP / IP resolution service not given and failed to resolve IP with NAT: %w" , err )
653
648
}
654
- return node.IPConfig {
655
- Nat : nat ,
656
- AttemptedNATTraversal : true ,
657
- IPPort : ips .NewDynamicIPPort (ip , stakingPort ),
658
- IPUpdater : dynamicip .NewNoUpdater (),
659
- IPResolutionFreq : ipResolutionFreq ,
660
- }, nil
649
+ ipConfig .IPPort = ips .NewDynamicIPPort (ip , stakingPort )
650
+ ipConfig .Nat = nat
651
+ ipConfig .AttemptedNATTraversal = true
652
+ return ipConfig , nil
661
653
}
662
654
663
655
func getProfilerConfig (v * viper.Viper ) (profiler.Config , error ) {
0 commit comments