local external="$3"
PROTO_INIT=1
+ PROTO_TUNNEL_OPEN=
PROTO_IPADDR=
PROTO_IP6ADDR=
PROTO_ROUTE=
[ -n "$3" ] && json_add_boolean "address-external" "$external"
}
+proto_add_tunnel() {
+ proto_close_tunnel
+
+ PROTO_TUNNEL_OPEN=1
+ json_add_object "tunnel"
+}
+
+proto_close_tunnel() {
+ [ -n "$PROTO_TUNNEL_OPEN" ] || return
+ json_close_object
+ PROTO_TUNNEL_OPEN=
+}
+
proto_add_dns_server() {
local address="$1"
proto_send_update() {
local interface="$1"
+ proto_close_tunnel
_proto_push_array "ipaddr" "$PROTO_IPADDR" _proto_push_ip
_proto_push_array "ip6addr" "$PROTO_IP6ADDR" _proto_push_ip
_proto_push_array "routes" "$PROTO_ROUTE" _proto_push_route