mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-22 06:54:43 +01:00
Force ip source in traceroute
This commit is contained in:
parent
d29ccc9290
commit
713af83340
|
@ -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"
|
||||
|
|
13
lg-proxy.py
13
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","<br>")
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue