summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/client.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-01-03 00:07:50 +0100
committerWim <wim@42.be>2019-01-03 00:07:50 +0100
commitd2044c647b2e57ec5d5a7684177cf5e2e3325714 (patch)
treec0cd092f4cb2bb528f455e33d7f989e8f3099b7b /vendor/github.com/lrstanley/girc/client.go
parentc585d00f162cc244b381fcaaef7ac5b1efda2cf5 (diff)
downloadmatterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.tar.gz
matterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.tar.bz2
matterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.zip
Update vendor
* go-telegram-bot-api/telegram-bot-api * lrstanley/girc * matterbridge/gomatrix
Diffstat (limited to 'vendor/github.com/lrstanley/girc/client.go')
-rw-r--r--vendor/github.com/lrstanley/girc/client.go45
1 files changed, 44 insertions, 1 deletions
diff --git a/vendor/github.com/lrstanley/girc/client.go b/vendor/github.com/lrstanley/girc/client.go
index 63f47eaa..b8abb642 100644
--- a/vendor/github.com/lrstanley/girc/client.go
+++ b/vendor/github.com/lrstanley/girc/client.go
@@ -81,6 +81,10 @@ type Config struct {
// supported. Capability tracking must be enabled for this to work, as
// this requires IRCv3 CAP handling.
SASL SASLMech
+ // WebIRC allows forwarding source user hostname/ip information to the server
+ // (if supported by the server) to ensure the source machine doesn't show as
+ // the source. See the WebIRC type for more information.
+ WebIRC WebIRC
// Bind is used to bind to a specific host or ip during the dial process
// when connecting to the server. This can be a hostname, however it must
// resolve to an IPv4/IPv6 address bindable on your system. Otherwise,
@@ -154,6 +158,39 @@ type Config struct {
HandleNickCollide func(oldNick string) (newNick string)
}
+// WebIRC is useful when a user connects through an indirect method, such web
+// clients, the indirect client sends its own IP address instead of sending the
+// user's IP address unless WebIRC is implemented by both the client and the
+// server.
+//
+// Client expectations:
+// - Perform any proxy resolution.
+// - Check the reverse DNS and forward DNS match.
+// - Check the IP against suitable access controls (ipaccess, dnsbl, etc).
+//
+// More information:
+// - https://ircv3.net/specs/extensions/webirc.html
+// - https://kiwiirc.com/docs/webirc
+type WebIRC struct {
+ // Password that authenticates the WEBIRC command from this client.
+ Password string
+ // Gateway or client type requesting spoof (cgiirc defaults to cgiirc, as an
+ // example).
+ Gateway string
+ // Hostname of user.
+ Hostname string
+ // Address either in IPv4 dotted quad notation (e.g. 192.0.0.2) or IPv6
+ // notation (e.g. 1234:5678:9abc::def). IPv4-in-IPv6 addresses
+ // (e.g. ::ffff:192.0.0.2) should not be sent.
+ Address string
+}
+
+// Params returns the arguments for the WEBIRC command that can be passed to the
+// server.
+func (w WebIRC) Params() []string {
+ return []string{w.Password, w.Gateway, w.Hostname, w.Address}
+}
+
// ErrInvalidConfig is returned when the configuration passed to the client
// is invalid.
type ErrInvalidConfig struct {
@@ -273,7 +310,7 @@ func (c *Client) TLSConnectionState() (*tls.ConnectionState, error) {
// the connection to the server wasn't made with TLS.
var ErrConnNotTLS = errors.New("underlying connection is not tls")
-// Close closes the network connection to the server, and sends a STOPPED
+// Close closes the network connection to the server, and sends a CLOSED
// event. This should cause Connect() to return with nil. This should be
// safe to call multiple times. See Connect()'s documentation on how
// handlers and goroutines are handled when disconnected from the server.
@@ -436,6 +473,12 @@ func (c *Client) GetNick() string {
return c.state.nick
}
+// GetID returns an RFC1459 compliant version of the current nickname. Panics
+// if tracking is disabled.
+func (c *Client) GetID() string {
+ return ToRFC1459(c.GetNick())
+}
+
// GetIdent returns the current ident of the active connection. Panics if
// tracking is disabled. May be empty, as this is obtained from when we join
// a channel, as there is no other more efficient method to return this info.