mirror of
				https://github.com/bjdgyc/anylink.git
				synced 2025-11-01 00:59:34 +08:00 
			
		
		
		
	tmp
This commit is contained in:
		| @@ -13,7 +13,7 @@ files_path = "../files" | ||||
| #日志目录,为空写入标准输出 | ||||
| #log_path = "../log" | ||||
| log_path = "" | ||||
| log_level = "info" | ||||
| log_level = "debug" | ||||
|  | ||||
| #系统名称 | ||||
| issuer = "XX公司VPN" | ||||
| @@ -25,7 +25,7 @@ jwt_secret = "iLmspvOiz*%ovfcs*wersdf#heR8pNU4XxBm&mW$aPCjSRMbYH#&" | ||||
|  | ||||
|  | ||||
| #前台服务监听地址 | ||||
| server_addr = ":443" | ||||
| server_addr = ":4430" | ||||
| #后台服务监听地址 | ||||
| admin_addr = ":8800" | ||||
| #开启tcp proxy protocol协议 | ||||
|   | ||||
| @@ -4,10 +4,7 @@ go 1.15 | ||||
|  | ||||
| require ( | ||||
| 	github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect | ||||
| 	github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect | ||||
| 	github.com/asdine/storm/v3 v3.2.1 | ||||
| 	github.com/coreos/go-etcd v2.0.0+incompatible // indirect | ||||
| 	github.com/cpuguy83/go-md2man v1.0.10 // indirect | ||||
| 	github.com/dgrijalva/jwt-go v3.2.0+incompatible | ||||
| 	github.com/fsnotify/fsnotify v1.4.9 // indirect | ||||
| 	github.com/go-ole/go-ole v1.2.5 // indirect | ||||
| @@ -15,7 +12,7 @@ require ( | ||||
| 	github.com/gorilla/mux v1.8.0 | ||||
| 	github.com/magiconair/properties v1.8.4 // indirect | ||||
| 	github.com/mitchellh/mapstructure v1.4.1 // indirect | ||||
| 	github.com/pelletier/go-toml v1.8.1 | ||||
| 	github.com/pelletier/go-toml v1.8.1 // indirect | ||||
| 	github.com/shirou/gopsutil v3.21.1+incompatible | ||||
| 	github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e | ||||
| 	github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091 | ||||
| @@ -26,10 +23,8 @@ require ( | ||||
| 	github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||||
| 	github.com/spf13/viper v1.7.1 | ||||
| 	github.com/stretchr/testify v1.7.0 | ||||
| 	github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect | ||||
| 	github.com/xhit/go-simple-mail/v2 v2.8.0 | ||||
| 	github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 | ||||
| 	github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 // indirect | ||||
| 	go.etcd.io/bbolt v1.3.5 | ||||
| 	golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 | ||||
| 	golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d | ||||
|   | ||||
| @@ -23,7 +23,6 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrU | ||||
| github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= | ||||
| github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= | ||||
| github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= | ||||
| github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= | ||||
| github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= | ||||
| github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= | ||||
| github.com/asdine/storm/v3 v3.2.1 h1:I5AqhkPK6nBZ/qJXySdI7ot5BlXSZ7qvDY1zAn5ZJac= | ||||
| @@ -36,11 +35,9 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf | ||||
| github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= | ||||
| github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= | ||||
| github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= | ||||
| github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= | ||||
| github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= | ||||
| github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= | ||||
| github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= | ||||
| github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= | ||||
| github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | ||||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
| github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||
| @@ -174,7 +171,6 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z | ||||
| github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= | ||||
| github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= | ||||
| github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= | ||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
| github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||||
| github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= | ||||
| github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= | ||||
| @@ -221,7 +217,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ | ||||
| github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= | ||||
| github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= | ||||
| github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= | ||||
| github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= | ||||
| github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= | ||||
| github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= | ||||
| github.com/xhit/go-simple-mail/v2 v2.8.0 h1:w6ZDXvRk0EO+r78LRlQl14ngP2tiRDRRHhr9UaVJ0p4= | ||||
| @@ -229,7 +224,6 @@ github.com/xhit/go-simple-mail/v2 v2.8.0/go.mod h1:kA1XbQfCI4JxQ9ccSN6VFyIEkkugO | ||||
| github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= | ||||
| github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 h1:YyPWX3jLOtYKulBR6AScGIs74lLrJcgeKRwcbAuQOG4= | ||||
| github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119/go.mod h1:/nuTSlK+okRfR/vnIPqR89fFKonnWPiZymN5ydRJkX8= | ||||
| github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= | ||||
| go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= | ||||
| go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= | ||||
| go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= | ||||
| @@ -310,7 +304,6 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w | ||||
| golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= | ||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
| golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc= | ||||
| golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
|   | ||||
| @@ -55,7 +55,7 @@ func setCommonHeader(w http.ResponseWriter) { | ||||
|  | ||||
| func execCmd(cmdStrs []string) error { | ||||
| 	for _, cmdStr := range cmdStrs { | ||||
| 		cmd := exec.Command("bash", "-c", cmdStr) | ||||
| 		cmd := exec.Command("sh", "-c", cmdStr) | ||||
| 		b, err := cmd.CombinedOutput() | ||||
| 		if err != nil { | ||||
| 			log.Println(string(b), err) | ||||
|   | ||||
| @@ -46,7 +46,7 @@ func LinkTun(cSess *sessdata.ConnSession) error { | ||||
| 	cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast off", ifce.Name(), cSess.Mtu) | ||||
| 	cmdstr2 := fmt.Sprintf("ip addr add dev %s local %s peer %s/32", | ||||
| 		ifce.Name(), base.Cfg.Ipv4Gateway, cSess.IpAddr) | ||||
| 	cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) | ||||
| 	cmdstr3 := "true" | ||||
| 	cmdStrs := []string{cmdstr1, cmdstr2, cmdstr3} | ||||
| 	err = execCmd(cmdStrs) | ||||
| 	if err != nil { | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import ( | ||||
| 	"log" | ||||
| 	"net" | ||||
| 	"net/http" | ||||
| 	"net/http/httputil" | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/bjdgyc/anylink/base" | ||||
| @@ -21,9 +22,9 @@ func init() { | ||||
|  | ||||
| func LinkTunnel(w http.ResponseWriter, r *http.Request) { | ||||
| 	// TODO 调试信息输出 | ||||
| 	// hd, _ := httputil.DumpRequest(r, true) | ||||
| 	// fmt.Println("DumpRequest: ", string(hd)) | ||||
| 	// fmt.Println("LinkTunnel", r.RemoteAddr) | ||||
| 	hd, _ := httputil.DumpRequest(r, true) | ||||
| 	fmt.Println("DumpRequest: ", string(hd)) | ||||
| 	fmt.Println("LinkTunnel", r.RemoteAddr) | ||||
|  | ||||
| 	// 判断session-token的值 | ||||
| 	cookie, err := r.Cookie("webvpn") | ||||
| @@ -112,6 +113,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) { | ||||
| 	w.Header().Set("X-CSTP-MSIE-Proxy-Lockdown", "true") | ||||
| 	w.Header().Set("X-CSTP-Smartcard-Removal-Disconnect", "true") | ||||
|  | ||||
| 	w.Header().Set("X-MTU", fmt.Sprintf("%d", cSess.Mtu))      // 1399 | ||||
| 	w.Header().Set("X-CSTP-MTU", fmt.Sprintf("%d", cSess.Mtu)) // 1399 | ||||
| 	w.Header().Set("X-DTLS-MTU", fmt.Sprintf("%d", cSess.Mtu)) | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,5 @@ | ||||
| // AnyLink 是一个企业级远程办公vpn软件,可以支持多人同时在线使用。 | ||||
|  | ||||
| // +build linux | ||||
|  | ||||
| package main | ||||
|  | ||||
| import ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user