1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-06 13:55:27 -04:00
This commit is contained in:
Darien Raymond
2017-12-14 15:02:36 +01:00
parent 6797483fe0
commit 484bdeecc9
4 changed files with 8 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ const (
AddrTypeDomain = 3
)
// ReadTCPSession reads a Shadowsocks TCP session from the given reader, returns its header and remaining parts.
func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHeader, buf.Reader, error) {
rawAccount, err := user.GetTypedAccount()
if err != nil {
@@ -136,6 +137,7 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea
return request, chunkReader, nil
}
// WriteTCPRequest writes Shadowsocks request into the given writer, and returns a writer for body.
func WriteTCPRequest(request *protocol.RequestHeader, writer io.Writer) (buf.Writer, error) {
user := request.User
rawAccount, err := user.GetTypedAccount()