Skip to content

Commit

Permalink
Merge pull request #247 from Arkaeriit/recoverable-tor-list-failure
Browse files Browse the repository at this point in the history
Recover from not being able to read TOR IPs.
  • Loading branch information
Arkaeriit authored Dec 13, 2024
2 parents 9e8ebf4 + 92fb198 commit b4912ea
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,18 @@ func main() {

// read tor list from https://www.dan.me.uk/torlist/?exit
resp, err := http.Get("https://www.dan.me.uk/torlist/?exit")
if err != nil {
Log.Println(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
if err == nil {
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
Log.Println(err)
}
for _, ip := range strings.Split(string(body), "\n") {
TORIPs[ip] = true
}
} else {
Log.Println(err)
}
for _, ip := range strings.Split(string(body), "\n") {
TORIPs[ip] = true
}

ssh.Handle(func(s ssh.Session) {
go keepSessionAlive(s)
Expand Down

0 comments on commit b4912ea

Please sign in to comment.