Skip to content

How to use with QUIC without running into DATAGRAM frame too large error #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LeonardWalter opened this issue Dec 5, 2024 · 3 comments

Comments

@LeonardWalter
Copy link

Hi,
I am trying to build a DoQ client combined with a masque proxy.
Currently I am using this code to connect to my DoQ server at myurl:8853:

	template := uritemplate.MustNew("https://myurl.org:9443/masque?h={target_host}&p={target_port}")
	target := "myurl.org:8853"

	raddr, err := net.ResolveUDPAddr("udp", target)
	if err != nil {
		log.Fatalf("failed to resolve udp addr: %v", err)
		return
	}

	cl := masque.Client{
		QUICConfig: &quic.Config{
			EnableDatagrams:   true,
			InitialPacketSize: 1350,
		},
	}

	pconn, _, err := cl.Dial(context.Background(), template, raddr)
	if err != nil {
		log.Fatalf("failed to dial masque proxy: %v", err)
		return
	}

	qc := new(quic.Config)
	qc.DisablePathMTUDiscovery = true
	tc := new(tls.Config)
	tc.ServerName = "myurl.org"
	tc.NextProtos = []string{"doq"}

	earlyConn, err := quic.DialEarly(context.Background(), pconn, raddr, tc, qc)
	if err != nil {
		log.Fatalf("failed to dial target via masque proxy: %v", err)
		return
	}

Everything seems to work fine with the client, but on the proxy I always receive following error, which causes the quic.DialEarly to fail.
2024/12/05 13:57:38 proxying receive side to [2a02:****:5d33]:8853 failed: DATAGRAM frame too large

I already tried different quic.Config InitialPacketSize values for both inner quic and outer masque stream but I cant get it to work.

@marten-seemann
Copy link
Member

Is this an error that is sent over the connection or is it the local error returned. Unfortunately, they currently have the same string representation:
https://github.com/quic-go/quic-go/blob/108b6603c877807f77a89b472e5fd2fef44fafd4/errors.go#L65-L75

and:
https://github.com/quic-go/quic-go/blob/108b6603c877807f77a89b472e5fd2fef44fafd4/connection.go#L1640-L1649

@LeonardWalter
Copy link
Author

Both, depending on the InitialPacketSize.

When I test it with InitialPacketSize: 1350,
This error shows up locally:
failed to dial target via masque proxy: INTERNAL_ERROR (local): EOF
and this on the proxy:
proxying receive side to [2a02:xxxx:5d33]:8853 failed: DATAGRAM frame too large

Now when I decrease the InitialPacketSize: 1250,
This error shows up locally:
failed to dial target via masque proxy: INTERNAL_ERROR (local): DATAGRAM frame too large
and this on the proxy:
proxying send side to [2a02:xxxx:5d33]:8853 failed: timeout: no recent network activity

@LeonardWalter
Copy link
Author

Just wanted to update that I managed to solve this by setting InitialPacketSize: 1400 on the client and InitialPacketSize: 1500 on the proxy. Manually setting it, and setting it to a higher value on the proxy than on the client was essential here for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants