1.1.33 Improve channel/device settings support

Allow setting to arbitrary byte arrays by preceding the string with 0x
for things like

meshtastic --setchan psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --info
This commit is contained in:
Kevin Hester
2021-01-29 09:51:56 +08:00
parent 01d1a5ab48
commit 9c1232be79
5 changed files with 60 additions and 30 deletions

View File

@@ -115,12 +115,12 @@ class Tunnel:
ip = self._nodeNumToIp(node["num"])
logging.info(f"Node { nodeId } has IP address { ip }")
logging.debug("creating TUN device")
logging.debug("creating TUN device with MTU=200")
# FIXME - figure out real max MTU, it should be 240 - the overhead bytes for SubPacket and Data
from pytap2 import TapDevice
self.tun = TapDevice(name="mesh", mtu=200)
self.tun = TapDevice(name="mesh")
self.tun.up()
self.tun.ifconfig(address=myAddr,netmask=netmask)
self.tun.ifconfig(address=myAddr,netmask=netmask,mtu=200)
logging.debug(f"starting TUN reader, our IP address is {myAddr}")
self._rxThread = threading.Thread(target=self.__tunReader, args=(), daemon=True)
self._rxThread.start()
@@ -346,12 +346,12 @@ subnet is used to construct our network number (normally 10.115.x.x)</p></div>
ip = self._nodeNumToIp(node[&#34;num&#34;])
logging.info(f&#34;Node { nodeId } has IP address { ip }&#34;)
logging.debug(&#34;creating TUN device&#34;)
logging.debug(&#34;creating TUN device with MTU=200&#34;)
# FIXME - figure out real max MTU, it should be 240 - the overhead bytes for SubPacket and Data
from pytap2 import TapDevice
self.tun = TapDevice(name=&#34;mesh&#34;, mtu=200)
self.tun = TapDevice(name=&#34;mesh&#34;)
self.tun.up()
self.tun.ifconfig(address=myAddr,netmask=netmask)
self.tun.ifconfig(address=myAddr,netmask=netmask,mtu=200)
logging.debug(f&#34;starting TUN reader, our IP address is {myAddr}&#34;)
self._rxThread = threading.Thread(target=self.__tunReader, args=(), daemon=True)
self._rxThread.start()