MQTTunnelNet 1.0.5
See the version list below for details.
dotnet add package MQTTunnelNet --version 1.0.5
NuGet\Install-Package MQTTunnelNet -Version 1.0.5
<PackageReference Include="MQTTunnelNet" Version="1.0.5" />
<PackageVersion Include="MQTTunnelNet" Version="1.0.5" />
<PackageReference Include="MQTTunnelNet" />
paket add MQTTunnelNet --version 1.0.5
#r "nuget: MQTTunnelNet, 1.0.5"
#:package MQTTunnelNet@1.0.5
#addin nuget:?package=MQTTunnelNet&version=1.0.5
#tool nuget:?package=MQTTunnelNet&version=1.0.5
MQTTunnelNet: Tunnel TCP via MQTT broker
This library is a wrapper around libmqttunnel (https://github.com/Staatsgeheim/libmqttunnel)
Changelog
v1.0.5
- Added configuration option to ignore SSL errors
- Fixed OSX x64 library, the build was corrupted in 1.0.4
v1.0.4
- Added Linux ARM64 support
- Added Linux x86 support
v1.0.3
- Changed the native library loading mechanism for cross platform compatibility
- Added MacOS x64 support
- Added MacOS ARM64 support
- Added Linux x64 support
- Added .NET 9 support
The library now supports:
Platforms:
- Windows x86
- Windows x64
- MacOS x64*
- MacOS ARM64*
- Linux x64
MacOS Notes*
Run
xattr -r -d com.apple.quarantine libmqttunnel_x64.dylib
or
xattr -r -d com.apple.quarantine libmqttunnel_arm64.dylib
to enable the libary to load unsigned
Runtimes:
- net45
- net451
- net452
- net46
- net461
- net462
- net463
- net47
- net471
- net472
- net48
- net481
- net5.0
- net6.0
- net7.0
- net8.0
- net9.0
- netstandard2.0
- netstandard2.1
- netcoreapp3.0
- netcoreapp3.1
v1.0.2
- Added 32 bits support
- Added support to load configs from memory instead of disk
- Added MQTTunnelLogLevel to give more control over the log level
enum MQTTunnelLogLevel : int
{
None = -1,
DebugLevel = 0,
InfoLevel = 1,
WarnLevel = 2,
ErrorLevel = 3,
PanicLevel = 4,
FatalLevel = 5
}
- Added support for more .NET versions
net45
net451
net452
net46
net461
net462
net463
net47
net471
net472
net48
net481
net5.0
net6.0
net7.0
net8.0
net9.0
netstandard2.0
netstandard2.1
netcoreapp3.0
netcoreapp3.1
How to use
Remote and local instances use the same Config file.
Create and start a server (remote)
var server = MQTTunnel.CreateServer("config.json");
server.StartAsync();
Create and connect a tunnel (local)
var tunnel = MQTTunnel.CreateTunnel("config.json", 9000, 8000)
tunnel.StartAsync();
Create and connect multiple tunnels (local)
var tunnel1 = MQTTunnel.CreateTunnel("config.json", 9000, 8000)
tunnel1.StartAsync();
var tunnel2 = MQTTunnel.CreateTunnel("config.json", 9001, 8001)
tunnel2.StartAsync();
Using a config in memory
var configJsonData = @"
{
"host": "mqttbroker.example",
"port": 8883,
"ignoreSslErrors": false,
"username", "",
"password", "",
"caCert": "root-CA.crt",
"clientCert": "certificate.pem.crt",
"privateKey": "private.pem.key",
"control": "device/1/control"
}";
Create and start a server using a config in memory (remote)
var server = MQTTunnel.CreateServerMem(configJsonData);
server.StartAsync();
Create and connect a tunnel using a config in memory (local)
var tunnel = MQTTunnel.CreateTunnelMem(configJsonData, 9000, 8000)
tunnel.StartAsync();
Create and connect multiple tunnels using a config in memory (local)
var tunnel1 = MQTTunnel.CreateTunnelMem(configJsonData, 9000, 8000)
tunnel1.StartAsync();
var tunnel2 = MQTTunnel.CreateTunnelMem(configJsonData, 9001, 8001)
tunnel2.StartAsync();
Config file
You can use client certs as well as username/password or both in the Config file.
{
"host": "mqttbroker.example",
"port": 8883,
"ignoreSslErrors": true,
"username", "",
"password", "",
"caCert": "root-CA.crt",
"clientCert": "certificate.pem.crt",
"privateKey": "private.pem.key",
"control": "device/1/control"
}
Other options
clientId
: MQTT ClientID. If empty, random string is generated
Info
control
: Sets the MQTT topic that is used for this instance
Architecture
Example: Local port = 2022, Remote port = 22,
sequenceDiagram
LocalTCP ->> LocalMQTTunnel: conn read from port 2022
LocalMQTTunnel ->> MQTTBroker: Publish to local port topic '/2022'
MQTTBroker ->> RemoteMQTTunnel: Recieve from local port topic '/2022'
RemoteMQTTunnel ->> RemoteTCP: conn write to port 22
RemoteTCP ->> RemoteMQTTunnel: conn read from port 22
RemoteMQTTunnel ->> MQTTBroker: Publish to local port topic '/22'
MQTTBroker ->> LocalMQTTunnel: Recieve from local port topic '/22'
LocalMQTTunnel ->> LocalTCP: conn write to port 2022
More internal architecture
sequenceDiagram
participant Remote
participant RemoteTCP
participant RemoteTCPConnection
participant RemoteMQTTunnel
RemoteMQTTunnel ->> RemoteMQTTunnel: subscribe control topic
LocalMQTTunnel ->> LocalMQTTunnel: make a Tunnel instance which includes local/remote port pair
LocalMQTTunnel ->> LocalTCP: NewTCPConnection()
LocalTCP ->> LocalTCP: start listening
Local ->> LocalTCP: connect
LocalTCP ->> LocalMQTTunnel: OpenTunnel()
LocalMQTTunnel ->> RemoteMQTTunnel: Publish control packet
RemoteMQTTunnel ->> RemoteTCPConnection: NewTCPConnection()
RemoteTCPConnection ->> RemoteTCP: connect()
RemoteTCP ->> Remote: connect()
License
- MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.