Fix socks4 response

This commit is contained in:
世界 2022-07-22 13:48:50 +08:00
parent eeac9e8a1e
commit 4ce9815aca
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -120,8 +120,8 @@ func ReadResponse(reader io.Reader) (response Response, err error) {
if err != nil { if err != nil {
return return
} }
if version != 4 { if version != 0 {
err = E.New("excepted socks version 4, got ", version) err = E.New("excepted socks4 response version 0, got ", version)
return return
} }
response.ReplyCode, err = rw.ReadByte(reader) response.ReplyCode, err = rw.ReadByte(reader)
@ -142,7 +142,7 @@ func ReadResponse(reader io.Reader) (response Response, err error) {
} }
func WriteResponse(writer io.Writer, response Response) error { func WriteResponse(writer io.Writer, response Response) error {
_, err := writer.Write([]byte{Version, response.ReplyCode}) _, err := writer.Write([]byte{0, response.ReplyCode})
if err != nil { if err != nil {
return err return err
} }