mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2026-10-19 16:15:38 +00:00
remove anonymous interfaces
This commit is contained in:
@@ -8,9 +8,6 @@ import (
|
||||
)
|
||||
|
||||
type RewindReader struct {
|
||||
io.Reader
|
||||
io.ByteReader
|
||||
|
||||
rawReader io.Reader
|
||||
buf []byte
|
||||
bufReadIdx int
|
||||
@@ -142,8 +139,6 @@ func NewRewindConn(conn net.Conn) *RewindConn {
|
||||
}
|
||||
|
||||
type StickyWriter struct {
|
||||
io.Writer
|
||||
|
||||
rawWriter io.Writer
|
||||
writeBuffer []byte
|
||||
MaxBuffered int
|
||||
|
||||
@@ -17,8 +17,6 @@ const (
|
||||
)
|
||||
|
||||
type Address struct {
|
||||
net.Addr
|
||||
|
||||
DomainName string
|
||||
Port int
|
||||
NetworkType string
|
||||
|
||||
@@ -12,8 +12,6 @@ import (
|
||||
)
|
||||
|
||||
type EasyOption struct {
|
||||
common.OptionHandler
|
||||
|
||||
server *bool
|
||||
client *bool
|
||||
password *string
|
||||
|
||||
@@ -45,9 +45,6 @@ func parseHTTPRequest(httpRequest *http.Request) *protocol.Request {
|
||||
}
|
||||
|
||||
type HTTPInboundTunnelConnSession struct {
|
||||
protocol.ConnSession
|
||||
protocol.NeedRespond
|
||||
|
||||
request *protocol.Request
|
||||
httpRequest *http.Request
|
||||
bufReader *bufio.Reader
|
||||
|
||||
@@ -29,8 +29,6 @@ const (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
net.Addr
|
||||
|
||||
Command
|
||||
*common.Address
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ import (
|
||||
)
|
||||
|
||||
type SimpleSocksConnSession struct {
|
||||
protocol.ConnSession
|
||||
|
||||
request *protocol.Request
|
||||
rwc io.ReadWriteCloser
|
||||
recv uint64
|
||||
|
||||
@@ -14,8 +14,6 @@ import (
|
||||
)
|
||||
|
||||
type SocksConnInboundSession struct {
|
||||
protocol.ConnSession
|
||||
protocol.NeedRespond
|
||||
request *protocol.Request
|
||||
rwc *common.RewindReadWriteCloser
|
||||
}
|
||||
@@ -117,8 +115,6 @@ type udpSession struct {
|
||||
}
|
||||
|
||||
type SocksInboundPacketSession struct {
|
||||
protocol.PacketSession
|
||||
|
||||
conn *net.UDPConn
|
||||
sessionTable map[string]*udpSession
|
||||
tableMutex sync.Mutex
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
)
|
||||
|
||||
type TProxyInboundConnSession struct {
|
||||
protocol.ConnSession
|
||||
reqeust *protocol.Request
|
||||
conn net.Conn
|
||||
}
|
||||
@@ -75,7 +74,6 @@ type udpSession struct {
|
||||
}
|
||||
|
||||
type NATInboundPacketSession struct {
|
||||
protocol.PacketSession
|
||||
request *protocol.Request
|
||||
conn *net.UDPConn
|
||||
tableMutex sync.Mutex
|
||||
|
||||
@@ -14,8 +14,6 @@ import (
|
||||
)
|
||||
|
||||
type TrojanInboundConnSession struct {
|
||||
protocol.ConnSession
|
||||
|
||||
rwc io.ReadWriteCloser
|
||||
ctx context.Context
|
||||
config *conf.GlobalConfig
|
||||
@@ -85,7 +83,7 @@ func (i *TrojanInboundConnSession) parseRequest(r *common.RewindReader) error {
|
||||
}
|
||||
|
||||
func NewInboundConnSession(ctx context.Context, conn net.Conn, config *conf.GlobalConfig, auth stat.Authenticator, shadowMan *shadow.ShadowManager) (protocol.ConnSession, *protocol.Request, error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
rewindConn := common.NewRewindConn(conn)
|
||||
ip, _, err := net.SplitHostPort(conn.RemoteAddr().String())
|
||||
common.Must(err)
|
||||
|
||||
@@ -12,8 +12,6 @@ import (
|
||||
)
|
||||
|
||||
type TrojanOutboundConnSession struct {
|
||||
protocol.ConnSession
|
||||
|
||||
config *conf.GlobalConfig
|
||||
rwc io.ReadWriteCloser
|
||||
request *protocol.Request
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
)
|
||||
|
||||
type TrojanPacketSession struct {
|
||||
protocol.PacketSession
|
||||
conn io.ReadWriteCloser
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,6 @@ type packetInfo struct {
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
common.Runnable
|
||||
proxy.Buildable
|
||||
|
||||
config *conf.GlobalConfig
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
|
||||
@@ -21,9 +21,6 @@ type dispatchInfo struct {
|
||||
}
|
||||
|
||||
type Forward struct {
|
||||
common.Runnable
|
||||
proxy.Buildable
|
||||
|
||||
config *conf.GlobalConfig
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
|
||||
@@ -18,9 +18,6 @@ import (
|
||||
)
|
||||
|
||||
type NAT struct {
|
||||
common.Runnable
|
||||
proxy.Buildable
|
||||
|
||||
config *conf.GlobalConfig
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
)
|
||||
|
||||
type Relay struct {
|
||||
common.Runnable
|
||||
config *conf.GlobalConfig
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
|
||||
@@ -22,9 +22,6 @@ import (
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
common.Runnable
|
||||
proxy.Buildable
|
||||
|
||||
listener net.Listener
|
||||
auth stat.Authenticator
|
||||
config *conf.GlobalConfig
|
||||
|
||||
+3
-4
@@ -9,8 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type versionOption struct {
|
||||
arg *bool
|
||||
common.OptionHandler
|
||||
flag *bool
|
||||
}
|
||||
|
||||
func (*versionOption) Name() string {
|
||||
@@ -22,7 +21,7 @@ func (*versionOption) Priority() int {
|
||||
}
|
||||
|
||||
func (c *versionOption) Handle() error {
|
||||
if *c.arg {
|
||||
if *c.flag {
|
||||
fmt.Println("Trojan-Go", common.Version, fmt.Sprintf("(%s %s/%s)", runtime.Version(), runtime.GOOS, runtime.GOARCH))
|
||||
fmt.Println("Developed by PageFault (p4gefau1t)")
|
||||
fmt.Println("Lisensed under GNU General Public License v3")
|
||||
@@ -35,6 +34,6 @@ func (c *versionOption) Handle() error {
|
||||
|
||||
func init() {
|
||||
common.RegisterOptionHandler(&versionOption{
|
||||
arg: flag.Bool("version", false, "Display version and help info"),
|
||||
flag: flag.Bool("version", false, "Display version and help info"),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user