mirror of
https://github.com/NohamR/trio_http_proxy.git
synced 2025-05-24 00:59:27 +00:00
allowed ips load
This commit is contained in:
parent
21ed85c304
commit
a258f92208
1
.allowed.example
Normal file
1
.allowed.example
Normal file
@ -0,0 +1 @@
|
||||
{"ALLOWED_IPS": ["127.0.0.1"]}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.venv
|
||||
.allowed
|
||||
|
@ -15,12 +15,15 @@ from textwrap import indent
|
||||
from traceback import format_exc
|
||||
import h11
|
||||
import trio
|
||||
import json
|
||||
|
||||
DEFAULT_PORT = 8080
|
||||
PORT = int(getenv('PORT', DEFAULT_PORT))
|
||||
|
||||
# List of allowed IP addresses
|
||||
ALLOWED_IPS = ['127.0.0.1', '82.66.241.83', '136.243.50.102', '178.254.72.180'] + [f'192.168.1.{i}' for i in range(1, 254)]
|
||||
with open('.allowed') as f:
|
||||
ALLOWED_IPS = json.load(f)['ALLOWED_IPS']
|
||||
ALLOWED_IPS = ALLOWED_IPS + [f'192.168.1.{i}' for i in range(1, 254)]
|
||||
|
||||
prn = partial(print, end='')
|
||||
indented = partial(indent, prefix=' ')
|
||||
|
Loading…
x
Reference in New Issue
Block a user