Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement an option to specify VPNProtocols #70

Merged
merged 2 commits into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +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_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
7 changes: 6 additions & 1 deletion domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ def get_longitude(self):

def is_gateway(self):
return self.config.is_gateway

def get_vpn_pubkey(self):
return self.config.vpn_pubkey

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

def get_interfaces(self):
''' Returns list off all interfaces respondd queries are
expected to arrive on
Expand All @@ -61,7 +65,8 @@ def get_provider_args(self):
'latitude': self.get_latitude(),
'longitude': self.get_longitude(),
'mesh_ipv4': self.get_ipv4_gateway(),
'vpn_pubkey': self.get_vpn_pubkey()
'vpn_pubkey': self.get_vpn_pubkey(),
'vpn_protos': self.get_vpn_protos()
}

class BatadvDomain(Domain):
Expand Down
15 changes: 10 additions & 5 deletions providers/nodeinfo/software/fastd/enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
from util import check_process_running



class Source(providers.DataSource):
def call(self):
try:
return check_process_running('fastd')
except ImportError:
return True
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_protos']
7 changes: 4 additions & 3 deletions providers/nodeinfo/software/fastd/public_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@


class Source(providers.DataSource):
def call(self, vpn_pubkey):
return vpn_pubkey
def call(self, vpn_protos, vpn_pubkey):
if 'fastd' in vpn_protos:
return vpn_pubkey

def required_args(self):
return ['vpn_pubkey']
return ['vpn_protos', 'vpn_pubkey']
9 changes: 7 additions & 2 deletions providers/nodeinfo/software/fastd/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import providers
from providers.util import call


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

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