Skip to content

Commit

Permalink
2024-10-04 14:02:24
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Oct 4, 2024
1 parent a294b98 commit 785c00e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions protocol/ashe/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ func (c *UDPConn) Write(p []byte) (int, error) {
// Maximum udp payload size is 65527(equal to 65535 - 8) bytes in theoretically. The 8 in the formula means the udp
// header, which contains source port, destination port, length and checksum.
doa.Doa(len(p) <= 65527)
b := make([]byte, 2)
b := make([]byte, 2+len(p))
binary.BigEndian.PutUint16(b, uint16(len(p)))
_, err := c.ReadWriteCloser.Write(b)
copy(b[2:], p)
n, err := c.ReadWriteCloser.Write(b)
if err != nil {
return 0, err
}
return c.ReadWriteCloser.Write(p)
return n - 2, nil
}

// Server implemented the ashe protocol. The ashe server will typically evaluate the request based on source and
Expand Down

0 comments on commit 785c00e

Please sign in to comment.