├── src ├── conf │ ├── frps.ini │ └── frpc.ini ├── github.com │ ├── vaughan0 │ │ └── go-ini │ │ │ ├── test.ini │ │ │ ├── LICENSE │ │ │ └── README.md │ ├── armon │ │ └── go-socks5 │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── credentials.go │ │ │ ├── resolver.go │ │ │ ├── LICENSE │ │ │ ├── ruleset.go │ │ │ └── README.md │ ├── klauspost │ │ ├── cpuid │ │ │ ├── generate.go │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── detect_intel.go │ │ │ ├── detect_ref.go │ │ │ ├── cpuid_386.s │ │ │ ├── cpuid_amd64.s │ │ │ └── LICENSE │ │ └── reedsolomon │ │ │ ├── .gitignore │ │ │ ├── appveyor.yml │ │ │ ├── galois_noasm.go │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ └── options.go │ ├── xtaci │ │ ├── smux │ │ │ ├── mux.jpg │ │ │ ├── smux.png │ │ │ ├── curve.jpg │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ └── frame.go │ │ └── kcp-go │ │ │ ├── donate.png │ │ │ ├── frame.png │ │ │ ├── kcp-go.png │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ └── LICENSE │ ├── julienschmidt │ │ └── httprouter │ │ │ ├── .travis.yml │ │ │ └── LICENSE │ ├── docopt │ │ └── docopt-go │ │ │ ├── test_golang.docopt │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ └── LICENSE │ ├── stretchr │ │ └── testify │ │ │ ├── assert │ │ │ ├── assertion_forward.go.tmpl │ │ │ ├── errors.go │ │ │ ├── forward_assertions.go │ │ │ └── doc.go │ │ │ ├── LICENSE │ │ │ └── LICENCE.txt │ ├── pkg │ │ └── errors │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── appveyor.yml │ │ │ └── LICENSE │ ├── golang │ │ └── snappy │ │ │ ├── .gitignore │ │ │ ├── README │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ └── LICENSE │ ├── fatedier │ │ └── beego │ │ │ ├── LICENSE │ │ │ └── logs │ │ │ ├── color.go │ │ │ ├── README.md │ │ │ └── slack.go │ ├── context │ │ ├── net_test.go │ │ ├── benchmark_test.go │ │ └── x_test.go │ ├── davecgh │ │ └── go-spew │ │ │ └── LICENSE │ └── pmezard │ │ └── go-difflib │ │ └── LICENSE ├── web │ └── frps │ │ ├── src │ │ ├── vendor.js │ │ ├── assets │ │ │ └── favicon.ico │ │ ├── utils │ │ │ └── less │ │ │ │ └── custom.less │ │ ├── main.js │ │ ├── router │ │ │ └── index.js │ │ └── components │ │ │ └── Traffic.vue │ │ ├── .babelrc │ │ ├── .gitignore │ │ ├── postcss.config.js │ │ ├── Makefile │ │ └── package.json ├── assets │ └── static │ │ ├── favicon.ico │ │ ├── b02bdc1b846fd65473922f5f62832108.ttf │ │ └── manifest.js ├── tests │ ├── conf │ │ ├── auto_test_frps.ini │ │ └── auto_test_frpc.ini │ ├── run_test.sh │ ├── http_server.go │ ├── clean_test.sh │ └── echo_server.go ├── golang.org │ └── x │ │ ├── net │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── internal │ │ │ └── socket │ │ │ │ ├── sys_darwin.go │ │ │ │ ├── sys_dragonfly.go │ │ │ │ ├── sys_linux_arm.go │ │ │ │ ├── sys_linux_arm64.go │ │ │ │ ├── sys_linux_amd64.go │ │ │ │ ├── sys_linux_mips.go │ │ │ │ ├── sys_linux_mips64.go │ │ │ │ ├── sys_linux_mipsle.go │ │ │ │ ├── sys_linux_ppc64.go │ │ │ │ ├── sys_linux_ppc64le.go │ │ │ │ ├── sys_linux_mips64le.go │ │ │ │ ├── msghdr_openbsd.go │ │ │ │ ├── iovec_stub.go │ │ │ │ ├── msghdr_bsdvar.go │ │ │ │ ├── sys_bsdvar.go │ │ │ │ ├── sys_linux_386.s │ │ │ │ ├── sys_linux_s390x.s │ │ │ │ ├── sys_solaris_amd64.s │ │ │ │ ├── cmsghdr_solaris_64bit.go │ │ │ │ ├── cmsghdr_bsd.go │ │ │ │ ├── cmsghdr_linux_32bit.go │ │ │ │ ├── iovec_solaris_64bit.go │ │ │ │ ├── cmsghdr_linux_64bit.go │ │ │ │ ├── cmsghdr.go │ │ │ │ ├── iovec_32bit.go │ │ │ │ ├── iovec_64bit.go │ │ │ │ ├── rawconn_nommsg.go │ │ │ │ ├── sys_bsd.go │ │ │ │ ├── cmsghdr_stub.go │ │ │ │ ├── msghdr_linux_32bit.go │ │ │ │ ├── rawconn_nomsg.go │ │ │ │ ├── msghdr_linux_64bit.go │ │ │ │ ├── mmsghdr_stub.go │ │ │ │ ├── msghdr_stub.go │ │ │ │ ├── error_windows.go │ │ │ │ ├── rawconn_stub.go │ │ │ │ ├── sys.go │ │ │ │ ├── sys_netbsd.go │ │ │ │ ├── error_unix.go │ │ │ │ ├── sys_linux.go │ │ │ │ ├── msghdr_solaris_64bit.go │ │ │ │ ├── msghdr_linux.go │ │ │ │ ├── msghdr_bsd.go │ │ │ │ ├── defs_darwin.go │ │ │ │ ├── defs_dragonfly.go │ │ │ │ ├── defs_freebsd.go │ │ │ │ ├── defs_openbsd.go │ │ │ │ ├── defs_solaris.go │ │ │ │ ├── zsys_darwin_386.go │ │ │ │ ├── zsys_darwin_arm.go │ │ │ │ ├── zsys_freebsd_386.go │ │ │ │ ├── zsys_freebsd_arm.go │ │ │ │ ├── zsys_netbsd_arm.go │ │ │ │ ├── zsys_openbsd_386.go │ │ │ │ ├── zsys_openbsd_arm.go │ │ │ │ ├── zsys_darwin_amd64.go │ │ │ │ ├── defs_netbsd.go │ │ │ │ ├── zsys_dragonfly_amd64.go │ │ │ │ ├── zsys_freebsd_amd64.go │ │ │ │ ├── zsys_openbsd_amd64.go │ │ │ │ ├── zsys_linux_386.go │ │ │ │ ├── zsys_linux_arm.go │ │ │ │ ├── zsys_linux_mips.go │ │ │ │ ├── zsys_linux_mipsle.go │ │ │ │ ├── mmsghdr_unix.go │ │ │ │ ├── zsys_solaris_amd64.go │ │ │ │ ├── zsys_netbsd_386.go │ │ │ │ ├── defs_linux.go │ │ │ │ ├── zsys_linux_amd64.go │ │ │ │ ├── zsys_linux_arm64.go │ │ │ │ ├── zsys_linux_mips64.go │ │ │ │ ├── zsys_linux_ppc64.go │ │ │ │ ├── zsys_linux_ppc64le.go │ │ │ │ ├── zsys_linux_s390x.go │ │ │ │ ├── zsys_linux_mips64le.go │ │ │ │ ├── zsys_netbsd_amd64.go │ │ │ │ ├── sys_unix.go │ │ │ │ ├── reflect.go │ │ │ │ ├── rawconn.go │ │ │ │ └── sys_stub.go │ │ ├── ipv4 │ │ │ ├── sys_stub.go │ │ │ ├── sys_bpf_stub.go │ │ │ ├── control_windows.go │ │ │ ├── control_stub.go │ │ │ ├── icmp_stub.go │ │ │ ├── sys_asmreqn_stub.go │ │ │ ├── sys_ssmreq_stub.go │ │ │ ├── icmp_linux.go │ │ │ ├── sys_bpf.go │ │ │ ├── payload.go │ │ │ ├── sys_asmreq_stub.go │ │ │ ├── zsys_netbsd.go │ │ │ ├── zsys_openbsd.go │ │ │ ├── zsys_dragonfly.go │ │ │ ├── defs_netbsd.go │ │ │ ├── defs_openbsd.go │ │ │ ├── control_pktinfo.go │ │ │ ├── defs_dragonfly.go │ │ │ ├── sys_asmreqn.go │ │ │ ├── control_bsd.go │ │ │ ├── sockopt_stub.go │ │ │ ├── helper.go │ │ │ ├── iana.go │ │ │ ├── payload_cmsg.go │ │ │ ├── packet_go1_8.go │ │ │ ├── genericopt.go │ │ │ ├── sys_ssmreq.go │ │ │ ├── payload_nocmsg.go │ │ │ └── icmp.go │ │ ├── PATENTS │ │ ├── bpf │ │ │ └── asm.go │ │ └── LICENSE │ │ └── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── salsa20 │ │ └── salsa │ │ │ └── salsa20_amd64.go │ │ ├── PATENTS │ │ └── LICENSE ├── utils │ ├── errors │ │ ├── errors_test.go │ │ └── errors.go │ ├── shutdown │ │ ├── shutdown_test.go │ │ └── shutdown.go │ ├── metric │ │ ├── counter_test.go │ │ ├── date_counter_test.go │ │ └── counter.go │ ├── pool │ │ ├── buf_test.go │ │ ├── snappy.go │ │ └── buf.go │ ├── crypto │ │ └── crypto_test.go │ ├── vhost │ │ └── resource.go │ └── version │ │ └── version_test.go ├── models │ ├── proto │ │ └── udp │ │ │ └── udp_test.go │ ├── errors │ │ └── errors.go │ ├── consts │ │ └── consts.go │ └── plugin │ │ ├── plugin.go │ │ └── socks5.go └── client │ ├── service.go │ └── admin.go ├── .dockerignore ├── doc └── pic │ ├── dashboard.png │ └── architecture.png ├── .travis.yml ├── Godeps └── Readme ├── update.bat ├── Dockerfile_alpine ├── Dockerfile ├── .gitignore ├── Makefile └── package.sh /src/conf/frps.ini: -------------------------------------------------------------------------------- 1 | [common] 2 | bind_port = 7000 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | .git 3 | *~ 4 | *# 5 | .#* 6 | -------------------------------------------------------------------------------- /src/github.com/vaughan0/go-ini/test.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | stuff = things 3 | -------------------------------------------------------------------------------- /doc/pic/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/doc/pic/dashboard.png -------------------------------------------------------------------------------- /src/web/frps/src/vendor.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import ElementUI from 'element-ui' -------------------------------------------------------------------------------- /doc/pic/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/doc/pic/architecture.png -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.1 4 | - tip 5 | -------------------------------------------------------------------------------- /src/assets/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/assets/static/favicon.ico -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/generate.go: -------------------------------------------------------------------------------- 1 | package cpuid 2 | 3 | //go:generate go run private-gen.go 4 | -------------------------------------------------------------------------------- /src/web/frps/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", { "modules": false }] 4 | ] 5 | } -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/mux.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/smux/mux.jpg -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/smux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/smux/smux.png -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/curve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/smux/curve.jpg -------------------------------------------------------------------------------- /src/web/frps/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/web/frps/src/assets/favicon.ico -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/donate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/kcp-go/donate.png -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/kcp-go/frame.png -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/kcp-go.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/github.com/xtaci/kcp-go/kcp-go.png -------------------------------------------------------------------------------- /src/web/frps/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log 5 | .idea 6 | .vscode/settings.json 7 | -------------------------------------------------------------------------------- /src/web/frps/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('autoprefixer')() 4 | ] 5 | } -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.4 6 | - 1.5 7 | - 1.6 8 | - tip 9 | -------------------------------------------------------------------------------- /src/web/frps/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: dist build 2 | install: 3 | @npm install 4 | 5 | dev: install 6 | @npm run dev 7 | 8 | build: 9 | @npm run build -------------------------------------------------------------------------------- /src/assets/static/b02bdc1b846fd65473922f5f62832108.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/frpu/HEAD/src/assets/static/b02bdc1b846fd65473922f5f62832108.ttf -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | go: 5 | - 1.8.x 6 | 7 | install: 8 | - make 9 | 10 | script: 11 | - make alltest 12 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /src/conf/frpc.ini: -------------------------------------------------------------------------------- 1 | [common] 2 | server_addr = 127.0.0.1 3 | server_port = 7000 4 | 5 | [ssh] 6 | type = tcp 7 | local_ip = 127.0.0.1 8 | local_port = 22 9 | remote_port = 6000 10 | -------------------------------------------------------------------------------- /src/tests/conf/auto_test_frps.ini: -------------------------------------------------------------------------------- 1 | [common] 2 | bind_addr = 0.0.0.0 3 | bind_port = 10700 4 | vhost_http_port = 10710 5 | log_file = ./frps.log 6 | log_level = debug 7 | privilege_token = 123456 8 | -------------------------------------------------------------------------------- /src/github.com/julienschmidt/httprouter/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.1 5 | - 1.2 6 | - 1.3 7 | - 1.4 8 | - 1.5 9 | - 1.6 10 | - 1.7 11 | - tip 12 | -------------------------------------------------------------------------------- /src/tests/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./../bin/frps -c ./conf/auto_test_frps.ini & 4 | sleep 1 5 | ./../bin/frpc -c ./conf/auto_test_frpc.ini & 6 | 7 | # wait until proxies are connected 8 | sleep 2 9 | -------------------------------------------------------------------------------- /src/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /src/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /src/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /src/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /update.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | set /p m=请输入标记: 4 | set /p http=请输入项目网址: 5 | git init 6 | git add . 7 | git commit -m "%m%" 8 | git remote add origin %http% 9 | git push -u origin master 10 | pause 11 | -------------------------------------------------------------------------------- /src/github.com/docopt/docopt-go/test_golang.docopt: -------------------------------------------------------------------------------- 1 | r"""usage: prog [NAME_-2]...""" 2 | $ prog 10 20 3 | {"NAME_-2": ["10", "20"]} 4 | 5 | $ prog 10 6 | {"NAME_-2": ["10"]} 7 | 8 | $ prog 9 | {"NAME_-2": []} 10 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 4 | } 5 | -------------------------------------------------------------------------------- /src/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.x 5 | - 1.5.x 6 | - 1.6.x 7 | - 1.7.x 8 | - 1.8.x 9 | - tip 10 | 11 | script: 12 | - go test -v ./... 13 | -------------------------------------------------------------------------------- /Dockerfile_alpine: -------------------------------------------------------------------------------- 1 | FROM alpine:3.5 2 | 3 | COPY tmp/frpc /frpc 4 | COPY tmp/frps /frps 5 | COPY conf/frpc_min.ini /frpc.ini 6 | COPY conf/frps_min.ini /frps.ini 7 | 8 | WORKDIR / 9 | 10 | EXPOSE 80 443 6000 7000 7500 11 | 12 | ENTRYPOINT ["/frps"] 13 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /src/github.com/golang/snappy/.gitignore: -------------------------------------------------------------------------------- 1 | testdata/alice29.txt 2 | testdata/asyoulik.txt 3 | testdata/fireworks.jpeg 4 | testdata/geo.protodata 5 | testdata/html 6 | testdata/html_x_4 7 | testdata/kppkn.gtb 8 | testdata/lcet10.txt 9 | testdata/paper-100k.pdf 10 | testdata/plrabn12.txt 11 | testdata/urls.10K 12 | -------------------------------------------------------------------------------- /src/github.com/golang/snappy/README: -------------------------------------------------------------------------------- 1 | The Snappy compression format in the Go programming language. 2 | 3 | To download and install from source: 4 | $ go get github.com/golang/snappy 5 | 6 | Unless otherwise noted, the Snappy-Go source files are distributed 7 | under the BSD-style license found in the LICENSE file. 8 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x16d 9 | sysSENDMMSG = 0x176 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0xf3 9 | sysSENDMMSG = 0x10d 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x12b 9 | sysSENDMMSG = 0x133 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /src/tests/http_server.go: -------------------------------------------------------------------------------- 1 | package tests 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func StartHttpServer() { 9 | http.HandleFunc("/", request) 10 | http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", 10702), nil) 11 | } 12 | 13 | func request(w http.ResponseWriter, r *http.Request) { 14 | w.Write([]byte(HTTP_RES_STR)) 15 | } 16 | -------------------------------------------------------------------------------- /src/utils/errors/errors_test.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestPanicToError(t *testing.T) { 10 | assert := assert.New(t) 11 | 12 | err := PanicToError(func() { 13 | panic("test error") 14 | }) 15 | assert.Contains(err.Error(), "test error") 16 | } 17 | -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | 5 | before_install: 6 | - go get -t -v ./... 7 | 8 | install: 9 | - go get github.com/xtaci/smux 10 | 11 | script: 12 | - go test -coverprofile=coverage.txt -covermode=atomic -bench . 13 | 14 | after_success: 15 | - bash <(curl -s https://codecov.io/bash) 16 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func (h *msghdr) setIov(vs []iovec) { 8 | h.Iov = &vs[0] 9 | h.Iovlen = uint32(len(vs)) 10 | } 11 | -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.8 4 | 5 | before_install: 6 | - go get -t -v ./... 7 | 8 | install: 9 | - go get github.com/xtaci/kcp-go 10 | 11 | script: 12 | - go test -coverprofile=coverage.txt -covermode=atomic -bench . 13 | 14 | after_success: 15 | - bash <(curl -s https://codecov.io/bash) 16 | -------------------------------------------------------------------------------- /src/utils/shutdown/shutdown_test.go: -------------------------------------------------------------------------------- 1 | package shutdown 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func TestShutdown(t *testing.T) { 9 | s := New() 10 | go func() { 11 | time.Sleep(time.Millisecond) 12 | s.Start() 13 | }() 14 | s.WaitStart() 15 | 16 | go func() { 17 | time.Sleep(time.Millisecond) 18 | s.Done() 19 | }() 20 | s.WaitDown() 21 | } 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8 2 | 3 | COPY . /go/src/github.com/fatedier/frp 4 | 5 | RUN cd /go/src/github.com/fatedier/frp \ 6 | && make \ 7 | && mv bin/frpc /frpc \ 8 | && mv bin/frps /frps \ 9 | && mv conf/frpc.ini /frpc.ini \ 10 | && mv conf/frps.ini /frps.ini \ 11 | && make clean 12 | 13 | WORKDIR / 14 | 15 | EXPOSE 80 443 6000 7000 7500 16 | 17 | ENTRYPOINT ["/frps"] 18 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/iovec_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type iovec struct{} 10 | 11 | func (v *iovec) set(b []byte) {} 12 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd 6 | 7 | package socket 8 | 9 | func (h *msghdr) setIov(vs []iovec) { 10 | h.Iov = &vs[0] 11 | h.Iovlen = int32(len(vs)) 12 | } 13 | -------------------------------------------------------------------------------- /src/tests/clean_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pid=`ps aux|grep './../bin/frps -c ./conf/auto_test_frps.ini'|grep -v grep|awk {'print $2'}` 4 | if [ -n "${pid}" ]; then 5 | kill ${pid} 6 | fi 7 | 8 | pid=`ps aux|grep './../bin/frpc -c ./conf/auto_test_frpc.ini'|grep -v grep|awk {'print $2'}` 9 | if [ -n "${pid}" ]; then 10 | kill ${pid} 11 | fi 12 | 13 | rm -f ./frps.log 14 | rm -f ./frpc.log 15 | -------------------------------------------------------------------------------- /src/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /src/models/proto/udp/udp_test.go: -------------------------------------------------------------------------------- 1 | package udp 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestUdpPacket(t *testing.T) { 10 | assert := assert.New(t) 11 | 12 | buf := []byte("hello world") 13 | udpMsg := NewUdpPacket(buf, nil, nil) 14 | 15 | newBuf, err := GetContent(udpMsg) 16 | assert.NoError(err) 17 | assert.EqualValues(buf, newBuf) 18 | } 19 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import "unsafe" 10 | 11 | func probeProtocolStack() int { 12 | var p uintptr 13 | return int(unsafe.Sizeof(p)) 14 | } 15 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-36 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-72 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-72 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 8 | JMP syscall·sysvicall6(SB) 9 | 10 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 11 | JMP syscall·rawSysvicall6(SB) 12 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /src/web/frps/src/utils/less/custom.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | 3 | .el-form-item { 4 | span { 5 | margin-left: 15px; 6 | } 7 | } 8 | 9 | .demo-table-expand { 10 | font-size: 0; 11 | 12 | label { 13 | width: 90px; 14 | color: #99a9bf; 15 | } 16 | 17 | .el-form-item { 18 | margin-right: 0; 19 | margin-bottom: 0; 20 | width: 50%; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) set(l, lvl, typ int) { 10 | h.Len = uint32(l) 11 | h.Level = int32(lvl) 12 | h.Type = int32(typ) 13 | } 14 | -------------------------------------------------------------------------------- /src/github.com/docopt/docopt-go/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | 24 | # coverage droppings 25 | profile.cov 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/iovec_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | v.Base = (*int8)(unsafe.Pointer(&b[0])) 14 | v.Len = uint64(len(b)) 15 | } 16 | -------------------------------------------------------------------------------- /src/web/frps/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import ElementUI from 'element-ui' 3 | import 'element-ui/lib/theme-default/index.css' 4 | import './utils/less/custom.less' 5 | 6 | import App from './App.vue' 7 | import router from './router' 8 | import 'whatwg-fetch' 9 | 10 | Vue.use(ElementUI) 11 | Vue.config.productionTip = false 12 | 13 | new Vue({ 14 | el: '#app', 15 | router, 16 | template: '', 17 | components: { App } 18 | }) 19 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2015 2 | 3 | platform: x64 4 | 5 | clone_folder: c:\gopath\src\github.com\klauspost\reedsolomon 6 | 7 | # environment variables 8 | environment: 9 | GOPATH: c:\gopath 10 | 11 | install: 12 | - echo %PATH% 13 | - echo %GOPATH% 14 | - go version 15 | - go env 16 | - go get -d ./... 17 | 18 | build_script: 19 | - go test -v -cpu=2 ./... 20 | - go test -cpu=1,2,4 -short -race ./... 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # Self 27 | bin/ 28 | packages/ 29 | test/bin/ 30 | 31 | # Cache 32 | *.swp 33 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint64(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) len() int { return int(h.Len) } 10 | func (h *cmsghdr) lvl() int { return int(h.Level) } 11 | func (h *cmsghdr) typ() int { return int(h.Type) } 12 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errOpNoSupport 16 | } 17 | -------------------------------------------------------------------------------- /src/utils/metric/counter_test.go: -------------------------------------------------------------------------------- 1 | package metric 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestCounter(t *testing.T) { 10 | assert := assert.New(t) 11 | c := NewCounter() 12 | c.Inc(10) 13 | assert.EqualValues(10, c.Count()) 14 | 15 | c.Dec(5) 16 | assert.EqualValues(5, c.Count()) 17 | 18 | cTmp := c.Snapshot() 19 | assert.EqualValues(5, cTmp.Count()) 20 | 21 | c.Clear() 22 | assert.EqualValues(0, c.Count()) 23 | } 24 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl 17 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/iovec_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 14 | v.Len = uint32(len(b)) 15 | } 16 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/control_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "syscall" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 14 | // TODO(mikio): implement this 15 | return syscall.EWINDOWS 16 | } 17 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errOpNoSupport 13 | } 14 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/galois_noasm.go: -------------------------------------------------------------------------------- 1 | //+build !amd64 noasm appengine 2 | 3 | // Copyright 2015, Klaus Post, see LICENSE for details. 4 | 5 | package reedsolomon 6 | 7 | func galMulSlice(c byte, in, out []byte, ssse3, avx2 bool) { 8 | mt := mulTable[c] 9 | for n, input := range in { 10 | out[n] = mt[input] 11 | } 12 | } 13 | 14 | func galMulSliceXor(c byte, in, out []byte, ssse3, avx2 bool) { 15 | mt := mulTable[c] 16 | for n, input := range in { 17 | out[n] ^= mt[input] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/credentials.go: -------------------------------------------------------------------------------- 1 | package socks5 2 | 3 | // CredentialStore is used to support user/pass authentication 4 | type CredentialStore interface { 5 | Valid(user, password string) bool 6 | } 7 | 8 | // StaticCredentials enables using a map directly as a credential store 9 | type StaticCredentials map[string]string 10 | 11 | func (s StaticCredentials) Valid(user, password string) bool { 12 | pass, ok := s[user] 13 | if !ok { 14 | return false 15 | } 16 | return password == pass 17 | } 18 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/iovec_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 14 | v.Len = uint64(len(b)) 15 | } 16 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/detect_intel.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. 2 | 3 | // +build 386,!gccgo amd64,!gccgo 4 | 5 | package cpuid 6 | 7 | func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32) 8 | func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) 9 | func asmXgetbv(index uint32) (eax, edx uint32) 10 | func asmRdtscpAsm() (eax, ebx, ecx, edx uint32) 11 | 12 | func initCPU() { 13 | cpuid = asmCpuid 14 | cpuidex = asmCpuidex 15 | xgetbv = asmXgetbv 16 | rdtscpAsm = asmRdtscpAsm 17 | } 18 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/rawconn_nommsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | // +build !linux 7 | 8 | package socket 9 | 10 | import "errors" 11 | 12 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 13 | return 0, errors.New("not implemented") 14 | } 15 | 16 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 17 | return 0, errors.New("not implemented") 18 | } 19 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd openbsd 6 | 7 | package socket 8 | 9 | import "errors" 10 | 11 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 12 | return 0, errors.New("not implemented") 13 | } 14 | 15 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 16 | return 0, errors.New("not implemented") 17 | } 18 | -------------------------------------------------------------------------------- /src/github.com/golang/snappy/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Snappy-Go authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Damian Gryski 12 | Google Inc. 13 | Jan Mercl <0xjnml@gmail.com> 14 | Rodolfo Carvalho 15 | Sebastien Binet 16 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/cmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type cmsghdr struct{} 10 | 11 | const sizeofCmsghdr = 0 12 | 13 | func (h *cmsghdr) len() int { return 0 } 14 | func (h *cmsghdr) lvl() int { return 0 } 15 | func (h *cmsghdr) typ() int { return 0 } 16 | 17 | func (h *cmsghdr) set(l, lvl, typ int) {} 18 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | h.Iov = &vs[0] 14 | h.Iovlen = uint32(len(vs)) 15 | } 16 | 17 | func (h *msghdr) setControl(b []byte) { 18 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 19 | h.Controllen = uint32(len(b)) 20 | } 21 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/detect_ref.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. 2 | 3 | // +build !amd64,!386 gccgo 4 | 5 | package cpuid 6 | 7 | func initCPU() { 8 | cpuid = func(op uint32) (eax, ebx, ecx, edx uint32) { 9 | return 0, 0, 0, 0 10 | } 11 | 12 | cpuidex = func(op, op2 uint32) (eax, ebx, ecx, edx uint32) { 13 | return 0, 0, 0, 0 14 | } 15 | 16 | xgetbv = func(index uint32) (eax, edx uint32) { 17 | return 0, 0 18 | } 19 | 20 | rdtscpAsm = func() (eax, ebx, ecx, edx uint32) { 21 | return 0, 0, 0, 0 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/rawconn_nomsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 7 | 8 | package socket 9 | 10 | import "errors" 11 | 12 | func (c *Conn) recvMsg(m *Message, flags int) error { 13 | return errors.New("not implemented") 14 | } 15 | 16 | func (c *Conn) sendMsg(m *Message, flags int) error { 17 | return errors.New("not implemented") 18 | } 19 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/icmp_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | const sizeofICMPFilter = 0x0 10 | 11 | type icmpFilter struct { 12 | } 13 | 14 | func (f *icmpFilter) accept(typ ICMPType) { 15 | } 16 | 17 | func (f *icmpFilter) block(typ ICMPType) { 18 | } 19 | 20 | func (f *icmpFilter) setAll(block bool) { 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | h.Iov = &vs[0] 14 | h.Iovlen = uint64(len(vs)) 15 | } 16 | 17 | func (h *msghdr) setControl(b []byte) { 18 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 19 | h.Controllen = uint64(len(b)) 20 | } 21 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_asmreqn_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 16 | return nil, errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 20 | return errOpNoSupport 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/fatedier/beego/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 astaxie 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_ssmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux,!solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 20 | return errOpNoSupport 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/context/net_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | "context" 9 | "net" 10 | "testing" 11 | ) 12 | 13 | func TestDeadlineExceededIsNetError(t *testing.T) { 14 | err, ok := context.DeadlineExceeded.(net.Error) 15 | if !ok { 16 | t.Fatal("DeadlineExceeded does not implement net.Error") 17 | } 18 | if !err.Timeout() || !err.Temporary() { 19 | t.Fatalf("Timeout() = %v, Temporary() = %v, want true, true", err.Timeout(), err.Temporary()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/resolver.go: -------------------------------------------------------------------------------- 1 | package socks5 2 | 3 | import ( 4 | "net" 5 | 6 | "golang.org/x/net/context" 7 | ) 8 | 9 | // NameResolver is used to implement custom name resolution 10 | type NameResolver interface { 11 | Resolve(ctx context.Context, name string) (context.Context, net.IP, error) 12 | } 13 | 14 | // DNSResolver uses the system DNS to resolve host names 15 | type DNSResolver struct{} 16 | 17 | func (d DNSResolver) Resolve(ctx context.Context, name string) (context.Context, net.IP, error) { 18 | addr, err := net.ResolveIPAddr("ip", name) 19 | if err != nil { 20 | return ctx, nil, err 21 | } 22 | return ctx, addr.IP, err 23 | } 24 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/mmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux,!netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdr struct{} 12 | 13 | type mmsghdrs []mmsghdr 14 | 15 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 16 | return nil 17 | } 18 | 19 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /src/utils/metric/date_counter_test.go: -------------------------------------------------------------------------------- 1 | package metric 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestDateCounter(t *testing.T) { 10 | assert := assert.New(t) 11 | 12 | dc := NewDateCounter(3) 13 | dc.Inc(10) 14 | assert.EqualValues(10, dc.TodayCount()) 15 | 16 | dc.Dec(5) 17 | assert.EqualValues(5, dc.TodayCount()) 18 | 19 | counts := dc.GetLastDaysCount(3) 20 | assert.EqualValues(3, len(counts)) 21 | assert.EqualValues(5, counts[0]) 22 | assert.EqualValues(0, counts[1]) 23 | assert.EqualValues(0, counts[2]) 24 | 25 | dcTmp := dc.Snapshot() 26 | assert.EqualValues(5, dcTmp.TodayCount()) 27 | } 28 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/icmp_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | func (f *icmpFilter) accept(typ ICMPType) { 8 | f.Data &^= 1 << (uint32(typ) & 31) 9 | } 10 | 11 | func (f *icmpFilter) block(typ ICMPType) { 12 | f.Data |= 1 << (uint32(typ) & 31) 13 | } 14 | 15 | func (f *icmpFilter) setAll(block bool) { 16 | if block { 17 | f.Data = 1<<32 - 1 18 | } else { 19 | f.Data = 0 20 | } 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return f.Data&(1<<(uint32(typ)&31)) != 0 25 | } 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_bpf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 17 | prog := sockFProg{ 18 | Len: uint16(len(f)), 19 | Filter: (*sockFilter)(unsafe.Pointer(&f[0])), 20 | } 21 | b := (*[sizeofSockFprog]byte)(unsafe.Pointer(&prog))[:sizeofSockFprog] 22 | return so.Set(c, b) 23 | } 24 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type msghdr struct{} 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {} 12 | func (h *msghdr) name() []byte { return nil } 13 | func (h *msghdr) controllen() int { return 0 } 14 | func (h *msghdr) flags() int { return 0 } 15 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | go: 10 | - 1.5 11 | - 1.6 12 | - 1.7 13 | - 1.8 14 | - master 15 | 16 | install: 17 | - go get ./... 18 | 19 | script: 20 | - go vet ./... 21 | - go test -v -cpu=1,2,4 . 22 | - go test -v -cpu=1,2,4 -short -race . 23 | - go test -tags=noasm -v -cpu=1,2,4 -short -race . 24 | - go build examples/simple-decoder.go 25 | - go build examples/simple-encoder.go 26 | - go build examples/stream-decoder.go 27 | - go build examples/stream-encoder.go 28 | - diff <(gofmt -d .) <("") 29 | 30 | matrix: 31 | allow_failures: 32 | - go: 'master' 33 | fast_finish: true 34 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/payload.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "net" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | // BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo 14 | // methods of PacketConn is not implemented. 15 | 16 | // A payloadHandler represents the IPv4 datagram payload handler. 17 | type payloadHandler struct { 18 | net.PacketConn 19 | *socket.Conn 20 | rawOpt 21 | } 22 | 23 | func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil } 24 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/error_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "syscall" 8 | 9 | var ( 10 | errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING 11 | errEINVAL error = syscall.EINVAL 12 | ) 13 | 14 | // errnoErr returns common boxed Errno values, to prevent allocations 15 | // at runtime. 16 | func errnoErr(errno syscall.Errno) error { 17 | switch errno { 18 | case 0: 19 | return nil 20 | case syscall.ERROR_IO_PENDING: 21 | return errERROR_IO_PENDING 22 | case syscall.EINVAL: 23 | return errEINVAL 24 | } 25 | return errno 26 | } 27 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/rawconn_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package socket 8 | 9 | import "errors" 10 | 11 | func (c *Conn) recvMsg(m *Message, flags int) error { 12 | return errors.New("not implemented") 13 | } 14 | 15 | func (c *Conn) sendMsg(m *Message, flags int) error { 16 | return errors.New("not implemented") 17 | } 18 | 19 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 20 | return 0, errors.New("not implemented") 21 | } 22 | 23 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 24 | return 0, errors.New("not implemented") 25 | } 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_asmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errOpNoSupport 17 | } 18 | 19 | func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) { 20 | return nil, errOpNoSupport 21 | } 22 | 23 | func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error { 24 | return errOpNoSupport 25 | } 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/zsys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x17 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/zsys_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x1e 16 | sysIP_RECVTTL = 0x1f 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /src/tests/conf/auto_test_frpc.ini: -------------------------------------------------------------------------------- 1 | [common] 2 | server_addr = 0.0.0.0 3 | server_port = 10700 4 | log_file = ./frpc.log 5 | # debug, info, warn, error 6 | log_level = debug 7 | privilege_token = 123456 8 | 9 | [echo] 10 | type = tcp 11 | local_ip = 127.0.0.1 12 | local_port = 10701 13 | remote_port = 10711 14 | use_encryption = true 15 | use_compression = true 16 | 17 | [web] 18 | type = http 19 | local_ip = 127.0.0.1 20 | local_port = 10702 21 | use_encryption = true 22 | use_compression = true 23 | custom_domains = 127.0.0.1 24 | 25 | [udp] 26 | type = udp 27 | local_ip = 127.0.0.1 28 | local_port = 10703 29 | remote_port = 10712 30 | 31 | [unix_domain] 32 | type = tcp 33 | remote_port = 10704 34 | plugin = unix_domain_socket 35 | plugin_unix_path = /tmp/frp_echo_server.sock 36 | -------------------------------------------------------------------------------- /src/models/errors/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package errors 16 | 17 | import "errors" 18 | 19 | var ( 20 | ErrMsgType = errors.New("message type error") 21 | ) 22 | -------------------------------------------------------------------------------- /src/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/zsys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x41 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_MULTICAST_VIF = 0xe 22 | sysIP_ADD_MEMBERSHIP = 0xc 23 | sysIP_DROP_MEMBERSHIP = 0xd 24 | 25 | sizeofIPMreq = 0x8 26 | ) 27 | 28 | type ipMreq struct { 29 | Multiaddr [4]byte /* in_addr */ 30 | Interface [4]byte /* in_addr */ 31 | } 32 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "encoding/binary" 9 | "unsafe" 10 | ) 11 | 12 | var ( 13 | // NativeEndian is the machine native endian implementation of 14 | // ByteOrder. 15 | NativeEndian binary.ByteOrder 16 | 17 | kernelAlign int 18 | ) 19 | 20 | func init() { 21 | i := uint32(1) 22 | b := (*[4]byte)(unsafe.Pointer(&i)) 23 | if b[0] == 1 { 24 | NativeEndian = binary.LittleEndian 25 | } else { 26 | NativeEndian = binary.BigEndian 27 | } 28 | kernelAlign = probeProtocolStack() 29 | } 30 | 31 | func roundup(l int) int { 32 | return (l + kernelAlign - 1) & ^(kernelAlign - 1) 33 | } 34 | -------------------------------------------------------------------------------- /src/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | const ( 13 | sysRECVMMSG = 0x1db 14 | sysSENDMMSG = 0x1dc 15 | ) 16 | 17 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 18 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 19 | return int(n), errnoErr(errno) 20 | } 21 | 22 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 23 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 24 | return int(n), errnoErr(errno) 25 | } 26 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/error_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | import "syscall" 10 | 11 | var ( 12 | errEAGAIN error = syscall.EAGAIN 13 | errEINVAL error = syscall.EINVAL 14 | errENOENT error = syscall.ENOENT 15 | ) 16 | 17 | // errnoErr returns common boxed Errno values, to prevent allocations 18 | // at runtime. 19 | func errnoErr(errno syscall.Errno) error { 20 | switch errno { 21 | case 0: 22 | return nil 23 | case syscall.EAGAIN: 24 | return errEAGAIN 25 | case syscall.EINVAL: 26 | return errEINVAL 27 | case syscall.ENOENT: 28 | return errENOENT 29 | } 30 | return errno 31 | } 32 | -------------------------------------------------------------------------------- /src/github.com/docopt/docopt-go/.travis.yml: -------------------------------------------------------------------------------- 1 | # Travis CI (http://travis-ci.org/) is a continuous integration 2 | # service for open source projects. This file configures it 3 | # to run unit tests for docopt-go. 4 | 5 | language: go 6 | 7 | go: 8 | - 1.4 9 | - 1.5 10 | - tip 11 | 12 | matrix: 13 | fast_finish: true 14 | 15 | before_install: 16 | - go get golang.org/x/tools/cmd/vet 17 | - go get golang.org/x/tools/cmd/cover 18 | - go get github.com/golang/lint/golint 19 | - go get github.com/mattn/goveralls 20 | 21 | install: 22 | - go get -d -v ./... && go build -v ./... 23 | 24 | script: 25 | - go vet -x ./... 26 | - $HOME/gopath/bin/golint ./... 27 | - go test -v ./... 28 | - go test -covermode=count -coverprofile=profile.cov . 29 | 30 | after_script: 31 | - $HOME/gopath/bin/goveralls -coverprofile=profile.cov -service=travis-ci 32 | -------------------------------------------------------------------------------- /src/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,!appengine,!gccgo 6 | 7 | package salsa 8 | 9 | // This function is implemented in salsa2020_amd64.s. 10 | 11 | //go:noescape 12 | 13 | func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte) 14 | 15 | // XORKeyStream crypts bytes from in to out using the given key and counters. 16 | // In and out may be the same slice but otherwise should not overlap. Counter 17 | // contains the raw salsa20 counter bytes (both nonce and block counter). 18 | func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) { 19 | if len(in) == 0 { 20 | return 21 | } 22 | salsa2020XORKeyStream(&out[0], &in[0], uint64(len(in)), &counter[0], &key[0]) 23 | } 24 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!s390x,!386 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func probeProtocolStack() int { 15 | var p uintptr 16 | return int(unsafe.Sizeof(p)) 17 | } 18 | 19 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 20 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 21 | return int(n), errnoErr(errno) 22 | } 23 | 24 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 25 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 26 | return int(n), errnoErr(errno) 27 | } 28 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 13 | for i := range vs { 14 | vs[i].set(bs[i]) 15 | } 16 | h.Iov = &vs[0] 17 | h.Iovlen = int32(len(vs)) 18 | if len(oob) > 0 { 19 | h.Accrights = (*int8)(unsafe.Pointer(&oob[0])) 20 | h.Accrightslen = int32(len(oob)) 21 | } 22 | if sa != nil { 23 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 24 | h.Namelen = uint32(len(sa)) 25 | } 26 | } 27 | 28 | func (h *msghdr) controllen() int { 29 | return int(h.Accrightslen) 30 | } 31 | 32 | func (h *msghdr) flags() int { 33 | return int(NativeEndian.Uint32(h.Pad_cgo_2[:])) 34 | } 35 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "unsafe" 8 | 9 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 10 | for i := range vs { 11 | vs[i].set(bs[i]) 12 | } 13 | h.setIov(vs) 14 | if len(oob) > 0 { 15 | h.setControl(oob) 16 | } 17 | if sa != nil { 18 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 19 | h.Namelen = uint32(len(sa)) 20 | } 21 | } 22 | 23 | func (h *msghdr) name() []byte { 24 | if h.Name != nil && h.Namelen > 0 { 25 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 26 | } 27 | return nil 28 | } 29 | 30 | func (h *msghdr) controllen() int { 31 | return int(h.Controllen) 32 | } 33 | 34 | func (h *msghdr) flags() int { 35 | return int(h.Flags) 36 | } 37 | -------------------------------------------------------------------------------- /src/github.com/fatedier/beego/logs/color.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 beego Author. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // +build !windows 16 | 17 | package logs 18 | 19 | import "io" 20 | 21 | type ansiColorWriter struct { 22 | w io.Writer 23 | mode outputMode 24 | } 25 | 26 | func (cw *ansiColorWriter) Write(p []byte) (int, error) { 27 | return cw.w.Write(p) 28 | } 29 | -------------------------------------------------------------------------------- /src/web/frps/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Overview from '../components/Overview.vue' 4 | import ProxiesTcp from '../components/ProxiesTcp.vue' 5 | import ProxiesUdp from '../components/ProxiesUdp.vue' 6 | import ProxiesHttp from '../components/ProxiesHttp.vue' 7 | import ProxiesHttps from '../components/ProxiesHttps.vue' 8 | 9 | Vue.use(Router) 10 | 11 | export default new Router({ 12 | routes: [{ 13 | path: '/', 14 | name: 'Overview', 15 | component: Overview 16 | }, { 17 | path: '/proxies/tcp', 18 | name: 'ProxiesTcp', 19 | component: ProxiesTcp 20 | }, { 21 | path: '/proxies/udp', 22 | name: 'ProxiesUdp', 23 | component: ProxiesUdp 24 | }, { 25 | path: '/proxies/http', 26 | name: 'ProxiesHttp', 27 | component: ProxiesHttp 28 | }, { 29 | path: '/proxies/https', 30 | name: 'ProxiesHttps', 31 | component: ProxiesHttps 32 | }] 33 | }) -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/msghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import "unsafe" 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 12 | for i := range vs { 13 | vs[i].set(bs[i]) 14 | } 15 | h.setIov(vs) 16 | if len(oob) > 0 { 17 | h.Control = (*byte)(unsafe.Pointer(&oob[0])) 18 | h.Controllen = uint32(len(oob)) 19 | } 20 | if sa != nil { 21 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 22 | h.Namelen = uint32(len(sa)) 23 | } 24 | } 25 | 26 | func (h *msghdr) name() []byte { 27 | if h.Name != nil && h.Namelen > 0 { 28 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 29 | } 30 | return nil 31 | } 32 | 33 | func (h *msghdr) controllen() int { 34 | return int(h.Controllen) 35 | } 36 | 37 | func (h *msghdr) flags() int { 38 | return int(h.Flags) 39 | } 40 | -------------------------------------------------------------------------------- /src/models/consts/consts.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package consts 16 | 17 | var ( 18 | // proxy status 19 | Idle string = "idle" 20 | Working string = "working" 21 | Closed string = "closed" 22 | Online string = "online" 23 | Offline string = "offline" 24 | 25 | // proxy type 26 | TcpProxy string = "tcp" 27 | UdpProxy string = "udp" 28 | HttpProxy string = "http" 29 | HttpsProxy string = "https" 30 | StcpProxy string = "stcp" 31 | ) 32 | -------------------------------------------------------------------------------- /src/utils/errors/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package errors 16 | 17 | import ( 18 | "errors" 19 | "fmt" 20 | ) 21 | 22 | var ( 23 | ErrMsgType = errors.New("message type error") 24 | ErrCtlClosed = errors.New("control is closed") 25 | ) 26 | 27 | func PanicToError(fn func()) (err error) { 28 | defer func() { 29 | if r := recover(); r != nil { 30 | err = fmt.Errorf("Panic error: %v", r) 31 | } 32 | }() 33 | 34 | fn() 35 | return 36 | } 37 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /src/web/frps/src/components/Traffic.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 34 | 35 | 37 | -------------------------------------------------------------------------------- /src/github.com/vaughan0/go-ini/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Vaughan Newton 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 4 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 5 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 6 | persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 9 | Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 12 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 13 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 14 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/control_pktinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/iana" 14 | "golang.org/x/net/internal/socket" 15 | ) 16 | 17 | func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { 18 | m := socket.ControlMessage(b) 19 | m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) 20 | if cm != nil { 21 | pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) 22 | if ip := cm.Src.To4(); ip != nil { 23 | copy(pi.Spec_dst[:], ip) 24 | } 25 | if cm.IfIndex > 0 { 26 | pi.setIfindex(cm.IfIndex) 27 | } 28 | } 29 | return m.Next(sizeofInetPktinfo) 30 | } 31 | 32 | func parsePacketInfo(cm *ControlMessage, b []byte) { 33 | pi := (*inetPktinfo)(unsafe.Pointer(&b[0])) 34 | cm.IfIndex = int(pi.Ifindex) 35 | if len(cm.Dst) < net.IPv4len { 36 | cm.Dst = make(net.IP, net.IPv4len) 37 | } 38 | copy(cm.Dst, pi.Addr[:]) 39 | } 40 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/cpuid_386.s: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. 2 | 3 | // +build 386,!gccgo 4 | 5 | // func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32) 6 | TEXT ·asmCpuid(SB), 7, $0 7 | XORL CX, CX 8 | MOVL op+0(FP), AX 9 | CPUID 10 | MOVL AX, eax+4(FP) 11 | MOVL BX, ebx+8(FP) 12 | MOVL CX, ecx+12(FP) 13 | MOVL DX, edx+16(FP) 14 | RET 15 | 16 | // func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) 17 | TEXT ·asmCpuidex(SB), 7, $0 18 | MOVL op+0(FP), AX 19 | MOVL op2+4(FP), CX 20 | CPUID 21 | MOVL AX, eax+8(FP) 22 | MOVL BX, ebx+12(FP) 23 | MOVL CX, ecx+16(FP) 24 | MOVL DX, edx+20(FP) 25 | RET 26 | 27 | // func xgetbv(index uint32) (eax, edx uint32) 28 | TEXT ·asmXgetbv(SB), 7, $0 29 | MOVL index+0(FP), CX 30 | BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV 31 | MOVL AX, eax+4(FP) 32 | MOVL DX, edx+8(FP) 33 | RET 34 | 35 | // func asmRdtscpAsm() (eax, ebx, ecx, edx uint32) 36 | TEXT ·asmRdtscpAsm(SB), 7, $0 37 | BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP 38 | MOVL AX, eax+0(FP) 39 | MOVL BX, ebx+4(FP) 40 | MOVL CX, ecx+8(FP) 41 | MOVL DX, edx+12(FP) 42 | RET 43 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/cpuid_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. 2 | 3 | //+build amd64,!gccgo 4 | 5 | // func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32) 6 | TEXT ·asmCpuid(SB), 7, $0 7 | XORQ CX, CX 8 | MOVL op+0(FP), AX 9 | CPUID 10 | MOVL AX, eax+8(FP) 11 | MOVL BX, ebx+12(FP) 12 | MOVL CX, ecx+16(FP) 13 | MOVL DX, edx+20(FP) 14 | RET 15 | 16 | // func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) 17 | TEXT ·asmCpuidex(SB), 7, $0 18 | MOVL op+0(FP), AX 19 | MOVL op2+4(FP), CX 20 | CPUID 21 | MOVL AX, eax+8(FP) 22 | MOVL BX, ebx+12(FP) 23 | MOVL CX, ecx+16(FP) 24 | MOVL DX, edx+20(FP) 25 | RET 26 | 27 | // func asmXgetbv(index uint32) (eax, edx uint32) 28 | TEXT ·asmXgetbv(SB), 7, $0 29 | MOVL index+0(FP), CX 30 | BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV 31 | MOVL AX, eax+8(FP) 32 | MOVL DX, edx+12(FP) 33 | RET 34 | 35 | // func asmRdtscpAsm() (eax, ebx, ecx, edx uint32) 36 | TEXT ·asmRdtscpAsm(SB), 7, $0 37 | BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP 38 | MOVL AX, eax+0(FP) 39 | MOVL BX, ebx+4(FP) 40 | MOVL CX, ecx+8(FP) 41 | MOVL DX, edx+12(FP) 42 | RET 43 | -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2017 Daniel Fu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF 32 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 33 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 34 | 35 | sizeofIPMreq = C.sizeof_struct_ip_mreq 36 | ) 37 | 38 | type ipMreq C.struct_ip_mreq 39 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Armon Dadgar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_asmreqn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 17 | b := make([]byte, so.Len) 18 | if _, err := so.Get(c, b); err != nil { 19 | return nil, err 20 | } 21 | mreqn := (*ipMreqn)(unsafe.Pointer(&b[0])) 22 | if mreqn.Ifindex == 0 { 23 | return nil, nil 24 | } 25 | ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex)) 26 | if err != nil { 27 | return nil, err 28 | } 29 | return ifi, nil 30 | } 31 | 32 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | var mreqn ipMreqn 34 | if ifi != nil { 35 | mreqn.Ifindex = int32(ifi.Index) 36 | } 37 | if grp != nil { 38 | mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} 39 | } 40 | b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn] 41 | return so.Set(c, b) 42 | } 43 | -------------------------------------------------------------------------------- /src/github.com/docopt/docopt-go/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Keith Batten 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/github.com/xtaci/kcp-go/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Daniel Fu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/github.com/klauspost/cpuid/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Klaus Post 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/ruleset.go: -------------------------------------------------------------------------------- 1 | package socks5 2 | 3 | import ( 4 | "golang.org/x/net/context" 5 | ) 6 | 7 | // RuleSet is used to provide custom rules to allow or prohibit actions 8 | type RuleSet interface { 9 | Allow(ctx context.Context, req *Request) (context.Context, bool) 10 | } 11 | 12 | // PermitAll returns a RuleSet which allows all types of connections 13 | func PermitAll() RuleSet { 14 | return &PermitCommand{true, true, true} 15 | } 16 | 17 | // PermitNone returns a RuleSet which disallows all types of connections 18 | func PermitNone() RuleSet { 19 | return &PermitCommand{false, false, false} 20 | } 21 | 22 | // PermitCommand is an implementation of the RuleSet which 23 | // enables filtering supported commands 24 | type PermitCommand struct { 25 | EnableConnect bool 26 | EnableBind bool 27 | EnableAssociate bool 28 | } 29 | 30 | func (p *PermitCommand) Allow(ctx context.Context, req *Request) (context.Context, bool) { 31 | switch req.Command { 32 | case ConnectCommand: 33 | return ctx, p.EnableConnect 34 | case BindCommand: 35 | return ctx, p.EnableBind 36 | case AssociateCommand: 37 | return ctx, p.EnableAssociate 38 | } 39 | 40 | return ctx, false 41 | } 42 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type mmsghdr C.struct_mmsghdr 32 | 33 | type cmsghdr C.struct_cmsghdr 34 | 35 | type sockaddrInet C.struct_sockaddr_in 36 | 37 | type sockaddrInet6 C.struct_sockaddr_in6 38 | 39 | const ( 40 | sizeofIovec = C.sizeof_struct_iovec 41 | sizeofMsghdr = C.sizeof_struct_msghdr 42 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 43 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 44 | 45 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 46 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 47 | ) 48 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Klaus Post 4 | Copyright (c) 2015 Backblaze 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /src/github.com/context/benchmark_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | . "context" 9 | "fmt" 10 | "testing" 11 | ) 12 | 13 | func BenchmarkContextCancelTree(b *testing.B) { 14 | depths := []int{1, 10, 100, 1000} 15 | for _, d := range depths { 16 | b.Run(fmt.Sprintf("depth=%d", d), func(b *testing.B) { 17 | b.Run("Root=Background", func(b *testing.B) { 18 | for i := 0; i < b.N; i++ { 19 | buildContextTree(Background(), d) 20 | } 21 | }) 22 | b.Run("Root=OpenCanceler", func(b *testing.B) { 23 | for i := 0; i < b.N; i++ { 24 | ctx, cancel := WithCancel(Background()) 25 | buildContextTree(ctx, d) 26 | cancel() 27 | } 28 | }) 29 | b.Run("Root=ClosedCanceler", func(b *testing.B) { 30 | for i := 0; i < b.N; i++ { 31 | ctx, cancel := WithCancel(Background()) 32 | cancel() 33 | buildContextTree(ctx, d) 34 | } 35 | }) 36 | }) 37 | } 38 | } 39 | 40 | func buildContextTree(root Context, depth int) { 41 | for d := 0; d < depth; d++ { 42 | root, _ = WithCancel(root) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/control_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | "golang.org/x/net/internal/socket" 16 | ) 17 | 18 | func marshalDst(b []byte, cm *ControlMessage) []byte { 19 | m := socket.ControlMessage(b) 20 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len) 21 | return m.Next(net.IPv4len) 22 | } 23 | 24 | func parseDst(cm *ControlMessage, b []byte) { 25 | if len(cm.Dst) < net.IPv4len { 26 | cm.Dst = make(net.IP, net.IPv4len) 27 | } 28 | copy(cm.Dst, b[:net.IPv4len]) 29 | } 30 | 31 | func marshalInterface(b []byte, cm *ControlMessage) []byte { 32 | m := socket.ControlMessage(b) 33 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink) 34 | return m.Next(syscall.SizeofSockaddrDatalink) 35 | } 36 | 37 | func parseInterface(cm *ControlMessage, b []byte) { 38 | sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0])) 39 | cm.IfIndex = int(sadl.Index) 40 | } 41 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/mmsghdr_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdrs []mmsghdr 12 | 13 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 14 | for i := range hs { 15 | vs := make([]iovec, len(ms[i].Buffers)) 16 | var sa []byte 17 | if parseFn != nil { 18 | sa = make([]byte, sizeofSockaddrInet6) 19 | } 20 | if marshalFn != nil { 21 | sa = marshalFn(ms[i].Addr) 22 | } 23 | hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) 24 | } 25 | return nil 26 | } 27 | 28 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 29 | for i := range hs { 30 | ms[i].N = int(hs[i].Len) 31 | ms[i].NN = hs[i].Hdr.controllen() 32 | ms[i].Flags = hs[i].Hdr.flags() 33 | if parseFn != nil { 34 | var err error 35 | ms[i].Addr, err = parseFn(hs[i].Hdr.name(), hint) 36 | if err != nil { 37 | return err 38 | } 39 | } 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_solaris.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1a 10 | 11 | sysSOCK_RAW = 0x4 12 | ) 13 | 14 | type iovec struct { 15 | Base *int8 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Accrights *int8 27 | Accrightslen int32 28 | Pad_cgo_2 [4]byte 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Family uint16 39 | Port uint16 40 | Addr [4]byte /* in_addr */ 41 | Zero [8]int8 42 | } 43 | 44 | type sockaddrInet6 struct { 45 | Family uint16 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | X__sin6_src_id uint32 51 | } 52 | 53 | const ( 54 | sizeofIovec = 0x10 55 | sizeofMsghdr = 0x30 56 | sizeofCmsghdr = 0xc 57 | 58 | sizeofSockaddrInet = 0x10 59 | sizeofSockaddrInet6 = 0x20 60 | ) 61 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Len uint8 42 | Family uint8 43 | Port uint16 44 | Addr [4]byte /* in_addr */ 45 | Zero [8]int8 46 | } 47 | 48 | type sockaddrInet6 struct { 49 | Len uint8 50 | Family uint8 51 | Port uint16 52 | Flowinfo uint32 53 | Addr [16]byte /* in6_addr */ 54 | Scope_id uint32 55 | } 56 | 57 | const ( 58 | sizeofIovec = 0x8 59 | sizeofMsghdr = 0x1c 60 | sizeofMmsghdr = 0x20 61 | sizeofCmsghdr = 0xc 62 | 63 | sizeofSockaddrInet = 0x10 64 | sizeofSockaddrInet6 = 0x1c 65 | ) 66 | -------------------------------------------------------------------------------- /src/github.com/armon/go-socks5/README.md: -------------------------------------------------------------------------------- 1 | go-socks5 [![Build Status](https://travis-ci.org/armon/go-socks5.png)](https://travis-ci.org/armon/go-socks5) 2 | ========= 3 | 4 | Provides the `socks5` package that implements a [SOCKS5 server](http://en.wikipedia.org/wiki/SOCKS). 5 | SOCKS (Secure Sockets) is used to route traffic between a client and server through 6 | an intermediate proxy layer. This can be used to bypass firewalls or NATs. 7 | 8 | Feature 9 | ======= 10 | 11 | The package has the following features: 12 | * "No Auth" mode 13 | * User/Password authentication 14 | * Support for the CONNECT command 15 | * Rules to do granular filtering of commands 16 | * Custom DNS resolution 17 | * Unit tests 18 | 19 | TODO 20 | ==== 21 | 22 | The package still needs the following: 23 | * Support for the BIND command 24 | * Support for the ASSOCIATE command 25 | 26 | 27 | Example 28 | ======= 29 | 30 | Below is a simple example of usage 31 | 32 | ```go 33 | // Create a SOCKS5 server 34 | conf := &socks5.Config{} 35 | server, err := socks5.New(conf) 36 | if err != nil { 37 | panic(err) 38 | } 39 | 40 | // Create SOCKS5 proxy on localhost port 8000 41 | if err := server.ListenAndServe("tcp", "127.0.0.1:8000"); err != nil { 42 | panic(err) 43 | } 44 | ``` 45 | 46 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/defs_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | #include 15 | 16 | #define _GNU_SOURCE 17 | #include 18 | */ 19 | import "C" 20 | 21 | const ( 22 | sysAF_UNSPEC = C.AF_UNSPEC 23 | sysAF_INET = C.AF_INET 24 | sysAF_INET6 = C.AF_INET6 25 | 26 | sysSOCK_RAW = C.SOCK_RAW 27 | ) 28 | 29 | type iovec C.struct_iovec 30 | 31 | type msghdr C.struct_msghdr 32 | 33 | type mmsghdr C.struct_mmsghdr 34 | 35 | type cmsghdr C.struct_cmsghdr 36 | 37 | type sockaddrInet C.struct_sockaddr_in 38 | 39 | type sockaddrInet6 C.struct_sockaddr_in6 40 | 41 | const ( 42 | sizeofIovec = C.sizeof_struct_iovec 43 | sizeofMsghdr = C.sizeof_struct_msghdr 44 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 45 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 46 | 47 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 48 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 49 | ) 50 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sockopt_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { 17 | return nil, errOpNoSupport 18 | } 19 | 20 | func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { 21 | return errOpNoSupport 22 | } 23 | 24 | func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { 25 | return nil, errOpNoSupport 26 | } 27 | 28 | func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { 29 | return errOpNoSupport 30 | } 31 | 32 | func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | return errOpNoSupport 34 | } 35 | 36 | func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 37 | return errOpNoSupport 38 | } 39 | 40 | func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { 41 | return errOpNoSupport 42 | } 43 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_s390x.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export PATH := $(GOPATH)/bin:$(PATH) 2 | export GO15VENDOREXPERIMENT := 1 3 | 4 | all: fmt build 5 | 6 | build: frps frpc 7 | 8 | # compile assets into binary file 9 | file: 10 | rm -rf ./src/assets/static/* 11 | cp -rf ./src/web/frps/dist/* ./src/assets/static 12 | go get -d github.com/rakyll/statik 13 | go install github.com/rakyll/statik 14 | rm -rf ./src/assets/statik 15 | go generate ./src/assets/... 16 | 17 | fmt: 18 | go fmt ./src/assets/... 19 | go fmt ./src/client/... 20 | go fmt ./src/cmd/... 21 | go fmt ./src/models/... 22 | go fmt ./src/server/... 23 | go fmt ./src/utils/... 24 | 25 | frps: 26 | go build -o bin/frps ./src/cmd/frps 27 | @cp -rf ./src/assets/static ./bin 28 | 29 | frpc: 30 | go build -o bin/frpc ./src/cmd/frpc 31 | 32 | test: gotest 33 | 34 | gotest: 35 | go test -v ./src/assets/... 36 | go test -v ./src/client/... 37 | go test -v ./src/cmd/... 38 | go test -v ./src/models/... 39 | go test -v ./src/server/... 40 | go test -v ./src/utils/... 41 | 42 | alltest: gotest 43 | cd ./src/tests && ./src/run_test.sh && cd - 44 | go test -v ./src/tests/... 45 | cd ./src/tests && ./src/clean_test.sh && cd - 46 | 47 | clean: 48 | rm -f ./bin/frpc 49 | rm -f ./bin/frps 50 | cd ./src/tests && ./src/clean_test.sh && cd - 51 | 52 | save: 53 | godep save ./... 54 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/helper.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "errors" 9 | "net" 10 | ) 11 | 12 | var ( 13 | errMissingAddress = errors.New("missing address") 14 | errMissingHeader = errors.New("missing header") 15 | errHeaderTooShort = errors.New("header too short") 16 | errBufferTooShort = errors.New("buffer too short") 17 | errInvalidConnType = errors.New("invalid conn type") 18 | errOpNoSupport = errors.New("operation not supported") 19 | errNoSuchInterface = errors.New("no such interface") 20 | errNoSuchMulticastInterface = errors.New("no such multicast interface") 21 | 22 | // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. 23 | freebsdVersion uint32 24 | ) 25 | 26 | func boolint(b bool) int { 27 | if b { 28 | return 1 29 | } 30 | return 0 31 | } 32 | 33 | func netAddrToIP4(a net.Addr) net.IP { 34 | switch v := a.(type) { 35 | case *net.UDPAddr: 36 | if ip := v.IP.To4(); ip != nil { 37 | return ip 38 | } 39 | case *net.IPAddr: 40 | if ip := v.IP.To4(); ip != nil { 41 | return ip 42 | } 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint32 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Addr [4]byte /* in_addr */ 48 | Zero [8]int8 49 | } 50 | 51 | type sockaddrInet6 struct { 52 | Len uint8 53 | Family uint8 54 | Port uint16 55 | Flowinfo uint32 56 | Addr [16]byte /* in6_addr */ 57 | Scope_id uint32 58 | } 59 | 60 | const ( 61 | sizeofIovec = 0x10 62 | sizeofMsghdr = 0x30 63 | sizeofMmsghdr = 0x40 64 | sizeofCmsghdr = 0xc 65 | 66 | sizeofSockaddrInet = 0x10 67 | sizeofSockaddrInet6 = 0x1c 68 | ) 69 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux,!s390x,!386 netbsd openbsd 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 15 | l := uint32(len(b)) 16 | _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 17 | return int(l), errnoErr(errno) 18 | } 19 | 20 | func setsockopt(s uintptr, level, name int, b []byte) error { 21 | _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 22 | return errnoErr(errno) 23 | } 24 | 25 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 26 | n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 27 | return int(n), errnoErr(errno) 28 | } 29 | 30 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 31 | n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 32 | return int(n), errnoErr(errno) 33 | } 34 | -------------------------------------------------------------------------------- /src/utils/pool/buf_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pool 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/stretchr/testify/assert" 21 | ) 22 | 23 | func TestPutBuf(t *testing.T) { 24 | buf := make([]byte, 512) 25 | PutBuf(buf) 26 | 27 | buf = make([]byte, 1025) 28 | PutBuf(buf) 29 | 30 | buf = make([]byte, 2*1025) 31 | PutBuf(buf) 32 | 33 | buf = make([]byte, 5*1025) 34 | PutBuf(buf) 35 | } 36 | 37 | func TestGetBuf(t *testing.T) { 38 | assert := assert.New(t) 39 | 40 | buf := GetBuf(200) 41 | assert.Len(buf, 200) 42 | 43 | buf = GetBuf(1025) 44 | assert.Len(buf, 1025) 45 | 46 | buf = GetBuf(2 * 1024) 47 | assert.Len(buf, 2*1024) 48 | 49 | buf = GetBuf(5 * 2000) 50 | assert.Len(buf, 5*2000) 51 | } 52 | -------------------------------------------------------------------------------- /src/github.com/xtaci/smux/frame.go: -------------------------------------------------------------------------------- 1 | package smux 2 | 3 | import ( 4 | "encoding/binary" 5 | "fmt" 6 | ) 7 | 8 | const ( 9 | version = 1 10 | ) 11 | 12 | const ( // cmds 13 | cmdSYN byte = iota // stream open 14 | cmdFIN // stream close, a.k.a EOF mark 15 | cmdPSH // data push 16 | cmdNOP // no operation 17 | ) 18 | 19 | const ( 20 | sizeOfVer = 1 21 | sizeOfCmd = 1 22 | sizeOfLength = 2 23 | sizeOfSid = 4 24 | headerSize = sizeOfVer + sizeOfCmd + sizeOfSid + sizeOfLength 25 | ) 26 | 27 | // Frame defines a packet from or to be multiplexed into a single connection 28 | type Frame struct { 29 | ver byte 30 | cmd byte 31 | sid uint32 32 | data []byte 33 | } 34 | 35 | func newFrame(cmd byte, sid uint32) Frame { 36 | return Frame{ver: version, cmd: cmd, sid: sid} 37 | } 38 | 39 | type rawHeader []byte 40 | 41 | func (h rawHeader) Version() byte { 42 | return h[0] 43 | } 44 | 45 | func (h rawHeader) Cmd() byte { 46 | return h[1] 47 | } 48 | 49 | func (h rawHeader) Length() uint16 { 50 | return binary.LittleEndian.Uint16(h[2:]) 51 | } 52 | 53 | func (h rawHeader) StreamID() uint32 { 54 | return binary.LittleEndian.Uint32(h[4:]) 55 | } 56 | 57 | func (h rawHeader) String() string { 58 | return fmt.Sprintf("Version:%d Cmd:%d StreamID:%d Length:%d", 59 | h.Version(), h.Cmd(), h.StreamID(), h.Length()) 60 | } 61 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/iana.go: -------------------------------------------------------------------------------- 1 | // go generate gen.go 2 | // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT 3 | 4 | package ipv4 5 | 6 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19 7 | const ( 8 | ICMPTypeEchoReply ICMPType = 0 // Echo Reply 9 | ICMPTypeDestinationUnreachable ICMPType = 3 // Destination Unreachable 10 | ICMPTypeRedirect ICMPType = 5 // Redirect 11 | ICMPTypeEcho ICMPType = 8 // Echo 12 | ICMPTypeRouterAdvertisement ICMPType = 9 // Router Advertisement 13 | ICMPTypeRouterSolicitation ICMPType = 10 // Router Solicitation 14 | ICMPTypeTimeExceeded ICMPType = 11 // Time Exceeded 15 | ICMPTypeParameterProblem ICMPType = 12 // Parameter Problem 16 | ICMPTypeTimestamp ICMPType = 13 // Timestamp 17 | ICMPTypeTimestampReply ICMPType = 14 // Timestamp Reply 18 | ICMPTypePhoturis ICMPType = 40 // Photuris 19 | ) 20 | 21 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19 22 | var icmpTypes = map[ICMPType]string{ 23 | 0: "echo reply", 24 | 3: "destination unreachable", 25 | 5: "redirect", 26 | 8: "echo", 27 | 9: "router advertisement", 28 | 10: "router solicitation", 29 | 11: "time exceeded", 30 | 12: "parameter problem", 31 | 13: "timestamp", 32 | 14: "timestamp reply", 33 | 40: "photuris", 34 | } 35 | -------------------------------------------------------------------------------- /src/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /src/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/payload_cmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !nacl,!plan9,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | ) 13 | 14 | // ReadFrom reads a payload of the received IPv4 datagram, from the 15 | // endpoint c, copying the payload into b. It returns the number of 16 | // bytes copied into b, the control message cm and the source address 17 | // src of the received datagram. 18 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 19 | if !c.ok() { 20 | return 0, nil, nil, syscall.EINVAL 21 | } 22 | return c.readFrom(b) 23 | } 24 | 25 | // WriteTo writes a payload of the IPv4 datagram, to the destination 26 | // address dst through the endpoint c, copying the payload from b. It 27 | // returns the number of bytes written. The control message cm allows 28 | // the datagram path and the outgoing interface to be specified. 29 | // Currently only Darwin and Linux support this. The cm may be nil if 30 | // control of the outgoing datagram is not required. 31 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 32 | if !c.ok() { 33 | return 0, syscall.EINVAL 34 | } 35 | return c.writeTo(b, cm, dst) 36 | } 37 | -------------------------------------------------------------------------------- /src/assets/static/manifest.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,l=0,s=[];l 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /src/models/plugin/plugin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package plugin 16 | 17 | import ( 18 | "fmt" 19 | "io" 20 | ) 21 | 22 | // Creators is used for create plugins to handle connections. 23 | var creators = make(map[string]CreatorFn) 24 | 25 | // params has prefix "plugin_" 26 | type CreatorFn func(params map[string]string) (Plugin, error) 27 | 28 | func Register(name string, fn CreatorFn) { 29 | creators[name] = fn 30 | } 31 | 32 | func Create(name string, params map[string]string) (p Plugin, err error) { 33 | if fn, ok := creators[name]; ok { 34 | p, err = fn(params) 35 | } else { 36 | err = fmt.Errorf("plugin [%s] is not registered", name) 37 | } 38 | return 39 | } 40 | 41 | type Plugin interface { 42 | Name() string 43 | Handle(conn io.ReadWriteCloser) 44 | Close() error 45 | } 46 | -------------------------------------------------------------------------------- /src/golang.org/x/net/bpf/asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | import "fmt" 8 | 9 | // Assemble converts insts into raw instructions suitable for loading 10 | // into a BPF virtual machine. 11 | // 12 | // Currently, no optimization is attempted, the assembled program flow 13 | // is exactly as provided. 14 | func Assemble(insts []Instruction) ([]RawInstruction, error) { 15 | ret := make([]RawInstruction, len(insts)) 16 | var err error 17 | for i, inst := range insts { 18 | ret[i], err = inst.Assemble() 19 | if err != nil { 20 | return nil, fmt.Errorf("assembling instruction %d: %s", i+1, err) 21 | } 22 | } 23 | return ret, nil 24 | } 25 | 26 | // Disassemble attempts to parse raw back into 27 | // Instructions. Unrecognized RawInstructions are assumed to be an 28 | // extension not implemented by this package, and are passed through 29 | // unchanged to the output. The allDecoded value reports whether insts 30 | // contains no RawInstructions. 31 | func Disassemble(raw []RawInstruction) (insts []Instruction, allDecoded bool) { 32 | insts = make([]Instruction, len(raw)) 33 | allDecoded = true 34 | for i, r := range raw { 35 | insts[i] = r.Disassemble() 36 | if _, ok := insts[i].(RawInstruction); ok { 37 | allDecoded = false 38 | } 39 | } 40 | return insts, allDecoded 41 | } 42 | -------------------------------------------------------------------------------- /src/web/frps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frps-dashboard", 3 | "description": "A dashboard for frp server.", 4 | "author": "fatedier", 5 | "private": true, 6 | "scripts": { 7 | "dev": "webpack-dev-server -d --inline --hot --env.dev", 8 | "build": "rimraf dist && webpack -p --progress --hide-modules" 9 | }, 10 | "dependencies": { 11 | "bootstrap": "^3.3.7", 12 | "echarts": "^3.5.0", 13 | "element-ui": "^1.2.5", 14 | "humanize-plus": "^1.8.2", 15 | "vue": "^2.2.4", 16 | "vue-resource": "^1.2.1", 17 | "vue-router": "^2.3.0", 18 | "whatwg-fetch": "^2.0.3" 19 | }, 20 | "engines": { 21 | "node": ">=6" 22 | }, 23 | "devDependencies": { 24 | "autoprefixer": "^6.6.0", 25 | "babel-core": "^6.21.0", 26 | "babel-eslint": "^7.1.1", 27 | "babel-loader": "^6.4.0", 28 | "babel-preset-es2015": "^6.13.2", 29 | "css-loader": "^0.27.0", 30 | "eslint": "^3.12.2", 31 | "eslint-config-enough": "^0.2.2", 32 | "eslint-loader": "^1.6.3", 33 | "file-loader": "^0.10.1", 34 | "html-loader": "^0.4.5", 35 | "html-webpack-plugin": "^2.24.1", 36 | "less": "^2.7.2", 37 | "less-loader": "^3.0.0", 38 | "postcss-loader": "^1.3.3", 39 | "rimraf": "^2.5.4", 40 | "style-loader": "^0.13.2", 41 | "url-loader": "^0.5.8", 42 | "vue-loader": "^11.1.4", 43 | "vue-template-compiler": "^2.1.8", 44 | "webpack": "^2.2.0-rc.4", 45 | "webpack-dev-server": "beta" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/packet_go1_8.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | func (c *packetHandler) readFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) { 12 | c.rawOpt.RLock() 13 | oob := NewControlMessage(c.rawOpt.cflags) 14 | c.rawOpt.RUnlock() 15 | n, nn, _, src, err := c.ReadMsgIP(b, oob) 16 | if err != nil { 17 | return nil, nil, nil, err 18 | } 19 | var hs []byte 20 | if hs, p, err = slicePacket(b[:n]); err != nil { 21 | return nil, nil, nil, err 22 | } 23 | if h, err = ParseHeader(hs); err != nil { 24 | return nil, nil, nil, err 25 | } 26 | if nn > 0 { 27 | cm = new(ControlMessage) 28 | if err := cm.Parse(oob[:nn]); err != nil { 29 | return nil, nil, nil, err 30 | } 31 | } 32 | if src != nil && cm != nil { 33 | cm.Src = src.IP 34 | } 35 | return 36 | } 37 | 38 | func (c *packetHandler) writeTo(h *Header, p []byte, cm *ControlMessage) error { 39 | oob := cm.Marshal() 40 | wh, err := h.Marshal() 41 | if err != nil { 42 | return err 43 | } 44 | dst := new(net.IPAddr) 45 | if cm != nil { 46 | if ip := cm.Dst.To4(); ip != nil { 47 | dst.IP = ip 48 | } 49 | } 50 | if dst.IP == nil { 51 | dst.IP = h.Dst 52 | } 53 | wh = append(wh, p...) 54 | _, _, err = c.WriteMsgIP(wh, oob, dst) 55 | return err 56 | } 57 | -------------------------------------------------------------------------------- /src/github.com/fatedier/beego/logs/README.md: -------------------------------------------------------------------------------- 1 | ## logs 2 | logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` . 3 | 4 | 5 | ## How to install? 6 | 7 | go get github.com/astaxie/beego/logs 8 | 9 | 10 | ## What adapters are supported? 11 | 12 | As of now this logs support console, file,smtp and conn. 13 | 14 | 15 | ## How to use it? 16 | 17 | First you must import it 18 | 19 | import ( 20 | "github.com/astaxie/beego/logs" 21 | ) 22 | 23 | Then init a Log (example with console adapter) 24 | 25 | log := NewLogger(10000) 26 | log.SetLogger("console", "") 27 | 28 | > the first params stand for how many channel 29 | 30 | Use it like this: 31 | 32 | log.Trace("trace") 33 | log.Info("info") 34 | log.Warn("warning") 35 | log.Debug("debug") 36 | log.Critical("critical") 37 | 38 | 39 | ## File adapter 40 | 41 | Configure file adapter like this: 42 | 43 | log := NewLogger(10000) 44 | log.SetLogger("file", `{"filename":"test.log"}`) 45 | 46 | 47 | ## Conn adapter 48 | 49 | Configure like this: 50 | 51 | log := NewLogger(1000) 52 | log.SetLogger("conn", `{"net":"tcp","addr":":7020"}`) 53 | log.Info("info") 54 | 55 | 56 | ## Smtp adapter 57 | 58 | Configure like this: 59 | 60 | log := NewLogger(10000) 61 | log.SetLogger("smtp", `{"username":"beegotest@gmail.com","password":"xxxxxxxx","host":"smtp.gmail.com:587","sendTos":["xiemengjun@gmail.com"]}`) 62 | log.Critical("sendmail critical") 63 | time.Sleep(time.Second * 30) 64 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/genericopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import "syscall" 8 | 9 | // TOS returns the type-of-service field value for outgoing packets. 10 | func (c *genericOpt) TOS() (int, error) { 11 | if !c.ok() { 12 | return 0, syscall.EINVAL 13 | } 14 | so, ok := sockOpts[ssoTOS] 15 | if !ok { 16 | return 0, errOpNoSupport 17 | } 18 | return so.GetInt(c.Conn) 19 | } 20 | 21 | // SetTOS sets the type-of-service field value for future outgoing 22 | // packets. 23 | func (c *genericOpt) SetTOS(tos int) error { 24 | if !c.ok() { 25 | return syscall.EINVAL 26 | } 27 | so, ok := sockOpts[ssoTOS] 28 | if !ok { 29 | return errOpNoSupport 30 | } 31 | return so.SetInt(c.Conn, tos) 32 | } 33 | 34 | // TTL returns the time-to-live field value for outgoing packets. 35 | func (c *genericOpt) TTL() (int, error) { 36 | if !c.ok() { 37 | return 0, syscall.EINVAL 38 | } 39 | so, ok := sockOpts[ssoTTL] 40 | if !ok { 41 | return 0, errOpNoSupport 42 | } 43 | return so.GetInt(c.Conn) 44 | } 45 | 46 | // SetTTL sets the time-to-live field value for future outgoing 47 | // packets. 48 | func (c *genericOpt) SetTTL(ttl int) error { 49 | if !c.ok() { 50 | return syscall.EINVAL 51 | } 52 | so, ok := sockOpts[ssoTTL] 53 | if !ok { 54 | return errOpNoSupport 55 | } 56 | return so.SetInt(c.Conn, ttl) 57 | } 58 | -------------------------------------------------------------------------------- /src/github.com/vaughan0/go-ini/README.md: -------------------------------------------------------------------------------- 1 | go-ini 2 | ====== 3 | 4 | INI parsing library for Go (golang). 5 | 6 | View the API documentation [here](http://godoc.org/github.com/vaughan0/go-ini). 7 | 8 | Usage 9 | ----- 10 | 11 | Parse an INI file: 12 | 13 | ```go 14 | import "github.com/vaughan0/go-ini" 15 | 16 | file, err := ini.LoadFile("myfile.ini") 17 | ``` 18 | 19 | Get data from the parsed file: 20 | 21 | ```go 22 | name, ok := file.Get("person", "name") 23 | if !ok { 24 | panic("'name' variable missing from 'person' section") 25 | } 26 | ``` 27 | 28 | Iterate through values in a section: 29 | 30 | ```go 31 | for key, value := range file["mysection"] { 32 | fmt.Printf("%s => %s\n", key, value) 33 | } 34 | ``` 35 | 36 | Iterate through sections in a file: 37 | 38 | ```go 39 | for name, section := range file { 40 | fmt.Printf("Section name: %s\n", name) 41 | } 42 | ``` 43 | 44 | File Format 45 | ----------- 46 | 47 | INI files are parsed by go-ini line-by-line. Each line may be one of the following: 48 | 49 | * A section definition: [section-name] 50 | * A property: key = value 51 | * A comment: #blahblah _or_ ;blahblah 52 | * Blank. The line will be ignored. 53 | 54 | Properties defined before any section headers are placed in the default section, which has 55 | the empty string as it's key. 56 | 57 | Example: 58 | 59 | ```ini 60 | # I am a comment 61 | ; So am I! 62 | 63 | [apples] 64 | colour = red or green 65 | shape = applish 66 | 67 | [oranges] 68 | shape = square 69 | colour = blue 70 | ``` 71 | -------------------------------------------------------------------------------- /src/utils/shutdown/shutdown.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package shutdown 16 | 17 | import ( 18 | "sync" 19 | ) 20 | 21 | type Shutdown struct { 22 | doing bool 23 | ending bool 24 | start chan struct{} 25 | down chan struct{} 26 | mu sync.Mutex 27 | } 28 | 29 | func New() *Shutdown { 30 | return &Shutdown{ 31 | doing: false, 32 | ending: false, 33 | start: make(chan struct{}), 34 | down: make(chan struct{}), 35 | } 36 | } 37 | 38 | func (s *Shutdown) Start() { 39 | s.mu.Lock() 40 | defer s.mu.Unlock() 41 | if !s.doing { 42 | s.doing = true 43 | close(s.start) 44 | } 45 | } 46 | 47 | func (s *Shutdown) WaitStart() { 48 | <-s.start 49 | } 50 | 51 | func (s *Shutdown) Done() { 52 | s.mu.Lock() 53 | defer s.mu.Unlock() 54 | if !s.ending { 55 | s.ending = true 56 | close(s.down) 57 | } 58 | } 59 | 60 | func (s *Shutdown) WaitDown() { 61 | <-s.down 62 | } 63 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/sys_ssmreq.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | var freebsd32o64 bool 17 | 18 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 19 | var gr groupReq 20 | if ifi != nil { 21 | gr.Interface = uint32(ifi.Index) 22 | } 23 | gr.setGroup(grp) 24 | var b []byte 25 | if freebsd32o64 { 26 | var d [sizeofGroupReq + 4]byte 27 | s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) 28 | copy(d[:4], s[:4]) 29 | copy(d[8:], s[4:]) 30 | b = d[:] 31 | } else { 32 | b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] 33 | } 34 | return so.Set(c, b) 35 | } 36 | 37 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 38 | var gsr groupSourceReq 39 | if ifi != nil { 40 | gsr.Interface = uint32(ifi.Index) 41 | } 42 | gsr.setSourceGroup(grp, src) 43 | var b []byte 44 | if freebsd32o64 { 45 | var d [sizeofGroupSourceReq + 4]byte 46 | s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) 47 | copy(d[:4], s[:4]) 48 | copy(d[8:], s[4:]) 49 | b = d[:] 50 | } else { 51 | b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] 52 | } 53 | return so.Set(c, b) 54 | } 55 | -------------------------------------------------------------------------------- /src/utils/pool/snappy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pool 16 | 17 | import ( 18 | "io" 19 | "sync" 20 | 21 | "github.com/golang/snappy" 22 | ) 23 | 24 | var ( 25 | snappyReaderPool sync.Pool 26 | snappyWriterPool sync.Pool 27 | ) 28 | 29 | func GetSnappyReader(r io.Reader) *snappy.Reader { 30 | var x interface{} 31 | x = snappyReaderPool.Get() 32 | if x == nil { 33 | return snappy.NewReader(r) 34 | } 35 | sr := x.(*snappy.Reader) 36 | sr.Reset(r) 37 | return sr 38 | } 39 | 40 | func PutSnappyReader(sr *snappy.Reader) { 41 | snappyReaderPool.Put(sr) 42 | } 43 | 44 | func GetSnappyWriter(w io.Writer) *snappy.Writer { 45 | var x interface{} 46 | x = snappyWriterPool.Get() 47 | if x == nil { 48 | return snappy.NewWriter(w) 49 | } 50 | sw := x.(*snappy.Writer) 51 | sw.Reset(w) 52 | return sw 53 | } 54 | 55 | func PutSnappyWriter(sw *snappy.Writer) { 56 | snappyWriterPool.Put(sw) 57 | } 58 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/payload_nocmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build nacl plan9 windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | ) 13 | 14 | // ReadFrom reads a payload of the received IPv4 datagram, from the 15 | // endpoint c, copying the payload into b. It returns the number of 16 | // bytes copied into b, the control message cm and the source address 17 | // src of the received datagram. 18 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 19 | if !c.ok() { 20 | return 0, nil, nil, syscall.EINVAL 21 | } 22 | if n, src, err = c.PacketConn.ReadFrom(b); err != nil { 23 | return 0, nil, nil, err 24 | } 25 | return 26 | } 27 | 28 | // WriteTo writes a payload of the IPv4 datagram, to the destination 29 | // address dst through the endpoint c, copying the payload from b. It 30 | // returns the number of bytes written. The control message cm allows 31 | // the datagram path and the outgoing interface to be specified. 32 | // Currently only Darwin and Linux support this. The cm may be nil if 33 | // control of the outgoing datagram is not required. 34 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 35 | if !c.ok() { 36 | return 0, syscall.EINVAL 37 | } 38 | if dst == nil { 39 | return 0, errMissingAddress 40 | } 41 | return c.PacketConn.WriteTo(b, dst) 42 | } 43 | -------------------------------------------------------------------------------- /src/github.com/julienschmidt/httprouter/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Julien Schmidt. All rights reserved. 2 | 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * The names of the contributors may not be used to endorse or promote 12 | products derived from this software without specific prior written 13 | permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL JULIEN SCHMIDT BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /src/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/utils/crypto/crypto_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package crypto 16 | 17 | import ( 18 | "bytes" 19 | "io" 20 | "testing" 21 | 22 | "github.com/stretchr/testify/assert" 23 | ) 24 | 25 | func TestCrypto(t *testing.T) { 26 | assert := assert.New(t) 27 | 28 | text := "1234567890abcdefghigklmnopqrstuvwxyzeeeeeeeeeeeeeeeeeeeeeewwwwwwwwwwwwwwwwwwwwwwwwwwzzzzzzzzzzzzzzzzzzzzzzzzdddddddddddddddddddddddddddddddddddddrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrllllllllllllllllllllllllllllllllllqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeewwwwwwwwwwwwwwwwwwwwww" 29 | key := "123456" 30 | 31 | buffer := bytes.NewBuffer(nil) 32 | encWriter, err := NewWriter(buffer, []byte(key)) 33 | assert.NoError(err) 34 | decReader := NewReader(buffer, []byte(key)) 35 | 36 | encWriter.Write([]byte(text)) 37 | 38 | c := bytes.NewBuffer(nil) 39 | io.Copy(c, decReader) 40 | assert.Equal(text, string(c.Bytes())) 41 | } 42 | -------------------------------------------------------------------------------- /src/utils/metric/counter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package metric 16 | 17 | import ( 18 | "sync/atomic" 19 | ) 20 | 21 | type Counter interface { 22 | Count() int64 23 | Inc(int64) 24 | Dec(int64) 25 | Snapshot() Counter 26 | Clear() 27 | } 28 | 29 | func NewCounter() Counter { 30 | return &StandardCounter{ 31 | count: 0, 32 | } 33 | } 34 | 35 | type StandardCounter struct { 36 | count int64 37 | } 38 | 39 | func (c *StandardCounter) Count() int64 { 40 | return atomic.LoadInt64(&c.count) 41 | } 42 | 43 | func (c *StandardCounter) Inc(count int64) { 44 | atomic.AddInt64(&c.count, count) 45 | } 46 | 47 | func (c *StandardCounter) Dec(count int64) { 48 | atomic.AddInt64(&c.count, -count) 49 | } 50 | 51 | func (c *StandardCounter) Snapshot() Counter { 52 | tmp := &StandardCounter{ 53 | count: atomic.LoadInt64(&c.count), 54 | } 55 | return tmp 56 | } 57 | 58 | func (c *StandardCounter) Clear() { 59 | atomic.StoreInt64(&c.count, 0) 60 | } 61 | -------------------------------------------------------------------------------- /src/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/github.com/golang/snappy/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the Snappy-Go repository. 3 | # The AUTHORS file lists the copyright holders; this file 4 | # lists people. For example, Google employees are listed here 5 | # but not in AUTHORS, because Google holds the copyright. 6 | # 7 | # The submission process automatically checks to make sure 8 | # that people submitting code are listed in this file (by email address). 9 | # 10 | # Names should be added to this file only after verifying that 11 | # the individual or the individual's organization has agreed to 12 | # the appropriate Contributor License Agreement, found here: 13 | # 14 | # http://code.google.com/legal/individual-cla-v1.0.html 15 | # http://code.google.com/legal/corporate-cla-v1.0.html 16 | # 17 | # The agreement for individuals can be filled out on the web. 18 | # 19 | # When adding J Random Contributor's name to this file, 20 | # either J's name or J's organization's name should be 21 | # added to the AUTHORS file, depending on whether the 22 | # individual or corporate CLA was used. 23 | 24 | # Names should be added to this file like so: 25 | # Name 26 | 27 | # Please keep the list sorted. 28 | 29 | Damian Gryski 30 | Jan Mercl <0xjnml@gmail.com> 31 | Kai Backman 32 | Marc-Antoine Ruel 33 | Nigel Tao 34 | Rob Pike 35 | Rodolfo Carvalho 36 | Russ Cox 37 | Sebastien Binet 38 | -------------------------------------------------------------------------------- /src/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // import ( 7 | // "testing" 8 | // "github.com/stretchr/testify/assert" 9 | // ) 10 | // 11 | // func TestSomething(t *testing.T) { 12 | // 13 | // var a string = "Hello" 14 | // var b string = "Hello" 15 | // 16 | // assert.Equal(t, a, b, "The two words should be the same.") 17 | // 18 | // } 19 | // 20 | // if you assert many times, use the format below: 21 | // 22 | // import ( 23 | // "testing" 24 | // "github.com/stretchr/testify/assert" 25 | // ) 26 | // 27 | // func TestSomething(t *testing.T) { 28 | // assert := assert.New(t) 29 | // 30 | // var a string = "Hello" 31 | // var b string = "Hello" 32 | // 33 | // assert.Equal(a, b, "The two words should be the same.") 34 | // } 35 | // 36 | // Assertions 37 | // 38 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 39 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 40 | // testing framework. This allows the assertion funcs to write the failings and other details to 41 | // the correct place. 42 | // 43 | // Every assertion function also takes an optional string message as the final argument, 44 | // allowing custom error messages to be appended to the message the assertion method outputs. 45 | package assert 46 | -------------------------------------------------------------------------------- /src/github.com/golang/snappy/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/reflect.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.9 6 | 7 | package socket 8 | 9 | import ( 10 | "errors" 11 | "net" 12 | "os" 13 | "reflect" 14 | "runtime" 15 | ) 16 | 17 | // A Conn represents a raw connection. 18 | type Conn struct { 19 | c net.Conn 20 | } 21 | 22 | // NewConn returns a new raw connection. 23 | func NewConn(c net.Conn) (*Conn, error) { 24 | return &Conn{c: c}, nil 25 | } 26 | 27 | func (o *Option) get(c *Conn, b []byte) (int, error) { 28 | s, err := socketOf(c.c) 29 | if err != nil { 30 | return 0, err 31 | } 32 | n, err := getsockopt(s, o.Level, o.Name, b) 33 | return n, os.NewSyscallError("getsockopt", err) 34 | } 35 | 36 | func (o *Option) set(c *Conn, b []byte) error { 37 | s, err := socketOf(c.c) 38 | if err != nil { 39 | return err 40 | } 41 | return os.NewSyscallError("setsockopt", setsockopt(s, o.Level, o.Name, b)) 42 | } 43 | 44 | func socketOf(c net.Conn) (uintptr, error) { 45 | switch c.(type) { 46 | case *net.TCPConn, *net.UDPConn, *net.IPConn: 47 | v := reflect.ValueOf(c) 48 | switch e := v.Elem(); e.Kind() { 49 | case reflect.Struct: 50 | fd := e.FieldByName("conn").FieldByName("fd") 51 | switch e := fd.Elem(); e.Kind() { 52 | case reflect.Struct: 53 | sysfd := e.FieldByName("sysfd") 54 | if runtime.GOOS == "windows" { 55 | return uintptr(sysfd.Uint()), nil 56 | } 57 | return uintptr(sysfd.Int()), nil 58 | } 59 | } 60 | } 61 | return 0, errors.New("invalid type") 62 | } 63 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/rawconn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | 7 | package socket 8 | 9 | import ( 10 | "errors" 11 | "net" 12 | "os" 13 | "syscall" 14 | ) 15 | 16 | // A Conn represents a raw connection. 17 | type Conn struct { 18 | network string 19 | c syscall.RawConn 20 | } 21 | 22 | // NewConn returns a new raw connection. 23 | func NewConn(c net.Conn) (*Conn, error) { 24 | var err error 25 | var cc Conn 26 | switch c := c.(type) { 27 | case *net.TCPConn: 28 | cc.network = "tcp" 29 | cc.c, err = c.SyscallConn() 30 | case *net.UDPConn: 31 | cc.network = "udp" 32 | cc.c, err = c.SyscallConn() 33 | case *net.IPConn: 34 | cc.network = "ip" 35 | cc.c, err = c.SyscallConn() 36 | default: 37 | return nil, errors.New("unknown connection type") 38 | } 39 | if err != nil { 40 | return nil, err 41 | } 42 | return &cc, nil 43 | } 44 | 45 | func (o *Option) get(c *Conn, b []byte) (int, error) { 46 | var operr error 47 | var n int 48 | fn := func(s uintptr) { 49 | n, operr = getsockopt(s, o.Level, o.Name, b) 50 | } 51 | if err := c.c.Control(fn); err != nil { 52 | return 0, err 53 | } 54 | return n, os.NewSyscallError("getsockopt", operr) 55 | } 56 | 57 | func (o *Option) set(c *Conn, b []byte) error { 58 | var operr error 59 | fn := func(s uintptr) { 60 | operr = setsockopt(s, o.Level, o.Name, b) 61 | } 62 | if err := c.c.Control(fn); err != nil { 63 | return err 64 | } 65 | return os.NewSyscallError("setsockopt", operr) 66 | } 67 | -------------------------------------------------------------------------------- /src/golang.org/x/net/internal/socket/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package socket 8 | 9 | import ( 10 | "errors" 11 | "net" 12 | "runtime" 13 | "unsafe" 14 | ) 15 | 16 | const ( 17 | sysAF_UNSPEC = 0x0 18 | sysAF_INET = 0x2 19 | sysAF_INET6 = 0xa 20 | 21 | sysSOCK_RAW = 0x3 22 | ) 23 | 24 | func probeProtocolStack() int { 25 | switch runtime.GOARCH { 26 | case "amd64p32", "mips64p32": 27 | return 4 28 | default: 29 | var p uintptr 30 | return int(unsafe.Sizeof(p)) 31 | } 32 | } 33 | 34 | func marshalInetAddr(ip net.IP, port int, zone string) []byte { 35 | return nil 36 | } 37 | 38 | func parseInetAddr(b []byte, network string) (net.Addr, error) { 39 | return nil, errors.New("not implemented") 40 | } 41 | 42 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 43 | return 0, errors.New("not implemented") 44 | } 45 | 46 | func setsockopt(s uintptr, level, name int, b []byte) error { 47 | return errors.New("not implemented") 48 | } 49 | 50 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 51 | return 0, errors.New("not implemented") 52 | } 53 | 54 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 55 | return 0, errors.New("not implemented") 56 | } 57 | 58 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 59 | return 0, errors.New("not implemented") 60 | } 61 | 62 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 63 | return 0, errors.New("not implemented") 64 | } 65 | -------------------------------------------------------------------------------- /src/github.com/fatedier/beego/logs/slack.go: -------------------------------------------------------------------------------- 1 | package logs 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "net/http" 7 | "net/url" 8 | "time" 9 | ) 10 | 11 | // SLACKWriter implements beego LoggerInterface and is used to send jiaoliao webhook 12 | type SLACKWriter struct { 13 | WebhookURL string `json:"webhookurl"` 14 | Level int `json:"level"` 15 | } 16 | 17 | // newSLACKWriter create jiaoliao writer. 18 | func newSLACKWriter() Logger { 19 | return &SLACKWriter{Level: LevelTrace} 20 | } 21 | 22 | // Init SLACKWriter with json config string 23 | func (s *SLACKWriter) Init(jsonconfig string) error { 24 | err := json.Unmarshal([]byte(jsonconfig), s) 25 | if err != nil { 26 | return err 27 | } 28 | return nil 29 | } 30 | 31 | // WriteMsg write message in smtp writer. 32 | // it will send an email with subject and only this message. 33 | func (s *SLACKWriter) WriteMsg(when time.Time, msg string, level int) error { 34 | if level > s.Level { 35 | return nil 36 | } 37 | 38 | text := fmt.Sprintf("{\"text\": \"%s %s\"}", when.Format("2006-01-02 15:04:05"), msg) 39 | 40 | form := url.Values{} 41 | form.Add("payload", text) 42 | 43 | resp, err := http.PostForm(s.WebhookURL, form) 44 | if err != nil { 45 | return err 46 | } 47 | defer resp.Body.Close() 48 | if resp.StatusCode != http.StatusOK { 49 | return fmt.Errorf("Post webhook failed %s %d", resp.Status, resp.StatusCode) 50 | } 51 | return nil 52 | } 53 | 54 | // Flush implementing method. empty. 55 | func (s *SLACKWriter) Flush() { 56 | return 57 | } 58 | 59 | // Destroy implementing method. empty. 60 | func (s *SLACKWriter) Destroy() { 61 | return 62 | } 63 | 64 | func init() { 65 | Register(AdapterSlack, newSLACKWriter) 66 | } 67 | -------------------------------------------------------------------------------- /src/utils/pool/buf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pool 16 | 17 | import "sync" 18 | 19 | var ( 20 | bufPool16k sync.Pool 21 | bufPool5k sync.Pool 22 | bufPool2k sync.Pool 23 | bufPool1k sync.Pool 24 | bufPool sync.Pool 25 | ) 26 | 27 | func GetBuf(size int) []byte { 28 | var x interface{} 29 | if size >= 16*1024 { 30 | x = bufPool16k.Get() 31 | } else if size >= 5*1024 { 32 | x = bufPool5k.Get() 33 | } else if size >= 2*1024 { 34 | x = bufPool2k.Get() 35 | } else if size >= 1*1024 { 36 | x = bufPool1k.Get() 37 | } else { 38 | x = bufPool.Get() 39 | } 40 | if x == nil { 41 | return make([]byte, size) 42 | } 43 | buf := x.([]byte) 44 | if cap(buf) < size { 45 | return make([]byte, size) 46 | } 47 | return buf[:size] 48 | } 49 | 50 | func PutBuf(buf []byte) { 51 | size := cap(buf) 52 | if size >= 16*1024 { 53 | bufPool16k.Put(buf) 54 | } else if size >= 5*1024 { 55 | bufPool5k.Put(buf) 56 | } else if size >= 2*1024 { 57 | bufPool2k.Put(buf) 58 | } else if size >= 1*1024 { 59 | bufPool1k.Put(buf) 60 | } else { 61 | bufPool.Put(buf) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/tests/echo_server.go: -------------------------------------------------------------------------------- 1 | package tests 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "io" 7 | "net" 8 | "os" 9 | "syscall" 10 | 11 | frpNet "utils/net" 12 | ) 13 | 14 | func StartEchoServer() { 15 | l, err := frpNet.ListenTcp("127.0.0.1", 10701) 16 | if err != nil { 17 | fmt.Printf("echo server listen error: %v\n", err) 18 | return 19 | } 20 | 21 | for { 22 | c, err := l.Accept() 23 | if err != nil { 24 | fmt.Printf("echo server accept error: %v\n", err) 25 | return 26 | } 27 | 28 | go echoWorker(c) 29 | } 30 | } 31 | 32 | func StartUdpEchoServer() { 33 | l, err := frpNet.ListenUDP("127.0.0.1", 10703) 34 | if err != nil { 35 | fmt.Printf("udp echo server listen error: %v\n", err) 36 | return 37 | } 38 | 39 | for { 40 | c, err := l.Accept() 41 | if err != nil { 42 | fmt.Printf("udp echo server accept error: %v\n", err) 43 | return 44 | } 45 | 46 | go echoWorker(c) 47 | } 48 | } 49 | 50 | func StartUnixDomainServer() { 51 | unixPath := "/tmp/frp_echo_server.sock" 52 | os.Remove(unixPath) 53 | syscall.Umask(0) 54 | l, err := net.Listen("unix", unixPath) 55 | if err != nil { 56 | fmt.Printf("unix domain server listen error: %v\n", err) 57 | return 58 | } 59 | 60 | for { 61 | c, err := l.Accept() 62 | if err != nil { 63 | fmt.Printf("unix domain server accept error: %v\n", err) 64 | return 65 | } 66 | 67 | go echoWorker(c) 68 | } 69 | } 70 | 71 | func echoWorker(c net.Conn) { 72 | br := bufio.NewReader(c) 73 | for { 74 | buf, err := br.ReadString('\n') 75 | if err == io.EOF { 76 | break 77 | } 78 | if err != nil { 79 | fmt.Printf("echo server read error: %v\n", err) 80 | return 81 | } 82 | 83 | c.Write([]byte(buf + "\n")) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/client/service.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | import ( 18 | "models/config" 19 | "utils/log" 20 | ) 21 | 22 | type Service struct { 23 | // manager control connection with server 24 | ctl *Control 25 | 26 | closedCh chan int 27 | } 28 | 29 | func NewService(pxyCfgs map[string]config.ProxyConf, vistorCfgs map[string]config.ProxyConf) (svr *Service) { 30 | svr = &Service{ 31 | closedCh: make(chan int), 32 | } 33 | ctl := NewControl(svr, pxyCfgs, vistorCfgs) 34 | svr.ctl = ctl 35 | return 36 | } 37 | 38 | func (svr *Service) Run() error { 39 | err := svr.ctl.Run() 40 | if err != nil { 41 | return err 42 | } 43 | 44 | if config.ClientCommonCfg.AdminPort != 0 { 45 | err = svr.RunAdminServer(config.ClientCommonCfg.AdminAddr, config.ClientCommonCfg.AdminPort) 46 | if err != nil { 47 | log.Warn("run admin server error: %v", err) 48 | } 49 | log.Info("admin server listen on %s:%d", config.ClientCommonCfg.AdminAddr, config.ClientCommonCfg.AdminPort) 50 | } 51 | 52 | <-svr.closedCh 53 | return nil 54 | } 55 | 56 | func (svr *Service) Close() error { 57 | return svr.ctl.Close() 58 | } 59 | -------------------------------------------------------------------------------- /src/client/admin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | import ( 18 | "fmt" 19 | "net" 20 | "net/http" 21 | "time" 22 | 23 | "models/config" 24 | frpNet "utils/net" 25 | 26 | "github.com/julienschmidt/httprouter" 27 | ) 28 | 29 | var ( 30 | httpServerReadTimeout = 10 * time.Second 31 | httpServerWriteTimeout = 10 * time.Second 32 | ) 33 | 34 | func (svr *Service) RunAdminServer(addr string, port int64) (err error) { 35 | // url router 36 | router := httprouter.New() 37 | 38 | user, passwd := config.ClientCommonCfg.AdminUser, config.ClientCommonCfg.AdminPwd 39 | 40 | // api, see dashboard_api.go 41 | router.GET("/api/reload", frpNet.HttprouterBasicAuth(svr.apiReload, user, passwd)) 42 | 43 | address := fmt.Sprintf("%s:%d", addr, port) 44 | server := &http.Server{ 45 | Addr: address, 46 | Handler: router, 47 | ReadTimeout: httpServerReadTimeout, 48 | WriteTimeout: httpServerWriteTimeout, 49 | } 50 | if address == "" { 51 | address = ":http" 52 | } 53 | ln, err := net.Listen("tcp", address) 54 | if err != nil { 55 | return err 56 | } 57 | 58 | go server.Serve(ln) 59 | return 60 | } 61 | -------------------------------------------------------------------------------- /src/models/plugin/socks5.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package plugin 16 | 17 | import ( 18 | "io" 19 | "io/ioutil" 20 | "log" 21 | 22 | frpNet "utils/net" 23 | 24 | gosocks5 "github.com/armon/go-socks5" 25 | ) 26 | 27 | const PluginSocks5 = "socks5" 28 | 29 | func init() { 30 | Register(PluginSocks5, NewSocks5Plugin) 31 | } 32 | 33 | type Socks5Plugin struct { 34 | Server *gosocks5.Server 35 | } 36 | 37 | func NewSocks5Plugin(params map[string]string) (p Plugin, err error) { 38 | sp := &Socks5Plugin{} 39 | sp.Server, err = gosocks5.New(&gosocks5.Config{ 40 | Logger: log.New(ioutil.Discard, "", log.LstdFlags), 41 | }) 42 | p = sp 43 | return 44 | } 45 | 46 | func (sp *Socks5Plugin) Handle(conn io.ReadWriteCloser) { 47 | defer conn.Close() 48 | 49 | var wrapConn frpNet.Conn 50 | if realConn, ok := conn.(frpNet.Conn); ok { 51 | wrapConn = realConn 52 | } else { 53 | wrapConn = frpNet.WrapReadWriteCloserToConn(conn) 54 | } 55 | 56 | sp.Server.ServeConn(wrapConn) 57 | } 58 | 59 | func (sp *Socks5Plugin) Name() string { 60 | return PluginSocks5 61 | } 62 | 63 | func (sp *Socks5Plugin) Close() error { 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /src/github.com/klauspost/reedsolomon/options.go: -------------------------------------------------------------------------------- 1 | package reedsolomon 2 | 3 | import ( 4 | "runtime" 5 | 6 | "github.com/klauspost/cpuid" 7 | ) 8 | 9 | // Option allows to override processing parameters. 10 | type Option func(*options) 11 | 12 | type options struct { 13 | maxGoroutines int 14 | minSplitSize int 15 | useAVX2, useSSSE3 bool 16 | } 17 | 18 | var defaultOptions = options{ 19 | maxGoroutines: 50, 20 | minSplitSize: 512, 21 | } 22 | 23 | func init() { 24 | if runtime.GOMAXPROCS(0) <= 1 { 25 | defaultOptions.maxGoroutines = 1 26 | } 27 | // Detect CPU capabilities. 28 | defaultOptions.useSSSE3 = cpuid.CPU.SSSE3() 29 | defaultOptions.useAVX2 = cpuid.CPU.AVX2() 30 | } 31 | 32 | // WithMaxGoroutines is the maximum number of goroutines number for encoding & decoding. 33 | // Jobs will be split into this many parts, unless each goroutine would have to process 34 | // less than minSplitSize bytes (set with WithMinSplitSize). 35 | // For the best speed, keep this well above the GOMAXPROCS number for more fine grained 36 | // scheduling. 37 | // If n <= 0, it is ignored. 38 | func WithMaxGoroutines(n int) Option { 39 | return func(o *options) { 40 | if n > 0 { 41 | o.maxGoroutines = n 42 | } 43 | } 44 | } 45 | 46 | // MinSplitSize Is the minimum encoding size in bytes per goroutine. 47 | // See WithMaxGoroutines on how jobs are split. 48 | // If n <= 0, it is ignored. 49 | func WithMinSplitSize(n int) Option { 50 | return func(o *options) { 51 | if n > 0 { 52 | o.minSplitSize = n 53 | } 54 | } 55 | } 56 | 57 | func withSSE3(enabled bool) Option { 58 | return func(o *options) { 59 | o.useSSSE3 = enabled 60 | } 61 | } 62 | 63 | func withAVX2(enabled bool) Option { 64 | return func(o *options) { 65 | o.useAVX2 = enabled 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/golang.org/x/net/ipv4/icmp.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import "golang.org/x/net/internal/iana" 8 | 9 | // An ICMPType represents a type of ICMP message. 10 | type ICMPType int 11 | 12 | func (typ ICMPType) String() string { 13 | s, ok := icmpTypes[typ] 14 | if !ok { 15 | return "" 16 | } 17 | return s 18 | } 19 | 20 | // Protocol returns the ICMPv4 protocol number. 21 | func (typ ICMPType) Protocol() int { 22 | return iana.ProtocolICMP 23 | } 24 | 25 | // An ICMPFilter represents an ICMP message filter for incoming 26 | // packets. The filter belongs to a packet delivery path on a host and 27 | // it cannot interact with forwarding packets or tunnel-outer packets. 28 | // 29 | // Note: RFC 2460 defines a reasonable role model and it works not 30 | // only for IPv6 but IPv4. A node means a device that implements IP. 31 | // A router means a node that forwards IP packets not explicitly 32 | // addressed to itself, and a host means a node that is not a router. 33 | type ICMPFilter struct { 34 | icmpFilter 35 | } 36 | 37 | // Accept accepts incoming ICMP packets including the type field value 38 | // typ. 39 | func (f *ICMPFilter) Accept(typ ICMPType) { 40 | f.accept(typ) 41 | } 42 | 43 | // Block blocks incoming ICMP packets including the type field value 44 | // typ. 45 | func (f *ICMPFilter) Block(typ ICMPType) { 46 | f.block(typ) 47 | } 48 | 49 | // SetAll sets the filter action to the filter. 50 | func (f *ICMPFilter) SetAll(block bool) { 51 | f.setAll(block) 52 | } 53 | 54 | // WillBlock reports whether the ICMP type will be blocked. 55 | func (f *ICMPFilter) WillBlock(typ ICMPType) bool { 56 | return f.willBlock(typ) 57 | } 58 | -------------------------------------------------------------------------------- /src/github.com/context/x_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | . "context" 9 | "testing" 10 | ) 11 | 12 | func TestBackground(t *testing.T) { XTestBackground(t) } 13 | func TestTODO(t *testing.T) { XTestTODO(t) } 14 | func TestWithCancel(t *testing.T) { XTestWithCancel(t) } 15 | func TestParentFinishesChild(t *testing.T) { XTestParentFinishesChild(t) } 16 | func TestChildFinishesFirst(t *testing.T) { XTestChildFinishesFirst(t) } 17 | func TestDeadline(t *testing.T) { XTestDeadline(t) } 18 | func TestTimeout(t *testing.T) { XTestTimeout(t) } 19 | func TestCanceledTimeout(t *testing.T) { XTestCanceledTimeout(t) } 20 | func TestValues(t *testing.T) { XTestValues(t) } 21 | func TestAllocs(t *testing.T) { XTestAllocs(t, testing.Short, testing.AllocsPerRun) } 22 | func TestSimultaneousCancels(t *testing.T) { XTestSimultaneousCancels(t) } 23 | func TestInterlockedCancels(t *testing.T) { XTestInterlockedCancels(t) } 24 | func TestLayersCancel(t *testing.T) { XTestLayersCancel(t) } 25 | func TestLayersTimeout(t *testing.T) { XTestLayersTimeout(t) } 26 | func TestCancelRemoves(t *testing.T) { XTestCancelRemoves(t) } 27 | func TestWithCancelCanceledParent(t *testing.T) { XTestWithCancelCanceledParent(t) } 28 | func TestWithValueChecksKey(t *testing.T) { XTestWithValueChecksKey(t) } 29 | func TestDeadlineExceededSupportsTimeout(t *testing.T) { XTestDeadlineExceededSupportsTimeout(t) } 30 | -------------------------------------------------------------------------------- /package.sh: -------------------------------------------------------------------------------- 1 | # compile for version 2 | make 3 | if [ $? -ne 0 ]; then 4 | echo "make error" 5 | exit 1 6 | fi 7 | 8 | frp_version=`./bin/frps --version` 9 | echo "build version: $frp_version" 10 | 11 | # cross_compiles 12 | make -f ./Makefile.cross-compiles 13 | 14 | rm -rf ./packages 15 | mkdir ./packages 16 | 17 | os_all='linux windows darwin' 18 | arch_all='386 amd64 arm mips64 mips64le mips mipsle' 19 | 20 | for os in $os_all; do 21 | for arch in $arch_all; do 22 | frp_dir_name="frp_${frp_version}_${os}_${arch}" 23 | frp_path="./packages/frp_${frp_version}_${os}_${arch}" 24 | 25 | if [ "x${os}" = x"windows" ]; then 26 | if [ ! -f "./frpc_${os}_${arch}.exe" ]; then 27 | continue 28 | fi 29 | if [ ! -f "./frps_${os}_${arch}.exe" ]; then 30 | continue 31 | fi 32 | mkdir ${frp_path} 33 | mv ./src/frpc_${os}_${arch}.exe ${frp_path}/frpc.exe 34 | mv ./src/frps_${os}_${arch}.exe ${frp_path}/frps.exe 35 | else 36 | if [ ! -f "./frpc_${os}_${arch}" ]; then 37 | continue 38 | fi 39 | if [ ! -f "./frps_${os}_${arch}" ]; then 40 | continue 41 | fi 42 | mkdir ${frp_path} 43 | mv ./src/frpc_${os}_${arch} ${frp_path}/frpc 44 | mv ./src/frps_${os}_${arch} ${frp_path}/frps 45 | fi 46 | cp ./LICENSE ${frp_path} 47 | cp ./src/conf/* ${frp_path} 48 | 49 | # packages 50 | cd ./packages 51 | if [ "x${os}" = x"windows" ]; then 52 | zip -rq ${frp_dir_name}.zip ${frp_dir_name} 53 | else 54 | tar -zcf ${frp_dir_name}.tar.gz ${frp_dir_name} 55 | fi 56 | cd .. 57 | rm -rf ${frp_path} 58 | done 59 | done 60 | -------------------------------------------------------------------------------- /src/utils/vhost/resource.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package vhost 16 | 17 | import ( 18 | "io/ioutil" 19 | "net/http" 20 | "strings" 21 | 22 | "utils/version" 23 | ) 24 | 25 | const ( 26 | NotFound = ` 27 | 28 | 29 | Not Found 30 | 37 | 38 | 39 |

