better messaging for detports

This commit is contained in:
erinn 2018-10-09 13:34:26 -07:00
parent 6258396dc7
commit ba4ecf3e39
1 changed files with 2 additions and 3 deletions

View File

@ -119,8 +119,7 @@ func (c *Conn) NewOnion(config *NewOnionConfig, dontCheckDescriptor bool) (*Onio
resp, err := c.Request(request) resp, err := c.Request(request)
if err == nil && !dontCheckDescriptor { if err == nil && !dontCheckDescriptor {
pi, _ := c.ProtocolInfo() pi, _ := c.ProtocolInfo()
// 0.3.5.1 torversion := strings.Split(pi.TorVersion, ".") //eg: 0.3.4.8 or 0.3.5.1-alpha
torversion := strings.Split(pi.TorVersion, ".")
tva, _ := strconv.Atoi(torversion[0]) tva, _ := strconv.Atoi(torversion[0])
tvb, _ := strconv.Atoi(torversion[1]) tvb, _ := strconv.Atoi(torversion[1])
tvc, _ := strconv.Atoi(torversion[2]) tvc, _ := strconv.Atoi(torversion[2])
@ -139,13 +138,13 @@ func (c *Conn) NewOnion(config *NewOnionConfig, dontCheckDescriptor bool) (*Onio
if crc > src { if crc > src {
log.Printf("uh oh: your tor process is using a service descriptor revision counter of %d\n", src) log.Printf("uh oh: your tor process is using a service descriptor revision counter of %d\n", src)
log.Printf("whereas the HSDirs have revision %d. this is a bug in tor < 0.3.5.1-alpha\n", crc) log.Printf("whereas the HSDirs have revision %d. this is a bug in tor < 0.3.5.1-alpha\n", crc)
log.Printf("this onion service will not be visible to others until the counters are synced.\n")
log.Printf("your have two options to fix it:\n") log.Printf("your have two options to fix it:\n")
log.Printf("- upgrade to tor >= 0.3.5.1-alpha [recommended]\n") log.Printf("- upgrade to tor >= 0.3.5.1-alpha [recommended]\n")
log.Printf("- run this listener %d more times [not a great idea but it'll work]\n", crc-src) log.Printf("- run this listener %d more times [not a great idea but it'll work]\n", crc-src)
log.Printf("the revision counter is only reset when the tor process restarts, so try not to do that in order to prevent this problem from reoccurring\n") log.Printf("the revision counter is only reset when the tor process restarts, so try not to do that in order to prevent this problem from reoccurring\n")
return nil, errors.New("client descriptor is newer than service descriptor") return nil, errors.New("client descriptor is newer than service descriptor")
} }
fmt.Printf("crc: %v src: %v\n", crc, src)
} }
} else if fmt.Sprintf("%v", err) != "550 Unspecified Tor error: Onion address collision" { } else if fmt.Sprintf("%v", err) != "550 Unspecified Tor error: Onion address collision" {
// (don't worry if there is an address collision -- it's a good thing and means we're using the cached circuits) // (don't worry if there is an address collision -- it's a good thing and means we're using the cached circuits)