fixed CPU high after direct connection disconnection
4
.gitignore
vendored
@@ -15,5 +15,5 @@ goodlink.json
|
||||
config.json
|
||||
*.upx
|
||||
debug.sh
|
||||
wintun.dll
|
||||
nac.syso
|
||||
*.dll
|
||||
*.syso
|
||||
|
@@ -1,8 +1,8 @@
|
||||
Website = "https://goodlink.kony.vip"
|
||||
|
||||
[Details]
|
||||
Icon = "theme/favicon.png"
|
||||
Icon = "assert/favicon.png"
|
||||
Name = "goodlink-windows-amd64-ui"
|
||||
ID = "goodlink.kony.vip"
|
||||
Version = "2.1.1"
|
||||
Version = "2.1.2"
|
||||
Build = 0
|
||||
|
12
Makefile
@@ -11,7 +11,8 @@ GOBUILD=GO111MODULE=on \
|
||||
-X "gogo.BuildTime=$(BuildTime)" \
|
||||
-w -s -buildid='
|
||||
|
||||
LINUX_PLATFORM_LIST = \
|
||||
PLATFORM_LIST = \
|
||||
windows-arm64-cmd \
|
||||
linux-386-cmd \
|
||||
linux-amd64-cmd \
|
||||
linux-arm-cmd \
|
||||
@@ -24,12 +25,11 @@ LINUX_PLATFORM_LIST = \
|
||||
linux-riscv64-cmd \
|
||||
linux-mips64le-cmd
|
||||
|
||||
WINDOWS_PLATFORM_LIST = \
|
||||
NAC_PLATFORM_LIST = \
|
||||
windows-amd64-ui \
|
||||
windows-amd64-cmd \
|
||||
windows-arm64-cmd
|
||||
|
||||
all: $(WINDOWS_PLATFORM_LIST) rm_uac $(LINUX_PLATFORM_LIST) strip
|
||||
all: create_nac $(NAC_PLATFORM_LIST) rm_nac $(PLATFORM_LIST) strip
|
||||
|
||||
linux-386-cmd:
|
||||
GOARCH=386 GOOS=linux $(GOBUILD) -tags "cmd" -o $(BINDIR)/$(NAME)-$@
|
||||
@@ -81,10 +81,10 @@ windows-amd64-ui:
|
||||
# go build -ldflags -H=windowsgui
|
||||
mkdir bin; fyne package; mv *.exe bin/
|
||||
|
||||
create_uac:
|
||||
create_nac:
|
||||
rsrc -manifest nac.manifest -o nac.syso
|
||||
|
||||
rm_uac:
|
||||
rm_nac:
|
||||
rm -rf nac.syso
|
||||
|
||||
strip:
|
||||
|
16
README.md
@@ -49,23 +49,17 @@
|
||||
|
||||
### TUN模式
|
||||
|
||||
Local端会创建一个虚拟网卡, 因此需要管理员权限运行。连接成功后,界面会显示: 对端IP
|
||||
Local端会创建一个虚拟网卡, 因此需要管理员权限运行。连接成功后,界面会显示: Remote端IP
|
||||
|
||||
不限端口,访问对端IP的任意端口,相当于访问Remote端本机的任意端口
|
||||
|
||||
对端IP目前固定为: 192.17.19.1 , 具体以界面或者日志显示为准
|
||||
|
||||
举例: 在Local端打开 windows 远程桌面, 填写对端IP, 即可访问Remote端的远程桌面
|
||||
举例: 在Local端打开 windows 远程桌面, 填写Remote端IP, 即可访问Remote端的远程桌面
|
||||
|
||||
### 代理模式
|
||||
|
||||
代理端口目前固定为: 1080
|
||||
代理地址端口: socket5://Remote端IP:1080
|
||||
|
||||
代理地址端口: socket5://对端IP:1080
|
||||
举例: 在Local端配置socket5代理: socks5://Remote端IP:1080, 即可利用Remote端做跳板, 访问所有的网络资源
|
||||
|
||||
举例: 在Local端配置代理: socks5://对端IP:1080, 即可通过Remote端访问所有的网络资源
|
||||
|
||||
注: 目前仅支持TCP代理,浏览器可安装插件 SwitchyOmega。其他 GIT, SVN, SSH 等, 都支持socks5代理
|
||||
注: 目前仅支持TCP代理,浏览器可安装插件 SwitchyOmega。其他 GIT, SVN, SSH 等, 都支持socket5代理
|
||||
|
||||
# 简单使用
|
||||
|
||||
|
BIN
assert/favicon.png
Normal file
After Width: | Height: | Size: 2.2 MiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 117 KiB |
BIN
assert/letter-g-3.png
Normal file
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 38 KiB |
14
nac.manifest
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="requireAdministrator" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
1
pprof.bat
Normal file
@@ -0,0 +1 @@
|
||||
go tool pprof -http=":6060" http://192.17.19.1:6060/debug/pprof/profile?seconds=15
|
@@ -24,7 +24,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
m_version = "2.1.1"
|
||||
m_version = "2.1.2"
|
||||
)
|
||||
|
||||
func Init() error {
|
||||
|
14
pro/local.go
@@ -40,11 +40,11 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
|
||||
|
||||
switch conn_type {
|
||||
case 0:
|
||||
utils.Log().Debug("请求连接对端")
|
||||
utils.Log().Debug("请求连接Remote端")
|
||||
|
||||
default:
|
||||
redisJson.LocalAddr = *addr
|
||||
utils.Log().DebugF("发送本端地址: %v", redisJson.LocalAddr)
|
||||
utils.Log().DebugF("发送Local端地址: %v", redisJson.LocalAddr)
|
||||
}
|
||||
|
||||
RedisSet(15*time.Second, &redisJson)
|
||||
@@ -74,7 +74,7 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
|
||||
return tun_active, tun_passive, nil, nil, errors.New("两端版本不兼容")
|
||||
}
|
||||
|
||||
utils.Log().DebugF("收到对端地址: %v", redisJson.RemoteAddr)
|
||||
utils.Log().DebugF("收到Remote端地址: %v", redisJson.RemoteAddr)
|
||||
|
||||
switch conn_type {
|
||||
case 0:
|
||||
@@ -89,7 +89,7 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
|
||||
tun_passive.Start()
|
||||
|
||||
redisJson.State = 2
|
||||
utils.Log().DebugF("发送本端地址: %v", redisJson.LocalAddr)
|
||||
utils.Log().DebugF("发送Local端地址: %v", redisJson.LocalAddr)
|
||||
RedisSet(redisJson.RedisTimeOut, &redisJson)
|
||||
|
||||
default:
|
||||
@@ -126,7 +126,7 @@ func GetLocalQuicConn(conn *net.UDPConn, addr *tun.AddrType, count int) (*tun.Tu
|
||||
return tun_active, tun_passive, nil, nil, nil
|
||||
|
||||
default:
|
||||
utils.Log().DebugF("等待对端状态: Local: %v => Remote: %v", redisJson.LocalAddr, redisJson.RemoteAddr)
|
||||
utils.Log().DebugF("等待Remote端状态: Local: %v => Remote: %v", redisJson.LocalAddr, redisJson.RemoteAddr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func RunLocal(tun_key string) error {
|
||||
}
|
||||
udp_conn, addr = GetUDPAddr()
|
||||
|
||||
log.Printf("本端地址: %v", addr)
|
||||
log.Printf("Local端地址: %v", addr)
|
||||
|
||||
count++
|
||||
|
||||
@@ -188,7 +188,7 @@ func RunLocal(tun_key string) error {
|
||||
m_tun_passive = tun_passive
|
||||
|
||||
netstack.SetForWarder(quic_conn)
|
||||
utils.Log().DebugF("对端IP: %s", netstack.GetRemoteIP())
|
||||
utils.Log().DebugF("Remote端IP: %s", netstack.GetRemoteIP())
|
||||
|
||||
m_local_state = 2
|
||||
tun.ProcessHealth(health)
|
||||
|
@@ -75,7 +75,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
|
||||
switch redisJson.State {
|
||||
case 0:
|
||||
utils.Log().DebugF("收到对端请求: %v", redisJson)
|
||||
utils.Log().DebugF("收到Local端请求: %v", redisJson)
|
||||
|
||||
redisJson.State = 1
|
||||
|
||||
@@ -90,7 +90,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
switch redisJson.LocalAddr.WanPort1 {
|
||||
case 0:
|
||||
conn_type = 0
|
||||
utils.Log().Debug("对端未发来IP")
|
||||
utils.Log().Debug("Local端未发来IP")
|
||||
|
||||
if tun_active != nil {
|
||||
tun_active.Release()
|
||||
@@ -103,7 +103,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
redisJson.SendPortCount = 0x100
|
||||
|
||||
default:
|
||||
utils.Log().DebugF("对端有发来IP: %v", redisJson.LocalAddr)
|
||||
utils.Log().DebugF("Local端有发来IP: %v", redisJson.LocalAddr)
|
||||
conn_type = 1
|
||||
|
||||
if tun_passive != nil {
|
||||
@@ -117,23 +117,23 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
tun_passive_chain = tun_passive.GetChain()
|
||||
}
|
||||
|
||||
utils.Log().DebugF("发送本端地址: %v", redisJson.RemoteAddr)
|
||||
utils.Log().DebugF("发送Remote端地址: %v", redisJson.RemoteAddr)
|
||||
RedisSet(redisJson.RedisTimeOut, &redisJson)
|
||||
|
||||
case 2:
|
||||
switch conn_type {
|
||||
case 0:
|
||||
utils.Log().DebugF("收到对端地址: %v", redisJson.LocalAddr)
|
||||
utils.Log().DebugF("收到Local端地址: %v", redisJson.LocalAddr)
|
||||
tun_active.Start()
|
||||
|
||||
case 1:
|
||||
utils.Log().DebugF("收到对端地址, 等待连接: %v", redisJson.LocalAddr)
|
||||
utils.Log().DebugF("收到Local端地址, 等待连接: %v", redisJson.LocalAddr)
|
||||
}
|
||||
|
||||
select {
|
||||
case <-tun_active_chain:
|
||||
redisJson.State = 3
|
||||
utils.Log().Debug("对端被动连接成功")
|
||||
utils.Log().Debug("Local端被动连接成功")
|
||||
RedisSet(redisJson.RedisTimeOut, &redisJson)
|
||||
if tun_active != nil {
|
||||
return udp_conn, tun_active, tun_passive, tun_active.TunQuicConn, tun_active.TunHealthStream
|
||||
@@ -142,7 +142,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
|
||||
case <-tun_passive_chain:
|
||||
redisJson.State = 3
|
||||
utils.Log().Debug("对端主动连接成功")
|
||||
utils.Log().Debug("Local端主动连接成功")
|
||||
RedisSet(redisJson.RedisTimeOut, &redisJson)
|
||||
if tun_passive != nil {
|
||||
return udp_conn, tun_active, tun_passive, tun_passive.TunQuicConn, tun_passive.TunHealthStream
|
||||
@@ -151,7 +151,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
|
||||
case <-time.After(time.Duration(config.Arg_p2p_timeout) * time.Second):
|
||||
redisJson.State = 4
|
||||
utils.Log().Debug("对端连接超时")
|
||||
utils.Log().Debug("Local端连接超时")
|
||||
RedisSet(redisJson.RedisTimeOut, &redisJson)
|
||||
return udp_conn, tun_active, tun_passive, nil, nil
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func GetRemoteQuicConn() (*net.UDPConn, *tun.TunActive, *tun.TunPassive, quic.Co
|
||||
case 3, 4:
|
||||
|
||||
default:
|
||||
utils.Log().DebugF("等待对端状态: Local: %v => Remote: %v", redisJson.LocalAddr, redisJson.RemoteAddr)
|
||||
utils.Log().DebugF("等待Local端状态: Local: %v => Remote: %v", redisJson.LocalAddr, redisJson.RemoteAddr)
|
||||
}
|
||||
|
||||
last_state = redisJson.State
|
||||
|
@@ -30,7 +30,7 @@ func ProcessProxyServer(stun_quic_conn quic.Connection) {
|
||||
fewfgwegwe:
|
||||
new_quic_stream, err := stun_quic_conn.AcceptStream(context.Background())
|
||||
if err != nil {
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
_, err = io.ReadFull(new_quic_stream, buf[:head_len])
|
||||
|
Before Width: | Height: | Size: 13 KiB |