Skip to content

Commit

Permalink
Change back map to slice
Browse files Browse the repository at this point in the history
  • Loading branch information
ersonp committed Jun 26, 2024
1 parent 8c76027 commit bb4d081
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions cmd/dmsgweb/commands/dmsgweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,25 @@ dmsgweb conf file detected: ` + dmsgwebconffile
}
dmsgWebLog.Info("dmsg client pk: %v", pk.String())

dialPK = make(map[int]cipher.PubKey)
dmsgPorts = make(map[int]uint)
dialPK = make([]cipher.PubKey, dmsgSessions)
dmsgPorts = make([]uint, dmsgSessions)
if len(resolveDmsgAddr) > 0 {
for i, dmsgaddr := range resolveDmsgAddr {
for _, dmsgaddr := range resolveDmsgAddr {
dmsgAddr = strings.Split(dmsgaddr, ":")
var pk cipher.PubKey
err := pk.Set(dmsgAddr[0])
if err != nil {
log.Fatalf("failed to parse dmsg <address>:<port> : %v", err)
}
dialPK[i] = pk
dialPK = append(dialPK, pk)
if len(dmsgAddr) > 1 {
dport, err := strconv.ParseUint(dmsgAddr[1], 10, 64)
if err != nil {
log.Fatalf("Failed to parse dmsg port: %v", err)
}
dmsgPorts[i] = uint(dport)
dmsgPorts = append(dmsgPorts, uint(dport))
} else {
dmsgPorts[i] = uint(80)
dmsgPorts = append(dmsgPorts, uint(80))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dmsgweb/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
dmsgDisc string
dmsgSessions int
dmsgAddr []string
dialPK map[int]cipher.PubKey
dialPK []cipher.PubKey
filterDomainSuffix string
sk cipher.SecKey
pk cipher.PubKey
Expand All @@ -41,7 +41,7 @@ var (
wg sync.WaitGroup
isEnvs bool
dmsgPort []uint
dmsgPorts map[int]uint
dmsgPorts []uint
dmsgSess int
wl []string
wlkeys []cipher.PubKey
Expand Down

0 comments on commit bb4d081

Please sign in to comment.