mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-06 08:25:01 +01:00
kcptun: new tool
This commit is contained in:
parent
14b1698cbd
commit
5d69152c86
12 changed files with 457 additions and 0 deletions
10
net-vpn/kcptun/Manifest
Normal file
10
net-vpn/kcptun/Manifest
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
DIST github.com-klauspost-cpuid-v1.2.1.tar.gz 279083 BLAKE2B 33dcb59c15ddf644f187940c1100ecebf9e4a628b9397fcb9ebf81e8e96651bd16fa3e79aced726c29c91b09a477438bedc7ddf22504b1647e02ef8d5f20efef SHA512 d5d1cc22f6e43619dd64f86057385fb8080e85903983937be7282aed6c88a3686d7e1ce58a641ba753dacb6fcc54715343521a85cb1bdf074afbacc91b8f8ad8
|
||||||
|
DIST github.com-klauspost-reedsolomon-v1.9.1.tar.gz 159389 BLAKE2B 52c0b1cbdeb5f4780516166c5f59267fc7202b12b0ea15a741ca186aa60a922593e77ee1f2974af5a1c2e02ab3588eb0307a722de2a3b606347c08d789311a63 SHA512 070e8f7004e254d9dbbd50471afd78ba4dfa1db6bb41c51fc3a488e682f6923a7cb6d48930a59d2939842b0794b03aa7b24f5949328477706cebe244005eb437
|
||||||
|
DIST github.com-pkg-errors-v0.8.1.tar.gz 11009 BLAKE2B 02adfe3cea02b0ddb7cde923c22dc8a035491098d138d6254e8b833f58f4388a7bd172a15a22f3dbd6b0ce8909b6167f62561d32ec3d21566eef00005c1a025d SHA512 8f93cdae71789e417da11a45c667954169ec4adc04fb618f938ffc2e513cb021f140bc2b94f3e634fd4f19b73be7c9bc483d541bb7baea54c7c9700becc4d438
|
||||||
|
DIST github.com-templexxx-cpufeat-cef66df.tar.gz 2974 BLAKE2B d8b19668e1ff91dd34b0843752d9398ada22fa0d3f078fa76331b1f8e9779766c00bf59201e45f4aa06fcb15157ad5b1227731ec962930538384284ae7a67475 SHA512 e2d57b773fecfe2564f33ef868e6f5450ed608b4ed03dff02c861bf47d2f492089439aa687b4e65672095b35c7a8dadd71c73faec967a716fca7d5660a8e78b2
|
||||||
|
DIST github.com-templexxx-xor-0.1.2.tar.gz 6429 BLAKE2B 3d7f11d03f453e1a7497f356ae78a0f260f2e2bbcb395e408fd64e07cde152790ca078cfbc0434a9d4b890f111cdbaff1e57a7ae4cc867ea553e42a0c056cfc0 SHA512 44fdc35957386f43d1ee82521489e8adc315326c590c94b54491efa41f9432753ab6097ceffbe3938694b3fafa089b3ea96f34464ec3e7f0564debbb3fed49fe
|
||||||
|
DIST github.com-tjfoc-gmsm-v1.2.tar.gz 83757 BLAKE2B cf3f0c8a8fc83e60771e001d589dcc47b346539e64acdfb9a217f5a2dfea6e4af3efa874d8f4761279275a0c0b03337a8b8c13c95a716bcfdf8ca90335e2a6be SHA512 5f6ef6a780a338575673d134d2e5b7130ea5a143a7710e0e08e86b4ba711c2e3fd3bda7a2d4ed4dbfb8252718b11ec90590262565af12f164dd9e975a2eba406
|
||||||
|
DIST github.com-urfave-cli-v1.20.0.tar.gz 58397 BLAKE2B 0f623bff26139e57f29a2939c70ad8ba0c8daaf3721cc6f4d061fc88209102b1ece790dc0772f5fad66649f1129836482feee20def3dc0d63e728020664016ec SHA512 0a47a47121e25bceb6ebdf10a55ab3bc7531214284b1669fe20237c3ac938c7cd154ebc408759202d936688350e27e47d14f6a6b0793271c10534f2e90bd1fb5
|
||||||
|
DIST github.com-xtaci-kcp-go-v5.2.7.tar.gz 77924 BLAKE2B ae42d8adbd55c5966ab91471644cd01370cc01e28cb8f26652643d2f22258e83171b892dd0cd631294fe4f98218a4ff86606605811c03257bc6cde30ce0e8576 SHA512 dbaca9c168c8d61cc17148d56fcf2b966f8dc37dbac1bf3da37161a5d2cd4054db4b6c81bcf31868e7e11d0c71ae1e8173840a44f5ea218efeffe092646e19c9
|
||||||
|
DIST github.com-xtaci-smux-v1.2.10.tar.gz 132155 BLAKE2B 959656ab82500220c66ed1952d07565e1cc6bc478db53d9307a0e00603b9a0a8d56dd587e18967c87be1d2d2ef5724ea397513141fea70c712175a6a65505a4d SHA512 798468a3dec5f75a3d81252e73548017dd4a9d7b3cdef0c64c45c7f01b0d980f919e5be1b064ba3774f9117eea0dd9488ad02fda68810808b2016456fb104257
|
||||||
|
DIST kcptun-20190428.tar.gz 277627 BLAKE2B 4fa2bf4a9587f8070c7a192257b4e94eefaad72257ca35eccbcaa413599417102f3439ebd1d44c3a93f252d1dcb4994a825326c3ee85309545197b92db0a6dd7 SHA512 2843df918f45c5e3ba85b6abebd563a3d55456057bf2ed7617757f160da316ce9c16af1c8dc410625ec1e632f39e596fe772efc84708c7b798e252e73e34b32a
|
||||||
13
net-vpn/kcptun/files/example-client.json
Normal file
13
net-vpn/kcptun/files/example-client.json
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"remoteaddr": "44.55.66.77:1234",
|
||||||
|
"localaddr": ":4000",
|
||||||
|
"key": "y0uR_KeY",
|
||||||
|
"crypt": "aes-128",
|
||||||
|
"mode": "fast",
|
||||||
|
"conn": 1,
|
||||||
|
"mtu": 1350,
|
||||||
|
"sndwnd": 512,
|
||||||
|
"rcvwnd": 1024,
|
||||||
|
"quiet": false,
|
||||||
|
"nocomp": true
|
||||||
|
}
|
||||||
18
net-vpn/kcptun/files/example-server.json
Normal file
18
net-vpn/kcptun/files/example-server.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"listen": "0.0.0.0:1234",
|
||||||
|
"target": "[vps--ipv6 address]:2233",
|
||||||
|
"key": "y0uR_KeY",
|
||||||
|
"crypt": "aes-128",
|
||||||
|
"mode": "fast",
|
||||||
|
"mtu": 1350,
|
||||||
|
"sndwnd": 2048,
|
||||||
|
"rcvwnd": 2048,
|
||||||
|
"datashard": 70,
|
||||||
|
"parityshard": 30,
|
||||||
|
"dscp": 46,
|
||||||
|
"nocomp": true,
|
||||||
|
"quiet": false,
|
||||||
|
"pprof": false,
|
||||||
|
"sockbuf": 4194304,
|
||||||
|
"keepalive": 10
|
||||||
|
}
|
||||||
106
net-vpn/kcptun/files/kcptun-client.1
Normal file
106
net-vpn/kcptun/files/kcptun-client.1
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||||
|
.TH KCPTUN "1" "May 2019" "kcptun version 20190428" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
kcptun \- manual page for kcptun version 20190428
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.SS "NAME:"
|
||||||
|
.IP
|
||||||
|
kcptun \- client(with SMUX)
|
||||||
|
.SS "USAGE:"
|
||||||
|
.IP
|
||||||
|
kcptun\-client [global options] command [command options] [arguments...]
|
||||||
|
.SS "VERSION:"
|
||||||
|
.IP
|
||||||
|
20190428
|
||||||
|
.SS "COMMANDS:"
|
||||||
|
.TP
|
||||||
|
help, h
|
||||||
|
Shows a list of commands or help for one command
|
||||||
|
.SS "GLOBAL OPTIONS:"
|
||||||
|
.TP
|
||||||
|
\fB\-\-localaddr\fR value, \fB\-l\fR value
|
||||||
|
local listen address (default: ":12948")
|
||||||
|
.TP
|
||||||
|
\fB\-\-remoteaddr\fR value, \fB\-r\fR value
|
||||||
|
kcp server address (default: "vps:29900")
|
||||||
|
.TP
|
||||||
|
\fB\-\-key\fR value
|
||||||
|
pre\-shared secret between client and server (default: "it's a secrect") [$KCPTUN_KEY]
|
||||||
|
.TP
|
||||||
|
\fB\-\-crypt\fR value
|
||||||
|
aes, aes\-128, aes\-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none (default: "aes")
|
||||||
|
.TP
|
||||||
|
\fB\-\-mode\fR value
|
||||||
|
profiles: fast3, fast2, fast, normal, manual (default: "fast")
|
||||||
|
.TP
|
||||||
|
\fB\-\-conn\fR value
|
||||||
|
set num of UDP connections to server (default: 1)
|
||||||
|
.TP
|
||||||
|
\fB\-\-autoexpire\fR value
|
||||||
|
set auto expiration time(in seconds) for a single UDP connection, 0 to disable (default: 0)
|
||||||
|
.TP
|
||||||
|
\fB\-\-scavengettl\fR value
|
||||||
|
set how long an expired connection can live(in sec), \fB\-1\fR to disable (default: 600)
|
||||||
|
.TP
|
||||||
|
\fB\-\-mtu\fR value
|
||||||
|
set maximum transmission unit for UDP packets (default: 1350)
|
||||||
|
.TP
|
||||||
|
\fB\-\-sndwnd\fR value
|
||||||
|
set send window size(num of packets) (default: 128)
|
||||||
|
.TP
|
||||||
|
\fB\-\-rcvwnd\fR value
|
||||||
|
set receive window size(num of packets) (default: 512)
|
||||||
|
.TP
|
||||||
|
\fB\-\-datashard\fR value, \fB\-\-ds\fR value
|
||||||
|
set reed\-solomon erasure coding \- datashard (default: 10)
|
||||||
|
.TP
|
||||||
|
\fB\-\-parityshard\fR value, \fB\-\-ps\fR value
|
||||||
|
set reed\-solomon erasure coding \- parityshard (default: 3)
|
||||||
|
.TP
|
||||||
|
\fB\-\-dscp\fR value
|
||||||
|
set DSCP(6bit) (default: 0)
|
||||||
|
.TP
|
||||||
|
\fB\-\-nocomp\fR
|
||||||
|
disable compression
|
||||||
|
.TP
|
||||||
|
\fB\-\-sockbuf\fR value
|
||||||
|
per\-socket buffer in bytes (default: 4194304)
|
||||||
|
.TP
|
||||||
|
\fB\-\-smuxbuf\fR value
|
||||||
|
the overall de\-mux buffer in bytes (default: 4194304)
|
||||||
|
.TP
|
||||||
|
\fB\-\-keepalive\fR value
|
||||||
|
seconds between heartbeats (default: 10)
|
||||||
|
.TP
|
||||||
|
\fB\-\-snmplog\fR value
|
||||||
|
collect snmp to file, aware of timeformat in golang, like: ./snmp\-20060102.log
|
||||||
|
.TP
|
||||||
|
\fB\-\-snmpperiod\fR value
|
||||||
|
snmp collect period, in seconds (default: 60)
|
||||||
|
.TP
|
||||||
|
\fB\-\-log\fR value
|
||||||
|
specify a log file to output, default goes to stderr
|
||||||
|
.TP
|
||||||
|
\fB\-\-quiet\fR
|
||||||
|
to suppress the 'stream open/close' messages
|
||||||
|
.TP
|
||||||
|
\fB\-c\fR value
|
||||||
|
config from json file, which will override the command from shell
|
||||||
|
.TP
|
||||||
|
\fB\-\-help\fR, \fB\-h\fR
|
||||||
|
show help
|
||||||
|
.TP
|
||||||
|
\fB\-\-version\fR, \fB\-v\fR
|
||||||
|
print the version
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
The full documentation for
|
||||||
|
.B kcptun
|
||||||
|
is maintained as a Texinfo manual. If the
|
||||||
|
.B info
|
||||||
|
and
|
||||||
|
.B kcptun
|
||||||
|
programs are properly installed at your site, the command
|
||||||
|
.IP
|
||||||
|
.B info kcptun
|
||||||
|
.PP
|
||||||
|
should give you access to the complete manual.
|
||||||
10
net-vpn/kcptun/files/kcptun-client.confd
Normal file
10
net-vpn/kcptun/files/kcptun-client.confd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# /etc/conf.d/kcptun-client: config file for /etc/init.d/kcptun-client
|
||||||
|
|
||||||
|
# Client side configuration (needs to be absolute path)
|
||||||
|
#KCPTUN_CONFIGFILE="/etc/kcptun/client.json"
|
||||||
|
|
||||||
|
# Path to log file (needs to be absolute path)
|
||||||
|
#KCPTUN_LOGFILE=""
|
||||||
|
|
||||||
|
# See more: man kcptun-client
|
||||||
|
KCPTUN_OPTS=""
|
||||||
44
net-vpn/kcptun/files/kcptun-client.initd
Normal file
44
net-vpn/kcptun/files/kcptun-client.initd
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
KCPTUN_CONFIGFILE="${KCPTUN_CONFIGFILE:-/etc/kcptun/client.json}"
|
||||||
|
KCPTUN_LOGFILE="${KCPTUN_LOGFILE:-/var/log/kcptun-client.log}"
|
||||||
|
|
||||||
|
USER="nobody"
|
||||||
|
GROUP="nobody"
|
||||||
|
|
||||||
|
description="A kcptun-client daemon"
|
||||||
|
command="/usr/bin/kcptun-client"
|
||||||
|
command_background="true"
|
||||||
|
command_user="${USER}:${GROUP}"
|
||||||
|
command_args="-c ${KCPTUN_CONFIGFILE} --log ${KCPTUN_LOGFILE} ${KCPTUN_OPTS}"
|
||||||
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
|
start_stop_daemon_args="--quiet"
|
||||||
|
retry="${KCPTUN_TERMTIMEOUT:-"TERM/25/KILL/5"}"
|
||||||
|
|
||||||
|
extra_commands="checkconfig"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig() {
|
||||||
|
if ! [ -f "${KCPTUN_CONFIGFILE}" ]; then
|
||||||
|
eerror "You need an \"${KCPTUN_CONFIGFILE}\" file to run ${RC_SVCNAME}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f "${KCPTUN_LOGFILE}" ]; then
|
||||||
|
touch "${KCPTUN_LOGFILE}" \
|
||||||
|
&& chmod 0640 "${KCPTUN_LOGFILE}" \
|
||||||
|
&& chown ${USER}:${GROUP} "${KCPTUN_LOGFILE}" > /dev/null 2>&1 \
|
||||||
|
|| eerror "Failed to create: ${KCPTUN_LOGFILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
checkconfig || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ft=gentoo-init-d ts=4 :
|
||||||
100
net-vpn/kcptun/files/kcptun-server.1
Normal file
100
net-vpn/kcptun/files/kcptun-server.1
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||||
|
.TH KCPTUN "1" "May 2019" "kcptun version 20190428" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
kcptun \- manual page for kcptun version 20190428
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.SS "NAME:"
|
||||||
|
.IP
|
||||||
|
kcptun \- server(with SMUX)
|
||||||
|
.SS "USAGE:"
|
||||||
|
.IP
|
||||||
|
kcptun\-server [global options] command [command options] [arguments...]
|
||||||
|
.SS "VERSION:"
|
||||||
|
.IP
|
||||||
|
20190428
|
||||||
|
.SS "COMMANDS:"
|
||||||
|
.TP
|
||||||
|
help, h
|
||||||
|
Shows a list of commands or help for one command
|
||||||
|
.SS "GLOBAL OPTIONS:"
|
||||||
|
.TP
|
||||||
|
\fB\-\-listen\fR value, \fB\-l\fR value
|
||||||
|
kcp server listen address (default: ":29900")
|
||||||
|
.TP
|
||||||
|
\fB\-\-target\fR value, \fB\-t\fR value
|
||||||
|
target server address (default: "127.0.0.1:12948")
|
||||||
|
.TP
|
||||||
|
\fB\-\-key\fR value
|
||||||
|
pre\-shared secret between client and server (default: "it's a secrect") [$KCPTUN_KEY]
|
||||||
|
.TP
|
||||||
|
\fB\-\-crypt\fR value
|
||||||
|
aes, aes\-128, aes\-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none (default: "aes")
|
||||||
|
.TP
|
||||||
|
\fB\-\-mode\fR value
|
||||||
|
profiles: fast3, fast2, fast, normal, manual (default: "fast")
|
||||||
|
.TP
|
||||||
|
\fB\-\-mtu\fR value
|
||||||
|
set maximum transmission unit for UDP packets (default: 1350)
|
||||||
|
.TP
|
||||||
|
\fB\-\-sndwnd\fR value
|
||||||
|
set send window size(num of packets) (default: 1024)
|
||||||
|
.TP
|
||||||
|
\fB\-\-rcvwnd\fR value
|
||||||
|
set receive window size(num of packets) (default: 1024)
|
||||||
|
.TP
|
||||||
|
\fB\-\-datashard\fR value, \fB\-\-ds\fR value
|
||||||
|
set reed\-solomon erasure coding \- datashard (default: 10)
|
||||||
|
.TP
|
||||||
|
\fB\-\-parityshard\fR value, \fB\-\-ps\fR value
|
||||||
|
set reed\-solomon erasure coding \- parityshard (default: 3)
|
||||||
|
.TP
|
||||||
|
\fB\-\-dscp\fR value
|
||||||
|
set DSCP(6bit) (default: 0)
|
||||||
|
.TP
|
||||||
|
\fB\-\-nocomp\fR
|
||||||
|
disable compression
|
||||||
|
.TP
|
||||||
|
\fB\-\-sockbuf\fR value
|
||||||
|
per\-socket buffer in bytes (default: 4194304)
|
||||||
|
.TP
|
||||||
|
\fB\-\-smuxbuf\fR value
|
||||||
|
the overall de\-mux buffer in bytes (default: 4194304)
|
||||||
|
.TP
|
||||||
|
\fB\-\-keepalive\fR value
|
||||||
|
seconds between heartbeats (default: 10)
|
||||||
|
.TP
|
||||||
|
\fB\-\-snmplog\fR value
|
||||||
|
collect snmp to file, aware of timeformat in golang, like: ./snmp\-20060102.log
|
||||||
|
.TP
|
||||||
|
\fB\-\-snmpperiod\fR value
|
||||||
|
snmp collect period, in seconds (default: 60)
|
||||||
|
.TP
|
||||||
|
\fB\-\-pprof\fR
|
||||||
|
start profiling server on :6060
|
||||||
|
.TP
|
||||||
|
\fB\-\-log\fR value
|
||||||
|
specify a log file to output, default goes to stderr
|
||||||
|
.TP
|
||||||
|
\fB\-\-quiet\fR
|
||||||
|
to suppress the 'stream open/close' messages
|
||||||
|
.TP
|
||||||
|
\fB\-c\fR value
|
||||||
|
config from json file, which will override the command from shell
|
||||||
|
.TP
|
||||||
|
\fB\-\-help\fR, \fB\-h\fR
|
||||||
|
show help
|
||||||
|
.TP
|
||||||
|
\fB\-\-version\fR, \fB\-v\fR
|
||||||
|
print the version
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
The full documentation for
|
||||||
|
.B kcptun
|
||||||
|
is maintained as a Texinfo manual. If the
|
||||||
|
.B info
|
||||||
|
and
|
||||||
|
.B kcptun
|
||||||
|
programs are properly installed at your site, the command
|
||||||
|
.IP
|
||||||
|
.B info kcptun
|
||||||
|
.PP
|
||||||
|
should give you access to the complete manual.
|
||||||
10
net-vpn/kcptun/files/kcptun-server.confd
Normal file
10
net-vpn/kcptun/files/kcptun-server.confd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# /etc/conf.d/kcptun-server: config file for /etc/init.d/kcptun-server
|
||||||
|
|
||||||
|
# Server side configuration (needs to be absolute path)
|
||||||
|
#KCPTUN_CONFIGFILE="/etc/kcptun/server.json"
|
||||||
|
|
||||||
|
# Path to log file (needs to be absolute path)
|
||||||
|
#KCPTUN_LOGFILE=""
|
||||||
|
|
||||||
|
# See more: man kcptun-server
|
||||||
|
KCPTUN_OPTS=""
|
||||||
44
net-vpn/kcptun/files/kcptun-server.initd
Normal file
44
net-vpn/kcptun/files/kcptun-server.initd
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
KCPTUN_CONFIGFILE="${KCPTUN_CONFIGFILE:-/etc/kcptun/server.json}"
|
||||||
|
KCPTUN_LOGFILE="${KCPTUN_LOGFILE:-/var/log/kcptun-server.log}"
|
||||||
|
|
||||||
|
USER="nobody"
|
||||||
|
GROUP="nobody"
|
||||||
|
|
||||||
|
description="A kcptun-server daemon"
|
||||||
|
command="/usr/bin/kcptun-server"
|
||||||
|
command_background="true"
|
||||||
|
command_user="${USER}:${GROUP}"
|
||||||
|
command_args="-c ${KCPTUN_CONFIGFILE} --log ${KCPTUN_LOGFILE} ${KCPTUN_OPTS}"
|
||||||
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
|
start_stop_daemon_args="--quiet"
|
||||||
|
retry="${KCPTUN_TERMTIMEOUT:-"TERM/25/KILL/5"}"
|
||||||
|
|
||||||
|
extra_commands="checkconfig"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig() {
|
||||||
|
if ! [ -f "${KCPTUN_CONFIGFILE}" ]; then
|
||||||
|
eerror "You need an \"${KCPTUN_CONFIGFILE}\" file to run ${RC_SVCNAME}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f "${KCPTUN_LOGFILE}" ]; then
|
||||||
|
touch "${KCPTUN_LOGFILE}" \
|
||||||
|
&& chmod 0640 "${KCPTUN_LOGFILE}" \
|
||||||
|
&& chown ${USER}:${GROUP} "${KCPTUN_LOGFILE}" > /dev/null 2>&1 \
|
||||||
|
|| eerror "Failed to create: ${KCPTUN_LOGFILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
checkconfig || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ft=gentoo-init-d ts=4 :
|
||||||
15
net-vpn/kcptun/files/kcptun.service
Normal file
15
net-vpn/kcptun/files/kcptun.service
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Kcptun Client Service (fuck you!)
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=nobody
|
||||||
|
ExecStart=/usr/bin/kcptun-client -c /root/kcptun/fuck_you.json
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
# fuck you!
|
||||||
76
net-vpn/kcptun/kcptun-20190428.ebuild
Normal file
76
net-vpn/kcptun/kcptun-20190428.ebuild
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=7
|
||||||
|
EGO_PN="github.com/xtaci/kcptun"
|
||||||
|
EGO_VENDOR=(
|
||||||
|
"github.com/pkg/errors v0.8.1"
|
||||||
|
"github.com/urfave/cli v1.20.0"
|
||||||
|
"github.com/xtaci/kcp-go v5.2.7"
|
||||||
|
"github.com/tjfoc/gmsm v1.2"
|
||||||
|
"github.com/templexxx/xor 0.1.2"
|
||||||
|
"github.com/klauspost/reedsolomon v1.9.1"
|
||||||
|
"github.com/klauspost/cpuid v1.2.1"
|
||||||
|
"github.com/templexxx/cpufeat cef66df" # 20180724
|
||||||
|
"github.com/xtaci/smux v1.2.10"
|
||||||
|
)
|
||||||
|
|
||||||
|
inherit golang-vcs-snapshot
|
||||||
|
|
||||||
|
DESCRIPTION="A Stable & Secure Tunnel Based On KCP with N:M Multiplexing"
|
||||||
|
HOMEPAGE="https://github.com/xtaci/kcptun"
|
||||||
|
|
||||||
|
SRC_URI="https://github.com/xtaci/kcptun/archive/v${PV}.tar.gz -> ${P}.tar.gz
|
||||||
|
${EGO_VENDOR_URI}"
|
||||||
|
|
||||||
|
KEYWORDS="~amd64 ~arm64 ~mips"
|
||||||
|
LICENSE="MIT"
|
||||||
|
IUSE="+server"
|
||||||
|
SLOT="0"
|
||||||
|
|
||||||
|
RDEPEND="!net-vpn/kcptun-bin
|
||||||
|
dev-go/go-text:=
|
||||||
|
dev-go/go-snappy:=
|
||||||
|
dev-go/go-net:=
|
||||||
|
dev-go/go-tools:=
|
||||||
|
dev-go/go-crypto:=
|
||||||
|
dev-go/go-sys:="
|
||||||
|
|
||||||
|
DEPEND="${RDEPEND}
|
||||||
|
>=dev-lang/go-1.12"
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
for x in client $(usev server); do
|
||||||
|
CGO_ENABLED=0 GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
|
||||||
|
go build -v -work -x -ldflags "-X main.VERSION=${PV}" -o "bin/${PN}-${x}" "${EGO_PN}/${x}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
dobin bin/${PN}-*
|
||||||
|
dodoc src/"${EGO_PN}"/{README.md,Dockerfile}
|
||||||
|
|
||||||
|
insinto "/etc/kcptun"
|
||||||
|
for x in client $(usev server); do
|
||||||
|
doins "${FILESDIR}"/example-${x}.json
|
||||||
|
|
||||||
|
newinitd "${FILESDIR}"/kcptun-${x}.initd kcptun-${x}
|
||||||
|
newconfd "${FILESDIR}"/kcptun-${x}.confd kcptun-${x}
|
||||||
|
|
||||||
|
# help2man ./bin/${PN}-*
|
||||||
|
doman "${FILESDIR}"/${PN}-${x}.1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
ewarn "Suggested \"/etc/sysctl.conf\" parameters for better handling of UDP packets:"
|
||||||
|
ewarn " net.core.rmem_max=26214400 // BDP - bandwidth delay product"
|
||||||
|
ewarn " net.core.rmem_default=26214400"
|
||||||
|
ewarn " net.core.wmem_max=26214400"
|
||||||
|
ewarn " net.core.wmem_default=26214400"
|
||||||
|
ewarn " net.core.netdev_max_backlog=2048 // proportional to -rcvwnd"
|
||||||
|
|
||||||
|
elog "\nSee documentation:"
|
||||||
|
elog " https://github.com/xtaci/kcptun#quickstart"
|
||||||
|
elog " https://github.com/skywind3000/kcp/blob/master/README.en.md\n"
|
||||||
|
}
|
||||||
11
net-vpn/kcptun/metadata.xml
Normal file
11
net-vpn/kcptun/metadata.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="person">
|
||||||
|
<email>email@linxon.ru</email>
|
||||||
|
<name>Yury Martynov</name>
|
||||||
|
</maintainer>
|
||||||
|
<use>
|
||||||
|
<flag name="server">Enable server side daemon</flag>
|
||||||
|
</use>
|
||||||
|
</pkgmetadata>
|
||||||
Loading…
Reference in a new issue