better tunnel names

This commit is contained in:
idk 2018-12-26 12:54:27 -05:00
parent 18ce1bbade
commit b7d72fec44
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
2 changed files with 4 additions and 5 deletions

View file

@ -101,7 +101,7 @@ func NewConn(sam sam3.SAM, addr, path string, opts []string) (*Conn, error) {
if err != nil {
return nil, err
}
c.StreamSession, err = c.SAM.NewStreamSession(c.I2PKeys.Addr().Base32()[0:10]+RandTunName(), c.I2PKeys, opts)
c.StreamSession, err = c.SAM.NewStreamSession(c.I2PKeys.Addr().Base32()[0:10]+"-"+RandTunName(), c.I2PKeys, opts)
if err != nil {
return nil, err
}
@ -118,7 +118,7 @@ func NewConn(sam sam3.SAM, addr, path string, opts []string) (*Conn, error) {
// RandTunName generates a random tunnel names to avoid collisions
func RandTunName() string {
b := make([]byte, 12)
b := make([]byte, 4)
for i := range b {
b[i] = "abcdefghijklmnopqrstuvwxyz"[rand.Intn(len("abcdefghijklmnopqrstuvwxyz"))]
}

View file

@ -149,11 +149,10 @@ func main() {
go func() {
for sig := range c {
if sig == os.Interrupt {
if err := tunsocks.Cleanup(); err != nil {
tunsocks.Cleanup()
panic(err)
}
}
}
}()
if err := tunsocks.Serve(); err != nil {
log.Println(err.Error())