Add Transparent Proxy and PROXY v2 support and help page
This commit is contained in:
@@ -13,6 +13,11 @@ NODE_TYPES = {"client_source", "client_sink", "public_sink", "splitter", "tunnel
|
||||
SOURCES = {"client_source", "tunnel_source"}
|
||||
HAS_OUTPUT = SOURCES | {"splitter"}
|
||||
HAS_INPUT = {"client_sink", "public_sink", "splitter", "tunnel_sink"}
|
||||
SINKS = HAS_INPUT - {"splitter"}
|
||||
# How a sink passes the peer address to the service. Whether "transparent"
|
||||
# has a source on a client is checked by the daemon (route error), so editing
|
||||
# the wiring never makes a save fail.
|
||||
ORIGINS = {"", "proxy_v2", "transparent"}
|
||||
IFACE_RE = re.compile(r"^[A-Za-z0-9_.\-]{1,15}$")
|
||||
HOST_RE = re.compile(r"^[A-Za-z0-9.:_\-\[\]%]{0,255}$")
|
||||
NAME_RE = re.compile(r"^[A-Za-z0-9._\-]{1,64}$")
|
||||
@@ -106,9 +111,14 @@ def graph(data, client_ids):
|
||||
if proto not in ("tcp", "udp"):
|
||||
raise Invalid("protocol must be tcp or udp")
|
||||
label = str(n.get("label") or "")[:64]
|
||||
origin = n.get("origin") or ""
|
||||
if origin not in ORIGINS:
|
||||
raise Invalid("origin must be proxy_v2 or transparent")
|
||||
if t not in SINKS:
|
||||
origin = ""
|
||||
nodes.append({
|
||||
"id": nid, "type": t, "client_id": cid, "host": host, "port": _port(n.get("port")),
|
||||
"proto": proto, "label": label, "iface": iface,
|
||||
"proto": proto, "label": label, "iface": iface, "origin": origin,
|
||||
"x": float(n.get("x", 0)), "y": float(n.get("y", 0)),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user