Feature: add mode script

This commit is contained in:
yaling888
2021-10-15 14:11:14 +08:00
parent 862174d21b
commit c0e9d69163
28 changed files with 1918 additions and 356 deletions

View File

@ -34,27 +34,22 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
return nil
}
//if err := conn.SetDeadline(time.Now().Add(defaultDnsReadTimeout)); err != nil {
// _ = conn.Close()
// return nil
//}
src, _ := conn.LocalAddr().(*net.TCPAddr)
dst, _ := conn.RemoteAddr().(*net.TCPAddr)
addrType := C.AtypIPv4
if dst.IP.To4() == nil {
addrType = C.AtypIPv6
}
//addrType := C.AtypIPv4
//if dst.IP.To4() == nil {
// addrType = C.AtypIPv6
//}
metadata := &C.Metadata{
NetWork: C.TCP,
Type: C.TUN,
SrcIP: src.IP,
DstIP: dst.IP,
SrcPort: strconv.Itoa(src.Port),
DstPort: strconv.Itoa(dst.Port),
AddrType: addrType,
Host: "",
NetWork: C.TCP,
Type: C.TUN,
SrcIP: src.IP,
DstIP: dst.IP,
SrcPort: strconv.Itoa(src.Port),
DstPort: strconv.Itoa(dst.Port),
//AddrType: addrType,
Host: "",
}
go func(conn net.Conn, metadata *C.Metadata) {