diff --git a/lg-proxy.cfg b/lg-proxy.cfg index 223af9f..8624430 100644 --- a/lg-proxy.cfg +++ b/lg-proxy.cfg @@ -1,2 +1,4 @@ ACCESS_LIST = ["91.224.149.206", "178.33.111.110"] +IPV4_SOURCE="91.224.148.1" +IPV6_SOURCE="2a01:6600:8000::1" diff --git a/lg-proxy.py b/lg-proxy.py index a9225a9..5d4095d 100644 --- a/lg-proxy.py +++ b/lg-proxy.py @@ -39,13 +39,20 @@ def check_accesslist(): def traceroute(): check_accesslist() - if request.path == '/traceroute6': o= "-6" - else: o = "-4" + if request.path == '/traceroute6': + o = "-6" + if app.config.get("IPV6_SOURCE",""): + src = [ "-s", app.config.get("IPV6_SOURCE") ] + + else: + o = "-4" + if app.config.get("IPV4_SOURCE",""): + src = [ "-s", app.config.get("IPV4_SOURCE") ] query = request.args.get("q","") query = unquote(query) - command = [ 'traceroute', o, '-A', '-q1', '-w1', query] + command = [ 'traceroute' , o ] + src + [ '-A', '-q1', '-N32', '-w1', '-m15', query ] result = subprocess.Popen( command , stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore').replace("\n","
") return result