Skip to content

Commit

Permalink
Simplify proxy host configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Jan 12, 2019
1 parent e464a2c commit 1545694
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lg.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ BIND_IP = "0.0.0.0"
BIND_PORT = 5000

PROXY = {
"gw": 5000,
"h3": 5000,
"gw": "gw.some.network:5000",
"h3": "h3.some.network:5000",
}

# Used for bgpmap
Expand Down
6 changes: 3 additions & 3 deletions lg.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ def bird_proxy(host, proto, service, query):
elif proto == "ipv4":
path = service

port = app.config["PROXY"].get(host, "")
proxyHost = app.config["PROXY"].get(host, "")

if not port:
if not proxyHost:
return False, 'Host "%s" invalid' % host
elif not path:
return False, 'Proto "%s" invalid' % proto
else:
url = "http://%s.%s:%d/%s?q=%s" % (host, app.config["DOMAIN"], port, path, quote(query))
url = "http://%s/%s?q=%s" % (proxyHost, path, quote(query))
try:
f = urlopen(url)
resultat = f.read()
Expand Down

0 comments on commit 1545694

Please sign in to comment.