masque

package
v0.0.0-...-be52c3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package masque copy and modify from https://github.com/Diniboy1123/usque/blob/d0eb96e7e5c56cce6cf34a7f8d75abbedba58fef/api/masque.go

Index

Constants

View Source
const (
	ConnectSNI = "consumer-masque.cloudflareclient.com"
	ConnectURI = "https://cloudflareaccess.com"
)
View Source
const (
	L4ConnectSNI = "consumer-masque-proxy.cloudflareclient.com"
)

Variables

This section is empty.

Functions

func ConnectTunnel

func ConnectTunnel(ctx context.Context, quicConn *quic.Conn, connectUri string) (*http3.Transport, *connectip.Conn, error)

ConnectTunnel establishes a QUIC connection and sets up a Connect-IP tunnel with the provided endpoint. Endpoint address is used to check whether the authentication/connection is successful or not. Requires modified connect-ip-go for now to support Cloudflare's non RFC compliant implementation.

func GenerateCert

func GenerateCert(privKey *ecdsa.PrivateKey) ([][]byte, error)

func PrepareTlsConfig

func PrepareTlsConfig(privKey *ecdsa.PrivateKey, peerPubKey *ecdsa.PublicKey, sni string, insecure bool) (*tls.Config, error)

PrepareTlsConfig creates a TLS configuration using the provided certificate and SNI (Server Name Indication). It also verifies the peer's public key against the provided public key.

Types

type DialQuicFn

type DialQuicFn func(ctx context.Context) (net.PacketConn, *quic.Conn, error)

type IpConn

type IpConn interface {
	ReadPacket() (b []byte, err error)
	WritePacket(b []byte) (icmp []byte, err error)
	Close() error
}

func ConnectTunnelH2

func ConnectTunnelH2(ctx context.Context, h2Transport *http.Transport, connectUri string) (*http.ClientConn, IpConn, error)

type L4Client

type L4Client struct {
	// contains filtered or unexported fields
}

func NewL4Client

func NewL4Client(runCtx context.Context, dialFn DialQuicFn) *L4Client

func (*L4Client) Close

func (c *L4Client) Close() error

Close closes the client. The caller should cancel runCtx before calling Close

func (*L4Client) DialContext

func (c *L4Client) DialContext(ctx context.Context, network, address string) (net.Conn, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址