pingtunnel

package module
v0.0.0-...-dec7683 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 16 Imported by: 2

README

Pingtunnel

Go Report Card

Pingtunnel is a tool that send TCP/UDP traffic over ICMP.

Note: This tool is only to be used for study and research, do not use it for illegal purposes

image

Usage

Install server
  • First prepare a server with a public IP, such as EC2 on AWS, assuming the domain name or public IP is www.yourserver.com
  • Download the corresponding installation package from releases, such as pingtunnel_linux64.zip, then decompress and execute with root privileges
  • “-key” parameter is int type, only supports numbers between 0-2147483647
sudo wget (link of latest release)
sudo unzip pingtunnel_linux64.zip
sudo ./pingtunnel -type server
  • (Optional) Disable system default ping
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Install the client
  • Download the corresponding installation package from releases, such as pingtunnel_windows64.zip, and decompress it
  • Then run with administrator privileges. The commands corresponding to different forwarding functions are as follows.
  • If you see a log of ping pong, the connection is normal
  • “-key” parameter is int type, only supports numbers between 0-2147483647
Forward sock5
pingtunnel.exe -type client -l :4455 -s www.yourserver.com -sock5 1
Forward tcp
pingtunnel.exe -type client -l :4455 -s www.yourserver.com -t www.yourserver.com:4455 -tcp 1
Forward udp
pingtunnel.exe -type client -l :4455 -s www.yourserver.com -t www.yourserver.com:4455
Use Docker

It can also be started directly with docker, which is more convenient. Same parameters as above

  • server:
docker run --name pingtunnel-server -d --privileged --network host --restart=always esrrhs/pingtunnel ./pingtunnel -type server -key 123456
  • client:
docker run --name pingtunnel-client -d --restart=always -p 1080:1080 esrrhs/pingtunnel ./pingtunnel -type client -l :1080 -s www.yourserver.com -sock5 1 -key 123456

Thanks for free JetBrains Open Source license

Documentation

Index

Constants

View Source
const (
	SEND_PROTO int = 8
	RECV_PROTO int = 0
)
View Source
const (
	FRAME_MAX_SIZE int = 888
	FRAME_MAX_ID   int = 1000000
)

Variables

View Source
var MyMsg_TYPE_name = map[int32]string{
	0:     "DATA",
	1:     "PING",
	2:     "KICK",
	57005: "MAGIC",
}
View Source
var MyMsg_TYPE_value = map[string]int32{
	"DATA":  0,
	"PING":  1,
	"KICK":  2,
	"MAGIC": 57005,
}

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr string, server string, target string, timeout int, key int,
	tcpmode int, tcpmode_buffersize int, tcpmode_maxwin int, tcpmode_resend_timems int, tcpmode_compress int,
	tcpmode_stat int, open_sock5 int, maxconn int, sock5_filter *func(addr string) bool) (*Client, error)

func (*Client) Accept

func (p *Client) Accept() error

func (*Client) AcceptDirectTcpConn

func (p *Client) AcceptDirectTcpConn(conn *net.TCPConn, targetAddr string)

func (*Client) AcceptSock5Conn

func (p *Client) AcceptSock5Conn(conn *net.TCPConn)

func (*Client) AcceptTcp

func (p *Client) AcceptTcp() error

func (*Client) AcceptTcpConn

func (p *Client) AcceptTcpConn(conn *net.TCPConn, targetAddr string)

func (*Client) Addr

func (p *Client) Addr() string

func (*Client) IPAddr

func (p *Client) IPAddr() *net.UDPAddr

func (*Client) LocalAddrToConnMapSize

func (p *Client) LocalAddrToConnMapSize() int

func (*Client) LocalIdToConnMapSize

func (p *Client) LocalIdToConnMapSize() int

func (*Client) RTT

func (p *Client) RTT() time.Duration

func (*Client) RecvPacket

func (p *Client) RecvPacket() uint64

func (*Client) RecvPacketSize

func (p *Client) RecvPacketSize() uint64

func (*Client) Run

func (p *Client) Run() error

func (*Client) SendPacket

func (p *Client) SendPacket() uint64

func (*Client) SendPacketSize

func (p *Client) SendPacketSize() uint64

func (*Client) ServerAddr

func (p *Client) ServerAddr() string

func (*Client) ServerIPAddr

func (p *Client) ServerIPAddr() *net.IPAddr

func (*Client) Stop

func (p *Client) Stop()

func (*Client) TargetAddr

func (p *Client) TargetAddr() string

type ClientConn

type ClientConn struct {
	// contains filtered or unexported fields
}

type MyMsg

type MyMsg struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type                 int32    `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
	Target               string   `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	Data                 []byte   `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	Rproto               int32    `protobuf:"zigzag32,5,opt,name=rproto,proto3" json:"rproto,omitempty"`
	Magic                int32    `protobuf:"zigzag32,6,opt,name=magic,proto3" json:"magic,omitempty"`
	Key                  int32    `protobuf:"zigzag32,7,opt,name=key,proto3" json:"key,omitempty"`
	Timeout              int32    `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"`
	Tcpmode              int32    `protobuf:"varint,9,opt,name=tcpmode,proto3" json:"tcpmode,omitempty"`
	TcpmodeBuffersize    int32    `protobuf:"varint,10,opt,name=tcpmode_buffersize,json=tcpmodeBuffersize,proto3" json:"tcpmode_buffersize,omitempty"`
	TcpmodeMaxwin        int32    `protobuf:"varint,11,opt,name=tcpmode_maxwin,json=tcpmodeMaxwin,proto3" json:"tcpmode_maxwin,omitempty"`
	TcpmodeResendTimems  int32    `protobuf:"varint,12,opt,name=tcpmode_resend_timems,json=tcpmodeResendTimems,proto3" json:"tcpmode_resend_timems,omitempty"`
	TcpmodeCompress      int32    `protobuf:"varint,13,opt,name=tcpmode_compress,json=tcpmodeCompress,proto3" json:"tcpmode_compress,omitempty"`
	TcpmodeStat          int32    `protobuf:"varint,14,opt,name=tcpmode_stat,json=tcpmodeStat,proto3" json:"tcpmode_stat,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MyMsg) Descriptor

func (*MyMsg) Descriptor() ([]byte, []int)

func (*MyMsg) GetData

func (m *MyMsg) GetData() []byte

func (*MyMsg) GetId

func (m *MyMsg) GetId() string

func (*MyMsg) GetKey

func (m *MyMsg) GetKey() int32

func (*MyMsg) GetMagic

func (m *MyMsg) GetMagic() int32

func (*MyMsg) GetRproto

func (m *MyMsg) GetRproto() int32

func (*MyMsg) GetTarget

func (m *MyMsg) GetTarget() string

func (*MyMsg) GetTcpmode

func (m *MyMsg) GetTcpmode() int32

func (*MyMsg) GetTcpmodeBuffersize

func (m *MyMsg) GetTcpmodeBuffersize() int32

func (*MyMsg) GetTcpmodeCompress

func (m *MyMsg) GetTcpmodeCompress() int32

func (*MyMsg) GetTcpmodeMaxwin

func (m *MyMsg) GetTcpmodeMaxwin() int32

func (*MyMsg) GetTcpmodeResendTimems

func (m *MyMsg) GetTcpmodeResendTimems() int32

func (*MyMsg) GetTcpmodeStat

func (m *MyMsg) GetTcpmodeStat() int32

func (*MyMsg) GetTimeout

func (m *MyMsg) GetTimeout() int32

func (*MyMsg) GetType

func (m *MyMsg) GetType() int32

func (*MyMsg) ProtoMessage

func (*MyMsg) ProtoMessage()

func (*MyMsg) Reset

func (m *MyMsg) Reset()

func (*MyMsg) String

func (m *MyMsg) String() string

func (*MyMsg) XXX_DiscardUnknown

func (m *MyMsg) XXX_DiscardUnknown()

func (*MyMsg) XXX_Marshal

func (m *MyMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MyMsg) XXX_Merge

func (m *MyMsg) XXX_Merge(src proto.Message)

func (*MyMsg) XXX_Size

func (m *MyMsg) XXX_Size() int

func (*MyMsg) XXX_Unmarshal

func (m *MyMsg) XXX_Unmarshal(b []byte) error

type MyMsg_TYPE

type MyMsg_TYPE int32
const (
	MyMsg_DATA  MyMsg_TYPE = 0
	MyMsg_PING  MyMsg_TYPE = 1
	MyMsg_KICK  MyMsg_TYPE = 2
	MyMsg_MAGIC MyMsg_TYPE = 57005
)

func (MyMsg_TYPE) EnumDescriptor

func (MyMsg_TYPE) EnumDescriptor() ([]byte, []int)

func (MyMsg_TYPE) String

func (x MyMsg_TYPE) String() string

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(key int, maxconn int, maxprocessthread int, maxprocessbuffer int, connecttmeout int) (*Server, error)

func (*Server) Recv

func (p *Server) Recv(conn *ServerConn, id string, src *net.IPAddr)

func (*Server) RecvTCP

func (p *Server) RecvTCP(conn *ServerConn, id string, src *net.IPAddr)

func (*Server) Run

func (p *Server) Run() error

func (*Server) Stop

func (p *Server) Stop()

type ServerConn

type ServerConn struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL