mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
bug fix for allowing full input of servername
This commit is contained in:
parent
67526279ce
commit
00dfe62033
1 changed files with 6 additions and 3 deletions
|
@ -167,8 +167,10 @@ func (c *Connection) Run() error {
|
||||||
|
|
||||||
if c.Local {
|
if c.Local {
|
||||||
c.DontEncrypt = true
|
c.DontEncrypt = true
|
||||||
c.Code = peerdiscovery.RandStringBytesMaskImprSrc(4)
|
|
||||||
c.Yes = true
|
c.Yes = true
|
||||||
|
if c.Code == "" {
|
||||||
|
c.Code = peerdiscovery.RandStringBytesMaskImprSrc(4)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Local && c.Server == "" {
|
if c.Local && c.Server == "" {
|
||||||
|
@ -180,9 +182,7 @@ func (c *Connection) Run() error {
|
||||||
Payload: []byte(c.Code),
|
Payload: []byte(c.Code),
|
||||||
})
|
})
|
||||||
if c.IsSender {
|
if c.IsSender {
|
||||||
c.Server = "localhost"
|
|
||||||
go p.Discover()
|
go p.Discover()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Print("finding local croc relay...")
|
fmt.Print("finding local croc relay...")
|
||||||
discovered, err := p.Discover()
|
discovered, err := p.Discover()
|
||||||
|
@ -199,6 +199,7 @@ func (c *Connection) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Local && c.IsSender {
|
if c.Local && c.IsSender {
|
||||||
|
log.Debug("starting relay")
|
||||||
relay := NewRelay(&AppConfig{
|
relay := NewRelay(&AppConfig{
|
||||||
Debug: c.Debug,
|
Debug: c.Debug,
|
||||||
})
|
})
|
||||||
|
@ -273,6 +274,8 @@ func (c *Connection) Run() error {
|
||||||
}
|
}
|
||||||
if c.Local {
|
if c.Local {
|
||||||
fmt.Fprintf(os.Stderr, "Receive with: croc --local\n")
|
fmt.Fprintf(os.Stderr, "Receive with: croc --local\n")
|
||||||
|
fmt.Fprintf(os.Stderr, "or croc --local --server %s --code %s\n", GetLocalIP(), c.Code)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(os.Stderr, "Code is: %s\n", c.Code)
|
fmt.Fprintf(os.Stderr, "Code is: %s\n", c.Code)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue