mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
fix websocket address
This commit is contained in:
parent
2788a4e742
commit
b2939a0452
1 changed files with 6 additions and 3 deletions
|
@ -131,11 +131,14 @@ func (c *Croc) sendReceive(address, websocketPort, tcpPort, fname, codephrase st
|
|||
|
||||
done := make(chan struct{})
|
||||
// connect to server
|
||||
log.Debugf("connecting to %s", address+"/ws?room="+codephrase[:3])
|
||||
websocketAddress := ""
|
||||
if len(websocketPort) > 0 {
|
||||
address += ":" + websocketPort
|
||||
websocketAddress = fmt.Sprintf("ws://%s:%s/ws?room=%s", address, websocketPort, codephrase[:3])
|
||||
} else {
|
||||
websocketAddress = fmt.Sprintf("ws://%s/ws?room=%s", address, codephrase[:3])
|
||||
}
|
||||
sock, _, err := websocket.DefaultDialer.Dial("ws://"+address+"/ws?room="+codephrase[:3], nil)
|
||||
log.Debugf("connecting to %s", websocketAddress)
|
||||
sock, _, err := websocket.DefaultDialer.Dial(websocketAddress, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue