Categorygithub.com/refraction-networking/uquic
modulepackage
0.0.6
Repository: https://github.com/refraction-networking/uquic.git
Documentation: pkg.go.dev

# README

drawing uQUIC

Go Build Status Ginkgo Test Status godoc

uQUIC is a fork of quic-go, which provides Initial Packet fingerprinting resistance and other features. While the handshake is still performed by quic-go, this library provides interface to customize the unencrypted Initial Packet which may reveal fingerprint-able information.

Golang 1.20+ is required.

If you have any questions, bug reports or contributions, you are welcome to publish those on GitHub. You may also reach out to one of the maintainers via [email protected].

Development is still in progress and we welcome any contributions adding new features or fixing extant bugs.

Disclaimer

This repository belongs to a large research project on how to fingerprint QUIC clients and how to mitigate such fingerprinting. We do not encourage any malicious use of this project's output, including this repository, uTLS, and clienthellod.

Our research paper is still yet to be published and therefore this repository is neither ready for production use nor peer-reviewed. And the scope of our research is limited that such mimicry backed by this library MAY NOT be realisticly indistinguishable from the real QUIC clients being mimicked, and some misuses of this library MAY lead to easier fingerprinting against the mimic. We welcome any contributions to improve the realism of the mimicry, as well as expanding the scope of this project.

For anyone intending to use this library for censorship circumvention, please be sure to understand the risks and limitations of this library.

If you are interested in our research, please stay tuned for our paper.

Development in Progress

