fix: tuic udp native mode can't relay packetSize>1200

This commit is contained in:
wwqgtxx
2023-03-16 21:09:44 +08:00
parent 998d407d44
commit 3ae4285702
7 changed files with 38 additions and 15 deletions

View File

@ -1,7 +1,6 @@
package tuic
import (
"fmt"
"net"
"net/netip"
"sync"
@ -201,7 +200,7 @@ func (q *quicStreamPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err err
func (q *quicStreamPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
if q.udpRelayMode != "quic" && len(p) > q.maxUdpRelayPacketSize {
return 0, fmt.Errorf("udp packet too large(%d > %d)", len(p), q.maxUdpRelayPacketSize)
return 0, quic.ErrMessageTooLarge(q.maxUdpRelayPacketSize)
}
if q.closed {
return 0, net.ErrClosed

View File

@ -282,6 +282,8 @@ func (c Packet) BytesLen() int {
return c.CommandHead.BytesLen() + 4 + 2 + c.ADDR.BytesLen() + len(c.DATA)
}
var PacketOverHead = NewPacket(0, 0, NewAddressAddrPort(netip.AddrPortFrom(netip.IPv6Unspecified(), 0)), nil).BytesLen()
type Dissociate struct {
CommandHead
ASSOC_ID uint32