diff -Nru kcptun-20170930+ds/client/config.go kcptun-20171201+ds/client/config.go --- kcptun-20170930+ds/client/config.go 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/client/config.go 2017-10-23 07:59:28.000000000 +0000 @@ -32,6 +32,7 @@ Log string `json:"log"` SnmpLog string `json:"snmplog"` SnmpPeriod int `json:"snmpperiod"` + Quiet bool `json:"quiet"` } func parseJSONConfig(config *Config, path string) error { diff -Nru kcptun-20170930+ds/client/main.go kcptun-20171201+ds/client/main.go --- kcptun-20170930+ds/client/main.go 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/client/main.go 2017-10-23 07:59:28.000000000 +0000 @@ -55,9 +55,12 @@ return c } -func handleClient(sess *smux.Session, p1 io.ReadWriteCloser) { - log.Println("stream opened") - defer log.Println("stream closed") +func handleClient(sess *smux.Session, p1 io.ReadWriteCloser, quiet bool) { + if !quiet { + log.Println("stream opened") + defer log.Println("stream closed") + } + defer p1.Close() p2, err := sess.OpenStream() if err != nil { @@ -116,7 +119,7 @@ cli.StringFlag{ Name: "crypt", Value: "aes", - Usage: "aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, none", + Usage: "aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none", }, cli.StringFlag{ Name: "mode", @@ -222,6 +225,10 @@ Value: "", Usage: "specify a log file to output, default goes to stderr", }, + cli.BoolFlag{ + Name: "quiet", + Usage: "to suppress the 'stream open/close' messages", + }, cli.StringFlag{ Name: "c", Value: "", // when the value is not empty, the config path must exists @@ -255,6 +262,7 @@ config.Log = c.String("log") config.SnmpLog = c.String("snmplog") config.SnmpPeriod = c.Int("snmpperiod") + config.Quiet = c.Bool("quiet") if c.String("c") != "" { err := parseJSONConfig(&config, c.String("c")) @@ -289,6 +297,8 @@ pass := pbkdf2.Key([]byte(config.Key), []byte(SALT), 4096, 32, sha1.New) var block kcp.BlockCrypt switch config.Crypt { + case "sm4": + block, _ = kcp.NewSM4BlockCrypt(pass[:16]) case "tea": block, _ = kcp.NewTEABlockCrypt(pass[:16]) case "xor": @@ -333,6 +343,7 @@ log.Println("scavengettl:", config.ScavengeTTL) log.Println("snmplog:", config.SnmpLog) log.Println("snmpperiod:", config.SnmpPeriod) + log.Println("quiet:", config.Quiet) smuxConfig := smux.DefaultConfig() smuxConfig.MaxReceiveBuffer = config.SockBuf @@ -416,7 +427,7 @@ muxes[idx].ttl = time.Now().Add(time.Duration(config.AutoExpire) * time.Second) } - go handleClient(muxes[idx].session, p1) + go handleClient(muxes[idx].session, p1, config.Quiet) rr++ } } diff -Nru kcptun-20170930+ds/debian/changelog kcptun-20171201+ds/debian/changelog --- kcptun-20170930+ds/debian/changelog 2017-10-15 01:02:52.000000000 +0000 +++ kcptun-20171201+ds/debian/changelog 2017-12-31 13:42:56.000000000 +0000 @@ -1,3 +1,24 @@ +kcptun (20171201+ds-1) unstable; urgency=medium + + * New upstream version v20171201 + * debian/control: + - Set Priority from extra to optional. + - Bump up Build-Depends golang-github-xtaci-kcp-dev version to 3.23 + + -- Roger Shimizu Sun, 31 Dec 2017 22:42:56 +0900 + +kcptun (20170930+ds-1~bpo8+1) jessie-backports-sloppy; urgency=medium + + * Rebuild for jessie-backports-sloppy. + + -- Roger Shimizu Mon, 23 Oct 2017 00:45:17 +0900 + +kcptun (20170930+ds-1~bpo9+1) stretch-backports; urgency=medium + + * Rebuild for stretch-backports. + + -- Roger Shimizu Mon, 23 Oct 2017 00:43:27 +0900 + kcptun (20170930+ds-1) unstable; urgency=medium * New upstream version v20170930 diff -Nru kcptun-20170930+ds/debian/control kcptun-20171201+ds/debian/control --- kcptun-20170930+ds/debian/control 2017-10-15 00:57:29.000000000 +0000 +++ kcptun-20171201+ds/debian/control 2017-12-31 13:31:14.000000000 +0000 @@ -1,6 +1,6 @@ Source: kcptun Section: net -Priority: extra +Priority: optional Maintainer: Debian Go Packaging Team Uploaders: Roger Shimizu Build-Depends: @@ -10,7 +10,7 @@ golang-github-golang-snappy-dev, golang-github-pkg-errors-dev, golang-github-urfave-cli-dev, - golang-github-xtaci-kcp-dev (>= 3.13), + golang-github-xtaci-kcp-dev (>= 3.23), golang-github-xtaci-smux-dev, golang-golang-x-crypto-dev, help2man diff -Nru kcptun-20170930+ds/Dockerfile kcptun-20171201+ds/Dockerfile --- kcptun-20170930+ds/Dockerfile 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/Dockerfile 2017-10-23 07:59:28.000000000 +0000 @@ -1,8 +1,11 @@ -FROM golang:alpine +FROM golang:alpine as builder MAINTAINER xtaci RUN apk update && \ apk upgrade && \ apk add git RUN go get -ldflags "-X main.VERSION=$(date -u +%Y%m%d) -s -w" github.com/xtaci/kcptun/client && go get -ldflags "-X main.VERSION=$(date -u +%Y%m%d) -s -w" github.com/xtaci/kcptun/server + +FROM alpine:3.6 +COPY --from=builder /go/bin /bin EXPOSE 29900/udp EXPOSE 12948 diff -Nru kcptun-20170930+ds/README.md kcptun-20171201+ds/README.md --- kcptun-20170930+ds/README.md 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/README.md 2017-10-23 07:59:28.000000000 +0000 @@ -23,6 +23,8 @@ > *kcptun maintains a single website — [github.com/xtaci/kcptun](https://github.com/xtaci/kcptun). Any websites other than [github.com/xtaci/kcptun](https://github.com/xtaci/kcptun) are not endorsed by xtaci. kcptun won't publish anything on any social media.* +> *KCP communication group: 364933586 (QQ group number), KCP integration, tuning, network transmission and related technical discussions.* + ### QuickStart Download precompiled [Releases](https://github.com/xtaci/kcptun/releases). diff -Nru kcptun-20170930+ds/server/config.go kcptun-20171201+ds/server/config.go --- kcptun-20170930+ds/server/config.go 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/server/config.go 2017-10-23 07:59:28.000000000 +0000 @@ -30,6 +30,7 @@ SnmpLog string `json:"snmplog"` SnmpPeriod int `json:"snmpperiod"` Pprof bool `json:"pprof"` + Quiet bool `json:"quiet"` } func parseJSONConfig(config *Config, path string) error { diff -Nru kcptun-20170930+ds/server/main.go kcptun-20171201+ds/server/main.go --- kcptun-20170930+ds/server/main.go 2017-09-04 03:06:21.000000000 +0000 +++ kcptun-20171201+ds/server/main.go 2017-10-23 07:59:28.000000000 +0000 @@ -81,13 +81,15 @@ log.Println(err) continue } - go handleClient(p1, p2) + go handleClient(p1, p2, config.Quiet) } } -func handleClient(p1, p2 io.ReadWriteCloser) { - log.Println("stream opened") - defer log.Println("stream closed") +func handleClient(p1, p2 io.ReadWriteCloser, quiet bool) { + if !quiet { + log.Println("stream opened") + defer log.Println("stream closed") + } defer p1.Close() defer p2.Close() @@ -142,7 +144,7 @@ cli.StringFlag{ Name: "crypt", Value: "aes", - Usage: "aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, none", + Usage: "aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none", }, cli.StringFlag{ Name: "mode", @@ -237,6 +239,10 @@ Value: "", Usage: "specify a log file to output, default goes to stderr", }, + cli.BoolFlag{ + Name: "quiet", + Usage: "to suppress the 'stream open/close' messages", + }, cli.StringFlag{ Name: "c", Value: "", // when the value is not empty, the config path must exists @@ -268,6 +274,7 @@ config.SnmpLog = c.String("snmplog") config.SnmpPeriod = c.Int("snmpperiod") config.Pprof = c.Bool("pprof") + config.Quiet = c.Bool("quiet") if c.String("c") != "" { //Now only support json config file @@ -298,6 +305,8 @@ pass := pbkdf2.Key([]byte(config.Key), []byte(SALT), 4096, 32, sha1.New) var block kcp.BlockCrypt switch config.Crypt { + case "sm4": + block, _ = kcp.NewSM4BlockCrypt(pass[:16]) case "tea": block, _ = kcp.NewTEABlockCrypt(pass[:16]) case "xor": @@ -342,6 +351,7 @@ log.Println("snmplog:", config.SnmpLog) log.Println("snmpperiod:", config.SnmpPeriod) log.Println("pprof:", config.Pprof) + log.Println("quiet:", config.Quiet) if err := lis.SetDSCP(config.DSCP); err != nil { log.Println("SetDSCP:", err)