[WIP] Fix ban by software version, some other under-hood changes
- Use updated version of upstream go-xmpp + fixes on client-side - Introduce golangci-lint v2 + fixes - Move especially noisy debugging stuff to separate config handles to be able to switch them off - Add a bit debug to ban by software path
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/xml"
|
||||
"os"
|
||||
|
||||
"github.com/eleksir/go-xmpp"
|
||||
"github.com/xmppo/go-xmpp"
|
||||
"gopkg.in/tomb.v2"
|
||||
)
|
||||
|
||||
@@ -14,9 +14,13 @@ type (
|
||||
CSign string `json:"csign,omitempty"`
|
||||
Loglevel string `json:"loglevel,omitempty"`
|
||||
Log string `json:"log,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
ExeName string `json:"exe_name,omitempty"`
|
||||
Jabber struct {
|
||||
Debug struct {
|
||||
Lib bool `json:"lib,omitempty"`
|
||||
Ping bool `json:"ping,omitempty"`
|
||||
} `json:"debug"`
|
||||
Version string `json:"version,omitempty"`
|
||||
ExeName string `json:"exe_name,omitempty"`
|
||||
Jabber struct {
|
||||
Server string `json:"server,omitempty"`
|
||||
Nick string `json:"nick,omitempty"`
|
||||
Resource string `json:"resource,omitempty"`
|
||||
@@ -202,6 +206,46 @@ type (
|
||||
} `xml:"not-acceptable"`
|
||||
}
|
||||
|
||||
// IqErrorCancelServiceNotAvailable обычно возвращается сервером в ответ на iq-запрос к несуществующей сущности.
|
||||
// Если мы такое получаем от клиента, значит мы запросили что-то, что клиент явно не объявил как существущее в
|
||||
// списке своих capability. https://xmpp.org/extensions/xep-0030.html#errors
|
||||
IqErrorCancelServiceNotAvailable struct {
|
||||
XMLName xml.Name `xml:"error"`
|
||||
Text string `xml:",chardata"`
|
||||
Type string `xml:"type,attr"`
|
||||
ServiceUnavailable struct {
|
||||
Text string `xml:",chardata"`
|
||||
Xmlns string `xml:"xmlns,attr"`
|
||||
}
|
||||
}
|
||||
|
||||
/* <iq from='slackware-current@conference.jabber.ru/Batman46(new)' to='buny@jabber.ru/Лунная призма' type='error' id='94e55122-6
|
||||
c15-4e88-a0df-ae9f02e0b550'>
|
||||
<query xmlns='jabber:iq:version'/>
|
||||
<error code='404' type='cancel'>
|
||||
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
|
||||
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Адресата нет в конференции</text>
|
||||
</error>
|
||||
</iq>
|
||||
*/
|
||||
|
||||
// IqErrorCancelItemNotFound не знаю, насколько корректно так отвечать на запрос версии ПО, но такое иногда
|
||||
// встречаетсяю. Придётся поддержать.
|
||||
IqErrorCancelItemNotFound struct {
|
||||
XMLName xml.Name `xml:"error"`
|
||||
Chardata string `xml:",chardata"`
|
||||
Code string `xml:"code,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
ItemNotFound struct {
|
||||
Text string `xml:",chardata"`
|
||||
Xmlns string `xml:"xmlns,attr"`
|
||||
} `xml:"item-not-found"`
|
||||
Text struct {
|
||||
Text string `xml:",chardata"`
|
||||
Xmlns string `xml:"xmlns,attr"`
|
||||
} `xml:"text"`
|
||||
}
|
||||
|
||||
// IqResultSoftwareVersion прототип структурки для разбора IQ ответов на запрос о названии и версии клиентского ПО.
|
||||
IqResultSoftwareVersion struct {
|
||||
XMLName xml.Name `xml:"query"`
|
||||
|
||||
Reference in New Issue
Block a user