The page you visit not found.

40 |

Sorry, the page you are looking for is currently unavailable.
41 | Please try again later.

42 |

The server is powered by www.lu8.top.

43 |

Faithfully yours, frp.

44 | 45 | 46 | ` 47 | ) 48 | 49 | func notFoundResponse() *http.Response { 50 | header := make(http.Header) 51 | header.Set("server", "frp/"+version.Full()) 52 | header.Set("Content-Type", "text/html") 53 | res := &http.Response{ 54 | Status: "Not Found", 55 | StatusCode: 404, 56 | Proto: "HTTP/1.0", 57 | ProtoMajor: 1, 58 | ProtoMinor: 0, 59 | Header: header, 60 | Body: ioutil.NopCloser(strings.NewReader(NotFound)), 61 | } 62 | return res 63 | } 64 | -------------------------------------------------------------------------------- /src/utils/version/version_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 fatedier, fatedier@gmail.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package version 16 | 17 | import ( 18 | "fmt" 19 | "strconv" 20 | "strings" 21 | "testing" 22 | 23 | "github.com/stretchr/testify/assert" 24 | ) 25 | 26 | func TestFull(t *testing.T) { 27 | assert := assert.New(t) 28 | version := Full() 29 | arr := strings.Split(version, ".") 30 | assert.Equal(3, len(arr)) 31 | 32 | proto, err := strconv.ParseInt(arr[0], 10, 64) 33 | assert.NoError(err) 34 | assert.True(proto >= 0) 35 | 36 | major, err := strconv.ParseInt(arr[1], 10, 64) 37 | assert.NoError(err) 38 | assert.True(major >= 0) 39 | 40 | minor, err := strconv.ParseInt(arr[2], 10, 64) 41 | assert.NoError(err) 42 | assert.True(minor >= 0) 43 | } 44 | 45 | func TestVersion(t *testing.T) { 46 | assert := assert.New(t) 47 | proto := Proto(Full()) 48 | major := Major(Full()) 49 | minor := Minor(Full()) 50 | parseVerion := fmt.Sprintf("%d.%d.%d", proto, major, minor) 51 | version := Full() 52 | assert.Equal(parseVerion, version) 53 | } 54 | 55 | func TestCompact(t *testing.T) { 56 | assert := assert.New(t) 57 | ok, _ := Compat("0.9.0") 58 | assert.False(ok) 59 | 60 | ok, _ = Compat("10.0.0") 61 | assert.True(ok) 62 | 63 | ok, _ = Compat("0.10.0") 64 | assert.True(ok) 65 | } 66 | --------------------------------------------------------------------------------