git: 43163344cc9d - main - net/toxiproxy-{cli,server}: New port: TCP proxy to simulate network and system conditions

From: Jesús Daniel Colmenares Oviedo <dtxdf_at_FreeBSD.org>
Date: Fri, 18 Jul 2025 06:43:06 UTC
The branch main has been updated by dtxdf:

URL: https://cgit.FreeBSD.org/ports/commit/?id=43163344cc9da5f0592a4e3cab45224b9ce2a83f

commit 43163344cc9da5f0592a4e3cab45224b9ce2a83f
Author:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
AuthorDate: 2025-07-18 03:16:31 +0000
Commit:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
CommitDate: 2025-07-18 06:37:47 +0000

    net/toxiproxy-{cli,server}: New port: TCP proxy to simulate network and system conditions
    
    Toxiproxy is a framework for simulating network conditions. It's
    made specifically to work in testing, CI and development environments,
    supporting deterministic tampering with connections, but with support
    for randomized chaos and customization. Toxiproxy is the tool you
    need to prove with tests that your application doesn't have single
    points of failure.
    
    Approved by:    acm (mentor)
---
 net/Makefile                                   |  2 ++
 net/toxiproxy-cli/Makefile                     | 11 +++++++++
 net/toxiproxy-cli/distinfo                     |  5 ++++
 net/toxiproxy-server/Makefile                  | 30 +++++++++++++++++++++++
 net/toxiproxy-server/distinfo                  |  5 ++++
 net/toxiproxy-server/files/toxiproxy-server.in | 34 ++++++++++++++++++++++++++
 net/toxiproxy-server/pkg-descr                 |  6 +++++
 7 files changed, 93 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index 90da17c3020a..084c05fae492 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1609,6 +1609,8 @@
     SUBDIR += tn5250
     SUBDIR += toonel
     SUBDIR += torsocks
+    SUBDIR += toxiproxy-cli
+    SUBDIR += toxiproxy-server
     SUBDIR += traefik
     SUBDIR += traff
     SUBDIR += trafshow
