mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-10-17 14:22:35 +08:00
26 lines
379 B
Go
26 lines
379 B
Go
package tproxy
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/e1732a364fed/v2ray_simple/netLayer"
|
|
)
|
|
|
|
//一个tproxy状态机 具有 监听端口、tcplistener、udpConn 这三个要素。
|
|
type Machine struct {
|
|
netLayer.Addr
|
|
net.Listener //tcpListener
|
|
*net.UDPConn
|
|
}
|
|
|
|
func (m *Machine) Stop() {
|
|
if m.Listener != nil {
|
|
m.Listener.Close()
|
|
|
|
}
|
|
if m.UDPConn != nil {
|
|
m.UDPConn.Close()
|
|
|
|
}
|
|
}
|