Development Roadmap

  • Customize Initial Packet
    • QUIC Header
    • QUIC Frame (#3)
      • QUIC Crypto Frame
      • QUIC Padding Frame
      • QUIC Ping Frame
      • QUIC ACK Frame (on hold)
    • TLS ClientHello Message (by uTLS)
      • QUIC Transport Parameters (in a uTLS extension)
  • Customize Initial ACK behavior (#1, quic-go#4007)
  • Customize Initial Retry behavior (#2)
  • Add preset QUIC parrots
    • Google Chrome parrot (call for parrots w/ Token/PSK)
    • Mozilla Firefox parrot (call for parrots w/ Token/PSK)
    • Apple Safari parrot
    • Microsoft Edge parrot

Features

Initial Packet fingerprinting resistance

uQUIC provides a mechanism to customize the Initial Packet, which is unencrypted and is almost unique to every QUIC client implementation. We provide an interface to customize the Initial Packet and makes the fingerprinting of QUIC clients harder.

Build a QUIC Spec

A QUIC Spec sets parameters and policies for uQUIC in establishing a QUIC connection.

See u_parrot.go for examples of building a QUIC Spec (parrot).

Use a preset QUIC Spec

We provide a few preset QUIC Specs (parrots) for popular QUIC clients in u_parrot.go.

To use one, simple invoke QUICID2Spec(id). See below for a complete example of using a preset QUIC Spec in an HTTP3 client.

package main

import (
	"bytes"
	"fmt"
	"io"
	"log"
	"net/http"

	tls "github.com/refraction-networking/utls"

	quic "github.com/refraction-networking/uquic"
	"github.com/refraction-networking/uquic/http3"
)

func main() {
	roundTripper := &http3.RoundTripper{
		TLSClientConfig: &tls.Config{},
		QuicConfig:      &quic.Config{},
	}

	quicSpec, err := quic.QUICID2Spec(quic.QUICFirefox_116)
	// quicSpec, err := quic.QUICID2Spec(quic.QUICChrome_115)
	if err != nil {
		log.Fatal(err)
	}

	uRoundTripper := http3.GetURoundTripper(
		roundTripper,
		&quicSpec,
		// getCRQUICSpec(),
		nil,
	)
	defer uRoundTripper.Close()

	h3client := &http.Client{
		Transport: uRoundTripper,
	}

	addr := "https://quic.tlsfingerprint.io/qfp/?beautify=true"

	rsp, err := h3client.Get(addr)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Got response for %s: %#v", addr, rsp)

	body := &bytes.Buffer{}
	_, err = io.Copy(body, rsp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Response Body: %s", body.Bytes())
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package logging defines a logging interface for quic-go.
No description provided by the author
No description provided by the author
Package testutils contains utilities for simulating packet injection and man-in-the-middle (MITM) attacker tests.

# Functions

ConnectionIDFromBytes interprets b as a Connection ID.
Dial establishes a new QUIC connection to a server using a net.PacketConn.
DialAddr establishes a new QUIC connection to a server.
DialAddrEarly establishes a new 0-RTT QUIC connection to a server.
DialEarly establishes a new 0-RTT QUIC connection to a server using a net.PacketConn.
Listen listens for QUIC connections on a given net.PacketConn.
ListenAddr creates a QUIC server listening on a given address.
ListenAddrEarly works like ListenAddr, but it returns connections before the handshake completes.
ListenEarly works like Listen, but it returns connections before the handshake completes.
NewLRUTokenStore creates a new LRU cache for tokens received by the client.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PacketNumberLen1 is a packet number length of 1 byte.
PacketNumberLen2 is a packet number length of 2 bytes.
PacketNumberLen3 is a packet number length of 3 bytes.
PacketNumberLen4 is a packet number length of 4 bytes.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Version1 is RFC 9000.
Version2 is RFC 9369.

# Variables

ConnectionTracingKey can be used to associate a ConnectionTracer with a Connection.
Err0RTTRejected is the returned from: * Open{Uni}Stream{Sync} * Accept{Uni}Stream * Stream.Read and Stream.Write when the server rejects a 0-RTT connection attempt.
ErrServerClosed is returned by the Listener or EarlyListener's Accept method after a call to Close.
IPv4 is still more popular.
IPv4: UDP payload 20-byte longer than IPv6 due to padding.
IPv6.
point to most-popular 8-byte DCID.
DCID.len = 8.
DCID.len = 9.
DCID.len = 15.
QUICVersionContextKey can be used to find out the QUIC version of a TLS handshake from the context returned by tls.Config.ClientHelloInfo.Context.

# Structs

ClientHelloInfo contains information about an incoming connection attempt.
A ClientToken is a token received by the client.
Config contains all configuration data needed for a QUIC server or client.
ConnectionState records basic details about a QUIC connection.
DatagramTooLargeError is returned from Connection.SendDatagram if the payload is too large to be sent.
An EarlyListener listens for incoming QUIC connections, and returns them before the handshake completes.
No description provided by the author
A Listener listens for incoming QUIC connections.
QUICFrameCrypto is used to specify the crypto frames containing the TLS ClientHello to be sent in the first Initial packet.
QUICFramePadding is used to specify the padding frames to be sent in the first Initial packet.
QUICFramePing is used to specify the ping frames to be sent in the first Initial packet.
No description provided by the author
QUICRandomFrames could be used to indeterministically build QUIC Frames from crypto data.
No description provided by the author
A StreamError is used for Stream.CancelRead and Stream.CancelWrite.
The Transport is the central point to manage incoming and outgoing QUIC connections.
No description provided by the author

# Interfaces

A Connection is a QUIC connection between two peers.
A ConnectionIDGenerator is an interface that allows clients to implement their own format for the Connection IDs that servers/clients use as SrcConnectionID in QUIC packets.
An EarlyConnection is a connection that is handshaking.
OOBCapablePacketConn is a connection that allows the reading of ECN bits from the IP header.
QUICFrame is the interface for all QUIC frames to be included in the Initial Packet.
No description provided by the author
A ReceiveStream is a unidirectional Receive Stream.
A SendStream is a unidirectional Send Stream.
Stream is the interface implemented by QUIC streams In addition to the errors listed on the Connection, calls to stream functions can return a StreamError if the stream is canceled.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
A ConnectionID is a QUIC Connection ID, as defined in RFC 9000.
No description provided by the author
No description provided by the author
No description provided by the author
QUICFrames is a slice of QUICFrame that implements QUICFrameBuilder.
No description provided by the author
StatelessResetKey is a key used to derive stateless reset tokens.
No description provided by the author
The StreamID is the ID of a QUIC stream.
TokenGeneratorKey is a key used to encrypt session resumption tokens.
No description provided by the author
No description provided by the author
A Version is a QUIC version number.
No description provided by the author
A VersionNumber is a QUIC version number.