mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
#454 fixed local transfer
This commit is contained in:
parent
353ae0db16
commit
1a635de69c
1 changed files with 8 additions and 1 deletions
|
@ -338,12 +338,19 @@ func (c *Client) setupLocalRelay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) broadcastOnLocalNetwork(useipv6 bool) {
|
func (c *Client) broadcastOnLocalNetwork(useipv6 bool) {
|
||||||
|
var timeLimit time.Duration
|
||||||
|
//if we don't use an external relay, the broadcast messages need to be sent continuously
|
||||||
|
if c.Options.OnlyLocal {
|
||||||
|
timeLimit = -1 * time.Second
|
||||||
|
} else {
|
||||||
|
timeLimit = 30 * time.Second
|
||||||
|
}
|
||||||
// look for peers first
|
// look for peers first
|
||||||
settings := peerdiscovery.Settings{
|
settings := peerdiscovery.Settings{
|
||||||
Limit: -1,
|
Limit: -1,
|
||||||
Payload: []byte("croc" + c.Options.RelayPorts[0]),
|
Payload: []byte("croc" + c.Options.RelayPorts[0]),
|
||||||
Delay: 20 * time.Millisecond,
|
Delay: 20 * time.Millisecond,
|
||||||
TimeLimit: 30 * time.Second,
|
TimeLimit: timeLimit,
|
||||||
}
|
}
|
||||||
if useipv6 {
|
if useipv6 {
|
||||||
settings.IPVersion = peerdiscovery.IPv6
|
settings.IPVersion = peerdiscovery.IPv6
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue