mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
fix sending
This commit is contained in:
parent
fe38107c42
commit
73c33ebe02
1 changed files with 5 additions and 5 deletions
|
@ -92,14 +92,14 @@ func (c *Croc) Receive(codephrase string) (err error) {
|
|||
client := http.Client{
|
||||
Timeout: timeout,
|
||||
}
|
||||
resp, err := client.Get(fmt.Sprintf("http://%s:%s/", discovered[0].Address, discovered[0].Payload))
|
||||
ports := strings.Split(string(discovered[0].Payload), "-")
|
||||
if len(ports) != 2 {
|
||||
return errors.New("bad payload")
|
||||
}
|
||||
resp, err := client.Get(fmt.Sprintf("http://%s:%s/", discovered[0].Address, ports[0]))
|
||||
if err == nil {
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
// we connected, so use this
|
||||
ports := strings.Split(string(discovered[0].Payload), "-")
|
||||
if len(ports) != 2 {
|
||||
return errors.New("bad payload")
|
||||
}
|
||||
return c.sendReceive(discovered[0].Address, ports[0], ports[1], "", codephrase, false, true)
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue