Add password authentication to IRC
This commit is contained in:
parent
aa6c5628e9
commit
73fa488402
2 changed files with 32 additions and 4 deletions
|
@ -32,6 +32,20 @@ func init() {
|
|||
IsBoolean: true,
|
||||
Default: "false",
|
||||
},
|
||||
&ConfigEntry{
|
||||
Name: "server_pass",
|
||||
Description: "Server password (authenticate with PASS command)",
|
||||
IsPassword: true,
|
||||
},
|
||||
&ConfigEntry{
|
||||
Name: "sasl_user",
|
||||
Description: "Username for SASL authentication",
|
||||
},
|
||||
&ConfigEntry{
|
||||
Name: "sasl_pass",
|
||||
Description: "Password for SASL authentication",
|
||||
IsPassword: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -62,11 +62,25 @@ func (irc *IRC) Configure(c Configuration) error {
|
|||
return err
|
||||
}
|
||||
|
||||
server_pass, _ := c.GetString("server_pass", "")
|
||||
sasl_user, _ := c.GetString("sasl_user", "")
|
||||
sasl_pass, _ := c.GetString("sasl_pass", "")
|
||||
|
||||
var sasl girc.SASLMech
|
||||
if sasl_user != "" && sasl_pass != "" {
|
||||
sasl = &girc.SASLPlain{
|
||||
User: sasl_user,
|
||||
Pass: sasl_pass,
|
||||
}
|
||||
}
|
||||
|
||||
client := girc.New(girc.Config{
|
||||
Server: irc.server,
|
||||
Port: port,
|
||||
Nick: irc.nick,
|
||||
User: irc.nick,
|
||||
Server: irc.server,
|
||||
ServerPass: server_pass,
|
||||
Port: port,
|
||||
Nick: irc.nick,
|
||||
User: irc.nick,
|
||||
SASL: sasl,
|
||||
//Out: os.Stderr,
|
||||
SSL: ssl,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue