lrstanley / girc

:bomb: girc is a flexible IRC library for Go :ok_hand:
https://pkg.go.dev/github.com/lrstanley/girc
MIT License
137 stars 13 forks source link

sasl on irc.rizon.net doesn't work #25

Closed 42wim closed 5 years ago

42wim commented 5 years ago

I haven't debugged it any further, but it seems SASL doesn't work on irc.rizon.net I'm getting :irc.rizon.io 904 user :SASL authentication failed

lrstanley commented 5 years ago

I'm unable to replicate from master. Using the following config:

package main

import (
    "log"
    "os"
    "time"

    "github.com/lrstanley/girc"
)

func main() {
    client := girc.New(girc.Config{
        Server: "irc.rizon.net",
        Port:   6667,
        Nick:   "test`",
        User:   "test",
        Name:   "Some Name",
        Debug:  os.Stdout,
        SASL:   &girc.SASLPlain{User: "myuser", Pass: "TRUNCATED"},
    })

    // An example of how you would add reconnect logic.
    for {
        if err := client.Connect(); err != nil {
            log.Printf("error: %s", err)

            log.Println("reconnecting in 30 seconds...")
            time.Sleep(30 * time.Second)
        } else {
            return
        }
    }
}

With a properly registered user with proper auth, I get (stripping out all of the unnecessary debug logs):

conn.go:260: connecting to irc.rizon.net:6667...
handler.go:29: < CLIENT_INIT :irc.rizon.net:6667
conn.go:459: > CAP LS 302
conn.go:459: > NICK test`
conn.go:459: > USER test * * :Some Name
handler.go:29: < :irc.namreeb.org NOTICE * :*** Looking up your hostname...
handler.go:29: < :irc.namreeb.org NOTICE * :*** Checking Ident
handler.go:29: < :irc.namreeb.org NOTICE * :*** Found your hostname
handler.go:29: < :irc.namreeb.org NOTICE * :*** No Ident response
handler.go:29: < :irc.namreeb.org CAP * LS :away-notify chghost invite-notify multi-prefix sasl userhost-in-names
conn.go:459: > CAP REQ :away-notify chghost invite-notify multi-prefix sasl userhost-in-names
handler.go:29: < :irc.namreeb.org CAP test` ACK :away-notify chghost invite-notify multi-prefix sasl userhost-in-names
conn.go:459: > AUTHENTICATE PLAIN
handler.go:29: < AUTHENTICATE +
conn.go:457: > AUTHENTICATE ***redacted***
handler.go:29: < :irc.namreeb.org 900 test` test`!test@cpe-172-73-135-52.truncated.com test` :You are now logged in as test`.
handler.go:29: < :irc.namreeb.org 903 test` :SASL authentication successful
conn.go:459: > CAP END
handler.go:29: < PING :2130503045
conn.go:459: > PONG 2130503045
handler.go:29: < :irc.namreeb.org NOTICE test` :*** Your host is masked (Rizon-F82C16D1.truncated.com)
handler.go:29: < :irc.namreeb.org 001 test` :Welcome to the Rizon Internet Relay Chat Network test`

My guess is it's a problem with whatever rizon server you're hitting or invalid credentials. If you can provide more replication steps, I can troubleshoot further.