Commit 27d07a67 authored by Yury's avatar Yury

fix tests Dispatcher init, typo in readme

parent 591b3660
Pipeline #116 failed with stages
in 8 minutes and 59 seconds
......@@ -13,7 +13,7 @@ python3 ./setup.py install
```
## Usage
Please edit `config.py` file before starting your server.
By default proxying allowed to all hosts (`ALLOWED_DESTINATIONS = [0.0.0.0/0]`). You can specify single IP addresses
By default proxying allowed to all hosts (`ALLOWED_DESTINATIONS = ["0.0.0.0/0"]`). You can specify single IP addresses
(both IPv4 and IPv6) and subnets.
```python3
import saturn
......
......@@ -8,7 +8,6 @@ class Server:
def __init__(self, host: typing.Union[IPv6Address, IPv4Address, str],
port: int,
tcp:bool=True, udp=False, custom_auth=None):
self.host = host
self.port = port
self.tcp = tcp
......
......@@ -6,14 +6,14 @@ class ServerTests(unittest.TestCase):
def test_auth_methods(self):
self.assertRaises(TypeError, saturn.engine.Server)
server = saturn.engine.Server()
# server = saturn.engine.Server()
class SocksTests(unittest.TestCase):
def test_hello_none_auth(self):
server = saturn.engine.Server('127.0.0.1', 1, custom_auth=["saturn.auth.none"])
server.init_auth_methods()
dispatcher = saturn.dispatcher.Dispatcher(server, None, None, None)
dispatcher = saturn.dispatcher.Dispatcher(server, None, None)
hello = saturn.socks.SocksHello(dispatcher, b'\x05\x02\x00\x02').reply()
self.assertEqual(b"\x05\x00", bytes(hello))
hello = saturn.socks.SocksHello(dispatcher, b'\x05\x01\x02').reply()
......@@ -22,7 +22,7 @@ class SocksTests(unittest.TestCase):
def test_hello_only_password(self):
server = saturn.engine.Server('127.0.0.1', 1, custom_auth=["saturn.auth.dict"])
server.init_auth_methods()
dispatcher = saturn.dispatcher.Dispatcher(server, None, None, None)
dispatcher = saturn.dispatcher.Dispatcher(server, None, None)
hello = saturn.socks.SocksHello(dispatcher, b'\x05\x01\x00').reply()
self.assertEqual(bytes(hello), b"\x05\xff")
hello = saturn.socks.SocksHello(dispatcher, b'\x05\x01\x02').reply()
......@@ -31,7 +31,7 @@ class SocksTests(unittest.TestCase):
def test_hello_unknown(self):
server = saturn.engine.Server('127.0.0.1', 1, custom_auth=["saturn.auth.dict"])
server.init_auth_methods()
dispatcher = saturn.dispatcher.Dispatcher(server, None, None, None)
dispatcher = saturn.dispatcher.Dispatcher(server, None, None)
hello = saturn.socks.SocksHello(dispatcher, b'\x05\x01\x05').reply()
self.assertEqual(bytes(hello), b"\x05\xff")
......@@ -43,7 +43,7 @@ class SocksTests(unittest.TestCase):
def test_SocksAuthenticate(self):
server = saturn.engine.Server('127.0.0.1', 1, custom_auth=["saturn.auth.dict"])
server.init_auth_methods()
dispatcher = saturn.dispatcher.Dispatcher(server, None, None, None)
dispatcher = saturn.dispatcher.Dispatcher(server, None, None)
dispatcher.state = saturn.state.WaitingAuthenticationData(2)
login = 'USER_TEST'
password = 'Test_password'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment