add error message that describes how to fix the SAM AUTH issue if you restart the password before removing the USER and setting AUTH DISABLE

This commit is contained in:
idk
2022-04-28 12:35:40 -04:00
parent 40ad754b47
commit 6eca8863f7

View File

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"log"
"github.com/eyedeekay/goSam" "github.com/eyedeekay/goSam"
) )
@ -14,17 +15,30 @@ fails for some reason before you can remove them.
**/ **/
func main() { func main() {
client, err := goSam.NewDefaultClient() client, err := goSam.NewClientFromOptions()
if err != nil { if err != nil {
client, err = goSam.NewClientFromOptions(
goSam.SetUser("user"),
goSam.SetPass("password"),
)
fmt.Println("Looks like you restarted the I2P router before sending AUTH DISABLE.")
fmt.Println("This probably means that your SAM Bridge is in a broken state where it can't")
fmt.Println("accept HELLO or AUTH commands anymore. You should fix this by removing the")
fmt.Println("sam.auth=true entry from sam.config.")
err = client.TeardownAuth()
if err != nil {
fmt.Println(err)
}
fmt.Println(err)
panic(err) panic(err)
} }
err = client.SetupAuth("user", "password") err = client.SetupAuth("user", "password")
if err != nil { if err != nil {
panic(err) log.Println(err)
} }
client2, err := goSam.NewDefaultClient() client2, err := goSam.NewDefaultClient()
if err != nil { if err != nil {
panic(err) log.Println(err)
} }
conn, err := client2.Dial("", "idk.i2p") conn, err := client2.Dial("", "idk.i2p")
if err != nil { if err != nil {