mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Clean unnecessary code in Trojan
This commit is contained in:
parent
846d3ebd6c
commit
6d4194415d
8 changed files with 63 additions and 97 deletions
|
@ -77,22 +77,12 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
|||
|
||||
defer conn.Close()
|
||||
|
||||
iConn := conn
|
||||
statConn, ok := iConn.(*stat.CounterConnection)
|
||||
if ok {
|
||||
iConn = statConn.Connection
|
||||
}
|
||||
|
||||
user := server.PickUser()
|
||||
account, ok := user.Account.(*MemoryAccount)
|
||||
if !ok {
|
||||
return newError("user account is not valid")
|
||||
}
|
||||
|
||||
connWriter := &ConnWriter{
|
||||
Flow: account.Flow,
|
||||
}
|
||||
|
||||
var newCtx context.Context
|
||||
var newCancel context.CancelFunc
|
||||
if session.TimeoutOnlyFromContext(ctx) {
|
||||
|
@ -113,9 +103,11 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
|||
|
||||
bufferWriter := buf.NewBufferedWriter(buf.NewWriter(conn))
|
||||
|
||||
connWriter.Writer = bufferWriter
|
||||
connWriter.Target = destination
|
||||
connWriter.Account = account
|
||||
connWriter := &ConnWriter{
|
||||
Writer: bufferWriter,
|
||||
Target: destination,
|
||||
Account: account,
|
||||
}
|
||||
|
||||
var bodyWriter buf.Writer
|
||||
if destination.Network == net.Network_UDP {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue