Skip to content

Commit

Permalink
fix(): ipv6 connection string (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
n33pm authored Apr 10, 2024
1 parent 20ddb15 commit 3a40160
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/peerprotocol/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ func (c *Connection) generateDialer() error {
// ensureConnection ensures there is an open websocket connection
func (c *Connection) ensureConnection() error {
if c.conn == nil {
u := url.URL{Scheme: "wss", Host: fmt.Sprintf("%s:%d", c.peerIP.String(), c.peerPort), Path: "/ws"}
host := fmt.Sprintf("%s:%d", c.peerIP.String(), c.peerPort)
if c.peerIP.To4() == nil {
host = fmt.Sprintf("[%s]:%d", c.peerIP.String(), c.peerPort)
}
u := url.URL{Scheme: "wss", Host: host, Path: "/ws"}
var err error
c.conn, _, err = c.peerDialer.Dial(u.String(), nil)
if err != nil {
Expand Down

0 comments on commit 3a40160

Please sign in to comment.