Debian Codegraph @

dist/freebsd/kcptun-v20251219.patch

raw
1 diff --git a/net/kcptun/Makefile b/net/kcptun/Makefile
2 new file mode 100644
3 index 000000000000..702ffccc17da
4 --- /dev/null
5 +++ b/net/kcptun/Makefile
6 @@ -0,0 +1,47 @@
7 +PORTNAME= kcptun
8 +DISTVERSIONPREFIX= v
9 +DISTVERSION= 20251219
10 +CATEGORIES= net
11 +
12 +MAINTAINER= [email protected]
13 +COMMENT= Quantum-safe UDP tunnel using QPP, KCP, FEC and multiplexing
14 +WWW= https://github.com/xtaci/kcptun
15 +
16 +LICENSE= MIT
17 +LICENSE_FILE= ${WRKSRC}/LICENSE.md
18 +
19 +USES= go:1.24,modules
20 +
21 +USE_GITHUB= yes
22 +GH_ACCOUNT= xtaci
23 +
24 +GO_BUILDFLAGS= -ldflags "-s -w -X main.VERSION=${DISTVERSION}"
25 +
26 +GO_TARGET= ./client:kcptun-client \
27 + ./server:kcptun-server
28 +
29 +USE_RC_SUBR= kcptun_client kcptun_server
30 +
31 +PLIST_FILES= \
32 + bin/kcptun-client \
33 + bin/kcptun-server \
34 + etc/kcptun/client.json.sample \
35 + etc/kcptun/server.json.sample
36 +
37 +PORTDOCS= README.md
38 +
39 +OPTIONS_DEFINE= DOCS
40 +
41 +post-install:
42 + ${MKDIR} ${STAGEDIR}${PREFIX}/etc/kcptun
43 + ${INSTALL_DATA} ${FILESDIR}/kcptun-client.json.sample \
44 + ${STAGEDIR}${PREFIX}/etc/kcptun/client.json.sample
45 + ${INSTALL_DATA} ${FILESDIR}/kcptun-server.json.sample \
46 + ${STAGEDIR}${PREFIX}/etc/kcptun/server.json.sample
47 +
48 +post-install-DOCS-on:
49 + ${MKDIR} ${STAGEDIR}${DOCSDIR}
50 + ${INSTALL_DATA} ${WRKSRC}/README.md \
51 + ${STAGEDIR}${DOCSDIR}/README.md
52 +
53 +.include <bsd.port.mk>
54 diff --git a/net/kcptun/distinfo b/net/kcptun/distinfo
55 new file mode 100644
56 index 000000000000..26def9db9d8e
57 --- /dev/null
58 +++ b/net/kcptun/distinfo
59 @@ -0,0 +1,3 @@
60 +TIMESTAMP = 1766122599
61 +SHA256 (xtaci-kcptun-v20251219_GH0.tar.gz) = 766fda88f4dd3491a8175117f8db13347b2182178d463a21b8d19e381f3ad515
62 +SIZE (xtaci-kcptun-v20251219_GH0.tar.gz) = 2747395
63 diff --git a/net/kcptun/files/kcptun-client.json.sample b/net/kcptun/files/kcptun-client.json.sample
64 new file mode 100644
65 index 000000000000..383a44bceb47
66 --- /dev/null
67 +++ b/net/kcptun/files/kcptun-client.json.sample
68 @@ -0,0 +1,30 @@
69 +{
70 + "localaddr": ":2000",
71 + "remoteaddr": "127.0.0.1:29900",
72 + "key": "PASSWORD",
73 + "crypt": "aes-128",
74 + "qpp":true,
75 + "qpp-count":61,
76 + "mode": "fast3",
77 + "mtu": 1400,
78 + "ratelimit": 1048576,
79 + "sndwnd": 128,
80 + "rcvwnd": 1024,
81 + "datashard": 10,
82 + "parityshard": 3,
83 + "dscp": 46,
84 + "nocomp": true,
85 + "acknodelay": false,
86 + "nodelay": 1,
87 + "interval": 40,
88 + "resend": 2,
89 + "nc": 1,
90 + "sockbuf": 16777217,
91 + "smuxver": 2,
92 + "smuxbuf": 16777217,
93 + "streambuf": 2097152,
94 + "keepalive": 10,
95 + "autoexpire": 300,
96 + "quiet": false,
97 + "tcp": false
98 +}
99 diff --git a/net/kcptun/files/kcptun-server.json.sample b/net/kcptun/files/kcptun-server.json.sample
100 new file mode 100644
101 index 000000000000..b18eea471148
102 --- /dev/null
103 +++ b/net/kcptun/files/kcptun-server.json.sample
104 @@ -0,0 +1,30 @@
105 +{
106 + "listen": ":29900",
107 + "target": "127.0.0.1:9999",
108 + "key": "PASSWORD",
109 + "crypt": "aes-128",
110 + "qpp":true,
111 + "qpp-count":61,
112 + "mode": "fast3",
113 + "mtu": 1400,
114 + "ratelimit": 104857600,
115 + "sndwnd": 2048,
116 + "rcvwnd": 2048,
117 + "datashard": 10,
118 + "parityshard": 3,
119 + "dscp": 46,
120 + "nocomp": true,
121 + "acknodelay": false,
122 + "nodelay": 1,
123 + "interval": 40,
124 + "resend": 2,
125 + "nc": 1,
126 + "sockbuf": 16777217,
127 + "smuxver": 2,
128 + "smuxbuf": 16777217,
129 + "streambuf": 2097152,
130 + "keepalive": 10,
131 + "pprof":false,
132 + "quiet":false,
133 + "tcp":false
134 +}
135 diff --git a/net/kcptun/files/kcptun_client.in b/net/kcptun/files/kcptun_client.in
136 new file mode 100644
137 index 000000000000..8bfe85891c15
138 --- /dev/null
139 +++ b/net/kcptun/files/kcptun_client.in
140 @@ -0,0 +1,22 @@
141 +#!/bin/sh
142 +#
143 +# PROVIDE: kcptun_client
144 +# REQUIRE: NETWORKING
145 +
146 +. /etc/rc.subr
147 +
148 +name="kcptun_client"
149 +desc="kcptun client service"
150 +rcvar="${name}_enable"
151 +
152 +load_rc_config $name
153 +
154 +: ${kcptun_client_enable:="NO"}
155 +: ${kcptun_client_config:="/usr/local/etc/kcptun/client.json"}
156 +: ${kcptun_client_bin:="/usr/local/bin/kcptun-client"}
157 +
158 +pidfile="/var/run/${name}.pid"
159 +command="/usr/sbin/daemon"
160 +command_args="-u nobody -c -f -S -P ${pidfile} -r ${kcptun_client_bin} -c ${kcptun_client_config}"
161 +
162 +run_rc_command "$1"
163 diff --git a/net/kcptun/files/kcptun_server.in b/net/kcptun/files/kcptun_server.in
164 new file mode 100644
165 index 000000000000..2d47f04a69d1
166 --- /dev/null
167 +++ b/net/kcptun/files/kcptun_server.in
168 @@ -0,0 +1,22 @@
169 +#!/bin/sh
170 +#
171 +# PROVIDE: kcptun_server
172 +# REQUIRE: NETWORKING
173 +
174 +. /etc/rc.subr
175 +
176 +name="kcptun_server"
177 +desc="kcptun server service"
178 +rcvar="${name}_enable"
179 +
180 +load_rc_config $name
181 +
182 +: ${kcptun_server_enable:="NO"}
183 +: ${kcptun_server_config:="/usr/local/etc/kcptun/server.json"}
184 +: ${kcptun_server_bin:="/usr/local/bin/kcptun-server"}
185 +
186 +pidfile="/var/run/${name}.pid"
187 +command="/usr/sbin/daemon"
188 +command_args="-u nobody -c -f -S -P ${pidfile} -r ${kcptun_server_bin} -c ${kcptun_server_config}"
189 +
190 +run_rc_command "$1"
191 diff --git a/net/kcptun/pkg-descr b/net/kcptun/pkg-descr
192 new file mode 100644
193 index 000000000000..139e914428c4
194 --- /dev/null
195 +++ b/net/kcptun/pkg-descr
196 @@ -0,0 +1,6 @@
197 +KCPTun is an extremely fast, reliable, and secure UDP tunnel based on
198 +KCP protocol. It is designed to reduce latency and packet loss for
199 +TCP traffic over unstable networks.
200 +
201 +It consists of a client and a server, and can be used to accelerate
202 +any TCP traffic.