Skip to content

Commit

Permalink
Allow multiple concurrently active VPN protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
AiyionPrime committed Mar 21, 2021
1 parent 09366a7 commit 5a9adf8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, name, parser, globals):
self.mcast_link = parser.get(name, 'MulticastLinkAddress', fallback='ff02::2:1001')
self.mcast_site = parser.get(name, 'MulticastSiteAddress', fallback='ff05::2:1001')
self.vpn_pubkey = parser.get(name, 'FastdPublicKey', fallback=None)
self.vpn_proto = parser.get(name, 'VPNProtocol', fallback='fastd')
self.vpn_protos = frozenset(parser.get(name, 'VPNProtocols', fallback='fastd').split(','))
self.ipv4_gateway = parser.get(name, 'IPv4Gateway', fallback=None)
self.domain_code = parser.get(name, 'DomainCode', fallback=name)
self.domain_type = Domain
Expand Down
6 changes: 3 additions & 3 deletions domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def is_gateway(self):
def get_vpn_pubkey(self):
return self.config.vpn_pubkey

def get_vpn_proto(self):
return self.config.vpn_proto
def get_vpn_protos(self):
return self.config.vpn_protos

def get_interfaces(self):
''' Returns list off all interfaces respondd queries are
Expand All @@ -66,7 +66,7 @@ def get_provider_args(self):
'longitude': self.get_longitude(),
'mesh_ipv4': self.get_ipv4_gateway(),
'vpn_pubkey': self.get_vpn_pubkey(),
'vpn_proto': self.get_vpn_proto()
'vpn_protos': self.get_vpn_protos()
}

class BatadvDomain(Domain):
Expand Down
6 changes: 3 additions & 3 deletions providers/nodeinfo/software/fastd/enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


class Source(providers.DataSource):
def call(self, vpn_proto):
if 'fastd' == vpn_proto:
def call(self, vpn_protos):
if 'fastd' in vpn_protos:
try:
return check_process_running('fastd')
except ImportError:
return True

def required_args(self):
return ['vpn_proto']
return ['vpn_protos']
6 changes: 3 additions & 3 deletions providers/nodeinfo/software/fastd/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


class Source(providers.DataSource):
def call(self, vpn_proto):
if 'fastd' == vpn_proto:
def call(self, vpn_protos):
if 'fastd' in vpn_protos:
return call(['fastd', '-v'])[0].split(' ')[1]

def required_args(self):
return ['vpn_proto']
return ['vpn_protos']
10 changes: 6 additions & 4 deletions respondd.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ DomainType: batadv
# Default fastd-public-key to use
# optional, default is None
# FastdPublicKey: 0000000000000000000000000000000000000000000000000000000000000000
# Default vpn protocol to use
# Default vpn protocols to use
# may contain csv if more than one protocol is used
# optional, default is fastd
# supported protocols are: fastd, None
VPNProtocol: fastd
VPNProtocols: fastd
# Default ddhcpd IPv4 gateway address
# optional
IPv4Gateway: 10.116.128.8
Expand Down Expand Up @@ -61,10 +62,11 @@ DomainType: batadv
# Default fastd-public-key to use
# optional, default: @FastdPublickey
# FastdPublicKey: 0000000000000000000000000000000000000000000000000000000000000000
# Default vpn protocol to use
# Default vpn protocols to use
# may contain csv if more than one protocol is used
# optional, default is @VPNProtocol
# supported protocols are: fastd, None
VPNProtocol: fastd
VPNProtocols: fastd
# Link local listen addresses
# optional, default: @Defaults.MulticastLinkAddress
MulticastLinkAddress: ff02::2:1001
Expand Down

0 comments on commit 5a9adf8

Please sign in to comment.