Remove 4in6 cast

This commit is contained in:
世界 2022-09-25 17:59:18 +08:00
parent 86d7d51023
commit b12b8b7fd2
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
7 changed files with 36 additions and 24 deletions

View file

@ -18,5 +18,5 @@ func SourceAddress(request *http.Request) M.Socksaddr {
}
}
}
return address
return address.Unwrap()
}

View file

@ -96,7 +96,7 @@ func WriteRequest(writer io.Writer, request Request) error {
binary.Write(buffer, binary.BigEndian, request.Destination.Port),
)
if request.Destination.IsIPv4() {
common.Must1(buffer.Write(request.Destination.Unwrap().Addr.AsSlice()))
common.Must1(buffer.Write(request.Destination.Addr.AsSlice()))
} else {
// 0.0.0.X
common.Must(buffer.WriteZeroN(3))
@ -153,7 +153,7 @@ func WriteResponse(writer io.Writer, response Response) error {
buffer.WriteByte(0),
buffer.WriteByte(response.ReplyCode),
binary.Write(buffer, binary.BigEndian, response.Destination.Port),
common.Error(buffer.Write(response.Destination.Unwrap().Addr.AsSlice())),
common.Error(buffer.Write(response.Destination.Addr.AsSlice())),
)
return rw.WriteBytes(writer, buffer.Bytes())
}