File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed
Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -378,25 +378,16 @@ func (c *Config) GetPeerPublicKey(i int) string {
378378
379379func (c * Config ) GetPeerEndpoint (i int ) string {
380380 if len (c .peers ) > i {
381- if len (c .peers [i ].endpoint ) > 0 {
382- endpoint := c .peers [i ].endpoint
383- if endpoint != "" {
384- return endpoint
385- }
386-
387- return ""
388-
389- } else {
390- endpoint := c .peers [i ].config .Endpoint
391- if endpoint != nil {
392- return endpoint .String ()
393- }
381+ endpoint := c .peers [i ].endpoint
382+ if endpoint != "" {
383+ return endpoint
384+ }
394385
395- return ""
386+ endpoint := c .peers [i ].config .Endpoint
387+ if endpoint != nil {
388+ return endpoint .String ()
396389 }
397390 }
398-
399- return ""
400391}
401392
402393func (c * Config ) GetLocalhostIP () string {
Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ type PeerConfig struct {
1616 config wgtypes.PeerConfig
1717 privateKey * wgtypes.Key
1818 endpoint string
19+ endpointDNS string
1920 nickname string
2021}
2122
2223type peerConfigJSON struct {
2324 Config wgtypes.PeerConfig
2425 PrivateKey * wgtypes.Key
2526 Nickname string
27+ EndpointDNS string
2628}
2729
2830type PeerConfigArgs struct {
@@ -119,6 +121,7 @@ func (p *PeerConfig) MarshalJSON() ([]byte, error) {
119121 p .config ,
120122 p .privateKey ,
121123 p .nickname ,
124+ p .endpointDNS
122125 })
123126}
124127
@@ -133,6 +136,7 @@ func (p *PeerConfig) UnmarshalJSON(b []byte) error {
133136 p .config = tmp .Config
134137 p .privateKey = tmp .PrivateKey
135138 p .nickname = tmp .Nickname
139+ p .endpointDNS = tmp .EndpointDNS
136140
137141 return nil
138142}
You can’t perform that action at this time.
0 commit comments