Fix WriteAddrPort usage

This commit is contained in:
世界 2023-09-07 08:53:26 +08:00
parent 2a10ebd53b
commit 7befbadbf3
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 28 additions and 14 deletions

View file

@ -143,7 +143,7 @@ func streamRequestLen(request StreamRequest) int {
return rLen
}
func EncodeStreamRequest(request StreamRequest, buffer *buf.Buffer) {
func EncodeStreamRequest(request StreamRequest, buffer *buf.Buffer) error {
destination := request.Destination
var flags uint16
if request.Network == N.NetworkUDP {
@ -155,10 +155,8 @@ func EncodeStreamRequest(request StreamRequest, buffer *buf.Buffer) {
destination = Destination
}
}
common.Must(
binary.Write(buffer, binary.BigEndian, flags),
M.SocksaddrSerializer.WriteAddrPort(buffer, destination),
)
common.Must(binary.Write(buffer, binary.BigEndian, flags))
return M.SocksaddrSerializer.WriteAddrPort(buffer, destination)
}
type StreamResponse struct {