diff --git a/docs/meshtastic/tunnel.html b/docs/meshtastic/tunnel.html index dd06dbb..8e3bd62 100644 --- a/docs/meshtastic/tunnel.html +++ b/docs/meshtastic/tunnel.html @@ -44,8 +44,7 @@ from . import portnums_pb2 from pubsub import pub from pytap2 import TapDevice -import logging -import threading +import logging, threading # A new non standard log level that is lower level than DEBUG LOG_TRACE = 5 diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 2db0f1c..795cdfe 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1,18 +1,19 @@ #!python3 -import argparse -from . import SerialInterface, TCPInterface, BLEInterface, test, remote_hardware, tunnel -import logging -import sys +import argparse, platform, logging, sys, codecs, base64 +from . import SerialInterface, TCPInterface, BLEInterface, test, remote_hardware from pubsub import pub from . import mesh_pb2, portnums_pb2 import google.protobuf.json_format import pyqrcode import traceback -import codecs -import base64 import pkg_resources +"""We only import the tunnel code if we are on a platform that can run it""" +have_tunnel = platform.system() == 'Linux' +if have_tunnel: + from . import tunnel + """The command line arguments""" args = None @@ -277,7 +278,7 @@ def onConnected(interface): url = pyqrcode.create(interface.channelURL) print(url.terminal()) - if args.tunnel: + if args.tunnel and have_tunnel: closeNow = False # Even if others said we could close, stay open if the user asked for a tunnel tunnel.Tunnel(interface, subnet=args.tunnel_net) @@ -442,11 +443,11 @@ def initParser(): parser.add_argument('--unset-router', dest='router', action='store_false', help="Turns off router mode") - parser.add_argument('--tunnel', + if have_tunnel: + parser.add_argument('--tunnel', action='store_true', help="Create a TUN tunnel device for forwarding IP packets over the mesh") - - parser.add_argument( - "--subnet", dest='tunnel_net', help="Read from a GPIO mask", default=None) + parser.add_argument( + "--subnet", dest='tunnel_net', help="Read from a GPIO mask", default=None) parser.set_defaults(router=None) diff --git a/meshtastic/tunnel.py b/meshtastic/tunnel.py index c6eebca..4a46839 100644 --- a/meshtastic/tunnel.py +++ b/meshtastic/tunnel.py @@ -16,8 +16,7 @@ from . import portnums_pb2 from pubsub import pub from pytap2 import TapDevice -import logging -import threading +import logging, threading # A new non standard log level that is lower level than DEBUG LOG_TRACE = 5 diff --git a/setup.py b/setup.py index 3e40f32..5570988 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ with open("README.md", "r") as fh: # This call to setup() does all the work setup( name="meshtastic", - version="1.1.27", + version="1.1.28", description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown",