Skip to content

Commit 8032c26

Browse files
committed
pointer dereferencing
1 parent 9299193 commit 8032c26

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/peer/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func (c *Config) AsShareableFile() string {
459459

460460
s.WriteString("[Peer]\n")
461461
s.WriteString(fmt.Sprintf("PublicKey = %s\n", c.config.PrivateKey.PublicKey().String()))
462-
if len(c.presharedKey) > 0 {
462+
if c.presharedKey != nil {
463463
s.WriteString(fmt.Sprintf("PresharedKey = %s\n", c.presharedKey.String()))
464464
}
465465
s.WriteString("AllowedIPs = 0.0.0.0/32\n")
@@ -511,7 +511,7 @@ func CreateServerCommand(relayConfig Config, e2eeConfig Config, shell Shell, sim
511511
keys = append(keys, "WIRETAP_RELAY_PEER_PUBLICKEY")
512512
vals = append(vals, relayConfig.GetPeerPublicKey(0))
513513

514-
if len(relayConfig.GetPresharedKey()) > 0 {
514+
if relayConfig.presharedKey != nil {
515515
keys = append(keys, "WIRETAP_RELAY_PEER_PRESHAREDKEY")
516516
vals = append(vals, relayConfig.GetPresharedKey())
517517
}
@@ -615,7 +615,7 @@ func CreateServerFile(relayConfig Config, e2eeConfig Config, simple bool) string
615615
}
616616

617617
s.WriteString(fmt.Sprintf("PublicKey = %s\n", relayConfig.GetPeerPublicKey(0)))
618-
if len(relayConfig.GetPresharedKey()) > 0 {
618+
if relayConfig.presharedKey != nil {
619619
s.WriteString(fmt.Sprintf("PresharedKey = %s\n", relayConfig.GetPresharedKey()))
620620
}
621621
if len(relayConfig.GetPeerEndpoint(0)) > 0 {

src/peer/peer_config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ func (p *PeerConfig) AsIPC() string {
289289
var s strings.Builder
290290

291291
s.WriteString(fmt.Sprintf("public_key=%s\n", hex.EncodeToString(p.config.PublicKey[:])))
292-
if len(p.config.PresharedKey) != 0 {
293-
s.WriteString(fmt.Sprintf("preshared_key=%s\n", p.config.PresharedKey.String()))
292+
if p.config.PresharedKey != nil {
293+
s.WriteString(fmt.Sprintf("preshared_key=%s\n", hex.EncodeToString(p.config.PresharedKey[:])))
294294
}
295295
if p.config.Endpoint != nil {
296296
s.WriteString(fmt.Sprintf("endpoint=%s\n", p.config.Endpoint.String()))

0 commit comments

Comments
 (0)