This commit is contained in:
吕海涛
2021-05-08 17:24:53 +08:00
parent 3c3b3110a2
commit a9144c9766
7 changed files with 10 additions and 22 deletions

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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))