Skip to content
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

How to craft a PING frame? #1

Open
Anirudh533 opened this issue Mar 14, 2022 · 4 comments
Open

How to craft a PING frame? #1

Anirudh533 opened this issue Mar 14, 2022 · 4 comments

Comments

@Anirudh533
Copy link

Hey there,

Your project looks cool. Appreciate it 👏🏻 . I'm relatively new to golang. Can you tell me on how to send a PING frame in QUIC via golang?

Thank you in advance.

@kelmenhorst
Copy link
Owner

Hi, thanks for reaching out!

This project was actually my first preliminary of QUIC ping. You can find the finished version as part of the OONI project here: https://github.com/ooni/probe-cli/tree/master/internal/engine/experiment/quicping

Probably important to note here: This ping is not an official part of the QUIC standard. I have developed the idea as an attempt to measure the availability of QUIC/UDP hosts without establishing a real QUIC connection (and it works quite well).
There is a concept of a PING frame in the QUIC RFC, however, this PING frame refers to connection keep-alives in an established connection.

So, what a QUIC ping in this context?

  • a QUIC Initial packet with a size of 1200 bytes (minimum datagram size defined in the RFC 9000),
  • with a random payload (i.e. no TLS ClientHello),
  • with the version string 0xbabababa which forces Version Negotiation at the server.

QUIC-able hosts respond to the QUIC PING with a Version Negotiation packet.

If you wanna try it out, run

go mod init quicping
go get golang.org/x/crypto/hkdf
go build .
./quicping google.com:443

in this project's folder and observe the network activity on wireshark :-)

I hope that answers your question.

@Anirudh533
Copy link
Author

Anirudh533 commented Mar 15, 2022

Hi,

Thank you so much for responding. Yes, I was able to understand and run your project locally. It's really cool. I wanted to generate a PING frame(0x00000001) that is used to keep connections alive as per QUIC RFC document to try it out locally and for understanding it. Any suggestions on how can I do it?

Thank you,
Anirudh

@kelmenhorst
Copy link
Owner

As far as I know, you cannot manually send a PING frame with quic-go. I think there is a field in the quic.Config (KeepAlive) which you can set to True to enable the periodical sending of QUIC PING frames.

In general, if you want to do this yourself, you need to establish a QUIC connection and get access to the underlying UDP connection, create a PING frame from scratch (it's very easy, see in thr RFC) and then send it over the connection.

Maybe there is another QUIC implementation that I don't know about which lets you send PING frames manually.

Have a good day,
Kathrin

@Anirudh533
Copy link
Author

Hi @kelmenhorst ,

Thank you so much for sharing. I shall look into it. 😄

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