mirror of
https://github.com/jesopo/ircrobots
synced 2024-06-18 13:57:06 +00:00
move more sasl-related stuff out to sasl.py
This commit is contained in:
parent
d19e8d1df7
commit
971f49f4c7
|
@ -1,6 +1,24 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from enum import Enum
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
SASL_USERPASS_MECHANISMS = [
|
||||||
|
"SCRAM-SHA-512",
|
||||||
|
"SCRAM-SHA-256",
|
||||||
|
"SCRAM-SHA-1",
|
||||||
|
"PLAIN"
|
||||||
|
]
|
||||||
|
|
||||||
|
class SASLResult(Enum):
|
||||||
|
SUCCESS = 1
|
||||||
|
FAILURE = 2
|
||||||
|
ALREADY = 3
|
||||||
|
|
||||||
|
class SASLError(Exception):
|
||||||
|
pass
|
||||||
|
class SASLUnkownMechanismError(SASLError):
|
||||||
|
pass
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class SASLParams(object):
|
class SASLParams(object):
|
||||||
mechanism: str
|
mechanism: str
|
||||||
|
|
|
@ -13,29 +13,14 @@ from irctokens import build, Line, tokenise
|
||||||
from .ircv3 import Capability, CAPS, CAP_SASL
|
from .ircv3 import Capability, CAPS, CAP_SASL
|
||||||
from .interface import ConnectionParams, IServer, PriorityLine, SendPriority
|
from .interface import ConnectionParams, IServer, PriorityLine, SendPriority
|
||||||
from .matching import BaseResponse, Response, Numerics, ParamAny, Literal
|
from .matching import BaseResponse, Response, Numerics, ParamAny, Literal
|
||||||
|
from .sasl import (SASLResult, SASLUnkownMechanismError,
|
||||||
|
SASL_USERPASS_MECHANISMS)
|
||||||
|
|
||||||
sc = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
|
sc = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
|
||||||
|
|
||||||
THROTTLE_RATE = 4 # lines
|
THROTTLE_RATE = 4 # lines
|
||||||
THROTTLE_TIME = 2 # seconds
|
THROTTLE_TIME = 2 # seconds
|
||||||
|
|
||||||
SASL_USERPASS_MECHANISMS = [
|
|
||||||
"SCRAM-SHA-512",
|
|
||||||
"SCRAM-SHA-256",
|
|
||||||
"SCRAM-SHA-1",
|
|
||||||
"PLAIN"
|
|
||||||
]
|
|
||||||
|
|
||||||
class SASLResult(Enum):
|
|
||||||
SUCCESS = 1
|
|
||||||
FAILURE = 2
|
|
||||||
ALREADY = 3
|
|
||||||
|
|
||||||
class SASLError(Exception):
|
|
||||||
pass
|
|
||||||
class SASLUnkownMechanismError(SASLError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Server(IServer):
|
class Server(IServer):
|
||||||
_reader: asyncio.StreamReader
|
_reader: asyncio.StreamReader
|
||||||
_writer: asyncio.StreamWriter
|
_writer: asyncio.StreamWriter
|
||||||
|
|
Loading…
Reference in New Issue
Block a user