feat(irc): support optional SASL and NickServ auth (#511)

* feat(irc): support SASL and NickServ auth

* feat(irc): add missing fields

* feat(irc): support SASL and NickServ auth

* feat(irc): add missing fields

* feat(irc): add validation

* feat(indexers): unify and set required values

* feat(irc): add postgres migrations

* feat(irc): use nick as handlerkey

* feat(irc): use account for nickserv

* fix(irc): pg db migration
This commit is contained in:
ze0s 2022-10-27 22:25:58 +02:00 committed by GitHub
parent 4ef0408f33
commit 4bf023d030
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 1404 additions and 631 deletions

View file

@ -14,9 +14,18 @@ type IrcChannel struct {
Monitoring bool `json:"monitoring"`
}
type NickServ struct {
Account string `json:"account,omitempty"`
Password string `json:"password,omitempty"`
type IRCAuthMechanism string
const (
IRCAuthMechanismNone IRCAuthMechanism = "NONE"
IRCAuthMechanismSASLPlain IRCAuthMechanism = "SASL_PLAIN"
IRCAuthMechanismNickServ IRCAuthMechanism = "NICKSERV"
)
type IRCAuth struct {
Mechanism IRCAuthMechanism `json:"mechanism,omitempty"`
Account string `json:"account,omitempty"`
Password string `json:"password,omitempty"`
}
type IrcNetwork struct {
@ -27,8 +36,9 @@ type IrcNetwork struct {
Port int `json:"port"`
TLS bool `json:"tls"`
Pass string `json:"pass"`
Nick string `json:"nick"`
Auth IRCAuth `json:"auth,omitempty"`
InviteCommand string `json:"invite_command"`
NickServ NickServ `json:"nickserv,omitempty"`
Channels []IrcChannel `json:"channels"`
Connected bool `json:"connected"`
ConnectedSince *time.Time `json:"connected_since"`
@ -42,8 +52,9 @@ type IrcNetworkWithHealth struct {
Port int `json:"port"`
TLS bool `json:"tls"`
Pass string `json:"pass"`
Nick string `json:"nick"`
Auth IRCAuth `json:"auth,omitempty"`
InviteCommand string `json:"invite_command"`
NickServ NickServ `json:"nickserv,omitempty"`
CurrentNick string `json:"current_nick"`
PreferredNick string `json:"preferred_nick"`
Channels []ChannelWithHealth `json:"channels"`