commit 36619aaabb9e071b560d93681543afbdf06938da
parent a99a3242db4a1262d1d5318d35312edd3319145f
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Thu, 24 Nov 2022 18:40:29 +0300
Add janus-mqtt-proxy
Diffstat:
3 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -346,6 +346,7 @@ lib.makeScope newScope (
### MQTT
influxdb-cxx = callPackage ./mqtt/influxdb-cxx { };
+ janus-mqtt-proxy = callPackage ./mqtt/janus-mqtt-proxy { };
mqtt-benchmark = callPackage ./mqtt/mqtt-benchmark { };
mqtt-to-influxdb = callPackage ./mqtt/mqtt-to-influxdb { };
mqtt-to-influxdb-forwarder = callPackage ./mqtt/mqtt-to-influxdb-forwarder { };
diff --git a/pkgs/mqtt/janus-mqtt-proxy/default.nix b/pkgs/mqtt/janus-mqtt-proxy/default.nix
@@ -0,0 +1,29 @@
+{ lib, fetchFromGitHub, buildGoPackage }:
+
+buildGoPackage rec {
+ pname = "janus-mqtt-proxy";
+ version = "2022-02-19";
+
+ src = fetchFromGitHub {
+ owner = "phoenix-mstu";
+ repo = "janus-mqtt-proxy";
+ rev = "bfdebffb6e277db00adf14d9a11f792cf418358a";
+ hash = "sha256-RjhIV5GDHqtGz54Zfaph5JleBaAIDwIWGiknl1KNW+8=";
+ };
+
+ subPackages = [ "cmd/proxy" ];
+ goPackagePath = "github.com/phoenix-mstu/janus-mqtt-proxy";
+
+ goDeps = ./deps.nix;
+
+ postInstall = ''
+ install -Dm644 $src/sample_configs/*.yaml -t $out/share/janus-mqtt-proxy/sample_configs
+ '';
+
+ meta = with lib; {
+ description = "MITM proxy which can filter and modify MQTT packets";
+ inherit (src.meta) homepage;
+ license = licenses.gpl3;
+ maintainers = [ maintainers.sikmir ];
+ };
+}
diff --git a/pkgs/mqtt/janus-mqtt-proxy/deps.nix b/pkgs/mqtt/janus-mqtt-proxy/deps.nix
@@ -0,0 +1,47 @@
+[
+ {
+ goPackagePath = "github.com/eclipse/paho.mqtt.golang";
+ fetch = {
+ type = "git";
+ url = "https://github.com/eclipse/paho.mqtt.golang";
+ rev = "v1.4.2";
+ sha256 = "sha256-qCBZbcvGqD9tA3Po3Nd9wqATJ9fBgAPZ0s4y/jFYzeA=";
+ };
+ }
+ {
+ goPackagePath = "github.com/gorilla/websocket";
+ fetch = {
+ type = "git";
+ url = "https://github.com/gorilla/websocket";
+ rev = "v1.5.0";
+ sha256 = "sha256-EYVgkSEMo4HaVrsWKqnsYRp8SSS8gNf7t+Elva02Ofc=";
+ };
+ }
+ {
+ goPackagePath = "golang.org/x/net";
+ fetch = {
+ type = "git";
+ url = "https://go.googlesource.com/net";
+ rev = "v0.2.0";
+ sha256 = "sha256-0MqnHDdLkkau6k7hlWD9MzIoAFROvxulyT+KzZkSXOs=";
+ };
+ }
+ {
+ goPackagePath = "golang.org/x/sync";
+ fetch = {
+ type = "git";
+ url = "https://go.googlesource.com/sync";
+ rev = "v0.1.0";
+ sha256 = "sha256-Hygjq9euZ0qz6TvHYQwOZEjNiTbTh1nSLRAWZ6KFGR8=";
+ };
+ }
+ {
+ goPackagePath = "gopkg.in/yaml.v3";
+ fetch = {
+ type = "git";
+ url = "https://github.com/go-yaml/yaml";
+ rev = "v3.0.1";
+ sha256 = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=";
+ };
+ }
+]