update some dialer stuff
This commit is contained in:
parent
89fc9966c2
commit
1d0ec2a110
3 changed files with 13 additions and 1 deletions
12
conn/conn.go
12
conn/conn.go
|
@ -2,6 +2,7 @@ package conn
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
@ -97,7 +98,7 @@ func NewConn(sam *sam3.SAM, addr, path string, opts []string) (*Conn, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.StreamSession, err = sam.NewStreamSession(c.I2PKeys.Addr().Base32()[0:10], c.I2PKeys, opts)
|
||||
c.StreamSession, err = sam.NewStreamSession(c.I2PKeys.Addr().Base32()[0:10]+RandTunName(), c.I2PKeys, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -111,3 +112,12 @@ func NewConn(sam *sam3.SAM, addr, path string, opts []string) (*Conn, error) {
|
|||
}
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
// RandTunName generates a random tunnel names to avoid collisions
|
||||
func RandTunName() string {
|
||||
b := make([]byte, 12)
|
||||
for i := range b {
|
||||
b[i] = "abcdefghijklmnopqrstuvwxyz"[rand.Intn(len("abcdefghijklmnopqrstuvwxyz"))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue