mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 07:26:24 -05:00
Remove unnecessary code in socks io
This commit is contained in:
parent
7cfcc58f19
commit
6746800a21
@ -77,12 +77,8 @@ func NewAuthenticationResponse(authMethod byte) *Socks5AuthenticationResponse {
|
|||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Socks5AuthenticationResponse) ToBytes() []byte {
|
func WriteAuthentication(writer io.Writer, r *Socks5AuthenticationResponse) error {
|
||||||
return []byte{r.version, r.authMethod}
|
_, err := writer.Write([]byte{r.version, r.authMethod})
|
||||||
}
|
|
||||||
|
|
||||||
func WriteAuthentication(writer io.Writer, response *Socks5AuthenticationResponse) error {
|
|
||||||
_, err := writer.Write(response.ToBytes())
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,18 +22,6 @@ func TestAuthenticationRequestRead(t *testing.T) {
|
|||||||
assert.Byte(request.authMethods[0]).Named("Auth Method").Equals(0x02)
|
assert.Byte(request.authMethods[0]).Named("Auth Method").Equals(0x02)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthenticationResponseToBytes(t *testing.T) {
|
|
||||||
assert := unit.Assert(t)
|
|
||||||
|
|
||||||
socksVersion := uint8(5)
|
|
||||||
authMethod := uint8(1)
|
|
||||||
response := Socks5AuthenticationResponse{socksVersion, authMethod}
|
|
||||||
bytes := response.ToBytes()
|
|
||||||
|
|
||||||
assert.Byte(bytes[0]).Named("Version").Equals(socksVersion)
|
|
||||||
assert.Byte(bytes[1]).Named("Auth Method").Equals(authMethod)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRequestRead(t *testing.T) {
|
func TestRequestRead(t *testing.T) {
|
||||||
assert := unit.Assert(t)
|
assert := unit.Assert(t)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user