3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00
Commit Graph

457 Commits

Author SHA1 Message Date
James Lu
242267a4a2 classes: revise some function descriptions 2019-06-16 10:31:23 -07:00
James Lu
011d70e816 classes: make nick_to_uid more versatile against duplicate nicks
This adds a couple of new options:
- multi: return all matches for nick instead of just the last result. (Return an empty list if no matches)
- filterfunc: if specified, filter matched users by the given function first."""
2019-06-16 10:30:46 -07:00
James Lu
2c028e2762 classes: remove channels, modes from User.get_fields()
These don't really make sense to be formatted as a string.
2019-03-28 20:14:04 -07:00
James Lu
190e51211f log: use pylinkirc as logger name 2019-02-20 13:22:26 -08:00
James Lu
4f17a7986b PyLinkNC: don't overwrite sid, serverdata if they're already set 2019-02-20 13:22:26 -08:00
James Lu
55360dd0b2 classes: allow Server name to be a non-string type 2019-02-16 16:32:42 -08:00
James Lu
cfbadb4539 Move _squit, _get_SID, _get_UID wrappers into PyLinkNCWUtils
ClientbotBaseProtocol requires these for the squit wrapper to work.
2019-02-12 00:38:37 -08:00
James Lu
a9b8bfe94d classes: allow _expandPUID() to work when UIDs are ints 2019-02-10 13:01:11 -08:00
James Lu
5731a301ce classes: fix incorrect wrap_messages() stub 2019-02-10 13:00:53 -08:00
James Lu
6e7c58ee36 PyLinkNCWithUtils: don't assume mode args are strings 2019-02-07 14:55:27 -08:00
James Lu
61c8677802 classes, relay_clientbot: more type safety for protocols/discord 2019-02-07 13:50:32 -08:00
James Lu
94a345423e classes: allow callers to override the make_channel_ban() ban style 2018-10-20 12:34:11 -07:00
James Lu
eb231a2aad classes: always raise an error if make_channel_ban creates something invalid 2018-10-20 12:33:42 -07:00
James Lu
6ceaabe092 classes: use get_fields() in make_channel_ban() for more reliable substitutions 2018-10-20 12:30:09 -07:00
James Lu
5c4fba653f IRCNetwork: disable throttling by default
On large networks, this seems to slows down relay bursts to the point they're no longer usable.
2018-10-10 22:49:10 -07:00
James Lu
12d1412cba PyLinkNCWUtils: stop logging the entirety of prefixmodes
This creates a lot of spam on larger channels.
2018-10-10 22:49:04 -07:00
James Lu
60b7894cd6 IRCNetwork: try to abort immediately if the send queue is full 2018-10-08 16:26:29 -07:00
James Lu
8a096e537c PyLinkNCWUtils: add "ignore_ts_errors" server option to suppress bogus TS warnings 2018-08-23 02:52:54 -04:00
James Lu
49badd1665 updateTS: silently ignore messages with ts = 0
Closes #625.
2018-08-19 19:41:29 -04:00
James Lu
5e1cb232b0 IRCNetwork: also detect address types from supplied bindhosts 2018-06-15 18:43:00 -07:00
James Lu
26361c4cc9 IRCNetwork: warn when using plaintext links to non-local addresses 2018-06-15 18:30:21 -07:00
James Lu
e5f817fc95 IRCNetwork: suppress "You can enhance...security...[with] ssl_fingerprint" notices when TLS cert validation is enabled 2018-06-15 15:57:45 -07:00
James Lu
ab9df93898 IRCNetwork: more consistent log format when remote certfp is verified 2018-06-15 15:52:04 -07:00
James Lu
b26d75a6a8 IRCNetwork: handle the case when certificate fingerprint checking is on but the remote provides no cert 2018-06-15 15:50:32 -07:00
James Lu
fefd5a1f6b IRCNetwork: raise ssl.CertificateError instead of an in house exception if certfp is mismatched
Also, fix the expected and real fingerprints being logged in the wrong order.
2018-06-15 15:48:09 -07:00
James Lu
76c0db15c4 core: merge TLS validation code into IRCNetwork (#592)
Certificate verification is now enabled for all Clientbot networks, but not yet for S2S links (self-signed certs are common here and direct IP links even more so)
2018-06-15 15:29:15 -07:00
James Lu
4524aebbac clientbot: initial pass of TLS cert validation (#592)
This works OK, but we should make the validation options built-in instead of clientbot-specific.
2018-06-15 02:47:12 -07:00
James Lu
d3125d9a8f core: automatically detect between IPv4 / IPv6 addresses on connect
Closes #212.
2018-06-15 02:43:33 -07:00
James Lu
56c035a1f5 IRCNetwork: fix broken ping timeout handling
Check for ping outs in the ping scheduler instead of the listener... If the connection is dead, the listener won't ever be called.
2018-06-14 01:18:33 -07:00
James Lu
b2421f5e15 IRCNetwork: simplify connection error handling 2018-06-14 01:18:33 -07:00
James Lu
579b5ce93f IRCNetwork: split SSL connection setup into separate functions
* _make_ssl_context(): returns the SSLContext to use on he network (with options set)
* _setup_ssl(): sets up TLS by loading certfile / keyfile and calling wrap_socket()
* _verify_ssl(): implements certificate fingerprint verification, raising TLSVerificationError (a new subclass of ConnectionError) if this fails

This is a prerequisite for #592.
2018-06-14 01:17:39 -07:00
James Lu
deff6d077d match_host: remove deprecation notice for non-host globs
This is too flaky with commands taking arbitrary user inputs (e.g. opercmds/checkban)
2018-06-12 00:02:18 -07:00
James Lu
2ca9de2ea8 PyLinkNCWUtils: make the allowAuthed, allowOper options to is_oper no-ops 2018-06-11 23:55:19 -07:00
James Lu
18f108c328 PyLinkNCWUtils: remove check_authenticated() (#422) 2018-06-11 23:54:48 -07:00
James Lu
ed5d46e28a utils: remove deprecated is* functions 2018-06-11 23:48:12 -07:00
James Lu
3bea214cb0 classes: remove irc.botdata (#422) 2018-06-11 23:43:57 -07:00
James Lu
f9d21c2b10 UserMapping: fix wrong args to __copy__ 2018-06-09 10:44:36 -07:00
James Lu
31a0d36990 clientbot: ignore missing args in 324 / RPL_CHANNELMODEIS
Fixes #537.
2018-06-08 18:45:20 -07:00
James Lu
f4de604b7d classes: split match_host() into match_host() and match_text() 2018-06-08 18:25:23 -07:00
James Lu
b0188dab92 get_friendly_name: strip STATUSMSG prefixes before checking is_channel 2018-06-08 17:26:25 -07:00
James Lu
6f3813d3a4 UserMapping: add in missing reference to the parent irc instance 2018-06-08 15:54:06 -07:00
James Lu
e3a935d0b7 classes: make User, Channel TS a property for type-safety (#594) 2018-05-26 02:30:25 -07:00
James Lu
f20fa5e995 Add User.get_fields(), and rework plugins to fix $nick broken expansions
User.nick is no longer a writable attribute since a085aed924, so it won't show up in __dict__ now.

get_fields() replaces the User.__dict__ hack various plugins used and also provides some new expansion variables:
- $sid and $server expand to the server ID and name respectively
- $modes and $channels are now preformatted strings
- $netname expands to the network name

$manipulatable and $_irc were removed since their values aren't quite meaningful as strings
2018-05-26 02:12:38 -07:00
James Lu
b72420a8aa Revert "NetworkCore: return the server in get_server if the arg was a server"
The complete implementation of is_privileged_service() in ec3a94c4ca explicitly checks the entity ID type, so this strange hack is not needed.

This reverts commit 9113b34b46.
2018-05-26 01:14:32 -07:00
James Lu
ec3a94c4ca Move U:line checking into core as PyLinkNCWUtils.is_privileged_server()
Closes #604.
2018-05-26 00:14:04 -07:00
James Lu
a66a9b6336 core: demote KeyError logging in _remove_client to DEBUG
This is needed for #607.
2018-05-21 00:28:16 -07:00
James Lu
20bbf531e6 wrap_message: fall back to bufsize=510 on protocols declaring S2S_BUFSIZE to be 0 (unlimited) 2018-05-18 19:09:06 -07:00
James Lu
559b262db8 core: break attempts to read from a socket if no data is available 2018-05-18 19:08:37 -07:00
James Lu
f87e646f35 core: use the most recent UID if we have an unresolved nick collision / desync
This is the one most likely to be correct, assuming IRCds deals with nick collisions properly on their own.
2018-05-18 18:17:04 -07:00
James Lu
73322bd9ba wrap_message: expand UID targets into nicks before processing (#153) 2018-05-11 14:47:27 -07:00