diff --git a/net/toxiproxy-cli/Makefile b/net/toxiproxy-cli/Makefile
new file mode 100644
index 000000000000..d25545da1342
--- /dev/null
+++ b/net/toxiproxy-cli/Makefile
@@ -0,0 +1,11 @@
+PORTNAME=	toxiproxy-cli
+
+COMMENT=	TCP proxy to simulate network and system conditions (client)
+
+GO_TARGET=	./cmd/cli:${PORTNAME}
+
+MASTERDIR=	${.CURDIR}/../toxiproxy-server
+
+DISTINFO_FILE=	${.CURDIR}/distinfo
+
+.include "${MASTERDIR}/Makefile"
diff --git a/net/toxiproxy-cli/distinfo b/net/toxiproxy-cli/distinfo
new file mode 100644
index 000000000000..9447408399e8
--- /dev/null
+++ b/net/toxiproxy-cli/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1752818445
+SHA256 (go/net_toxiproxy-cli/shopify-toxiproxy-v2.12.0_GH0/go.mod) = efe7eee8e60cbef1c8283f1d9becf20e6abf051716e8cd1ed83e88d65d581825
+SIZE (go/net_toxiproxy-cli/shopify-toxiproxy-v2.12.0_GH0/go.mod) = 1079
+SHA256 (go/net_toxiproxy-cli/shopify-toxiproxy-v2.12.0_GH0/shopify-toxiproxy-v2.12.0_GH0.tar.gz) = 9332a884c559fbcf96cbe2c1b46312eb1e1b7191eb9a73a3d3b857d4e9789eb1
+SIZE (go/net_toxiproxy-cli/shopify-toxiproxy-v2.12.0_GH0/shopify-toxiproxy-v2.12.0_GH0.tar.gz) = 73037
diff --git a/net/toxiproxy-server/Makefile b/net/toxiproxy-server/Makefile
new file mode 100644
index 000000000000..bc056daa6cb4
--- /dev/null
+++ b/net/toxiproxy-server/Makefile
@@ -0,0 +1,30 @@
+PORTNAME?=	toxiproxy-server
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.12.0
+CATEGORIES=	net
+
+MAINTAINER=	dtxdf@FreeBSD.org
+COMMENT?=	TCP proxy to simulate network and system conditions (server)
+WWW=		https://github.com/shopify/toxiproxy
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go:modules
+USE_GITHUB=	yes
+GH_ACCOUNT=	shopify
+GH_PROJECT=	toxiproxy
+
+.if ${PORTNAME} == toxiproxy-server
+USE_RC_SUBR=	${PORTNAME}
+.endif
+
+GO_MOD_DIST=	github
+GO_MODULE=	github.com/shopify/toxiproxy
+GO_TARGET?=	./cmd/server:${PORTNAME}
+GO_BUILDFLAGS=	-ldflags "\
+			-X 'github.com/Shopify/toxiproxy/v2.Version=${DISTVERSION}'"
+
+PLIST_FILES=	bin/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/net/toxiproxy-server/distinfo b/net/toxiproxy-server/distinfo
new file mode 100644
index 000000000000..8e3218b983a7
--- /dev/null
+++ b/net/toxiproxy-server/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1752818561
+SHA256 (go/net_toxiproxy-server/shopify-toxiproxy-v2.12.0_GH0/go.mod) = efe7eee8e60cbef1c8283f1d9becf20e6abf051716e8cd1ed83e88d65d581825
+SIZE (go/net_toxiproxy-server/shopify-toxiproxy-v2.12.0_GH0/go.mod) = 1079
+SHA256 (go/net_toxiproxy-server/shopify-toxiproxy-v2.12.0_GH0/shopify-toxiproxy-v2.12.0_GH0.tar.gz) = 9332a884c559fbcf96cbe2c1b46312eb1e1b7191eb9a73a3d3b857d4e9789eb1
+SIZE (go/net_toxiproxy-server/shopify-toxiproxy-v2.12.0_GH0/shopify-toxiproxy-v2.12.0_GH0.tar.gz) = 73037
diff --git a/net/toxiproxy-server/files/toxiproxy-server.in b/net/toxiproxy-server/files/toxiproxy-server.in
new file mode 100644
index 000000000000..f503424c5934
--- /dev/null
+++ b/net/toxiproxy-server/files/toxiproxy-server.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# PROVIDE: toxiproxy_server
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for Toxiproxy in /etc/rc.conf
+#
+# toxiproxy_server_enable (bool):        Enable Toxiproxy.
+# toxiproxy_server_log (str):            Log output.
+# toxiproxy_server_runas (str):          User to run Toxiproxy as.
+# toxiproxy_server_config (str):         Toxiproxy configuration file.
+# toxiproxy_server_args (str):           Arguments used by Toxiproxy.
+#
+
+. /etc/rc.subr
+
+name="toxiproxy_server"
+desc="TCP proxy to simulate network and system conditions"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${toxiproxy_server_enable:="NO"}
+: ${toxiproxy_server_config:="%%PREFIX%%/etc/toxiproxy.json"}
+: ${toxiproxy_server_log:="/var/log/toxiproxy-server.log"}
+: ${toxiproxy_server_runas:="nobody"}
+
+pidfile="/var/run/${name}.pid"
+procname="%%LOCALBASE%%/bin/toxiproxy-server"
+command="/usr/sbin/daemon"
+command_args="-u '${toxiproxy_server_runas}' -p '${pidfile}' -t '${desc}' -o '${toxiproxy_server_log}' '${procname}' -config '${toxiproxy_server_config}' ${toxiproxy_server_args}"
+
+run_rc_command "$1"
diff --git a/net/toxiproxy-server/pkg-descr b/net/toxiproxy-server/pkg-descr
new file mode 100644
index 000000000000..e5aab1ff5358
--- /dev/null
+++ b/net/toxiproxy-server/pkg-descr
@@ -0,0 +1,6 @@
+Toxiproxy is a framework for simulating network conditions. It's
+made specifically to work in testing, CI and development environments,
+supporting deterministic tampering with connections, but with support
+for randomized chaos and customization. Toxiproxy is the tool you
+need to prove with tests that your application doesn't have single
+points of failure.