h3conn

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 12 Imported by: 0

README

h3conn

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHTTP3GetAddr = fmt.Errorf("HTTP3 get addr fail")
View Source
var ErrHTTP3NotSupported = fmt.Errorf("HTTP3 not supported")

Functions

This section is empty.

Types

type Client

type Client struct {
	RoundTripper *http3.RoundTripper
}

func NewClient

func NewClient(tlsConfig *tls.Config) *Client

func (*Client) Connect

func (c *Client) Connect(urlStr string, timeout time.Duration, header http.Header) (*Conn, *http.Response, error)

type Conn

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

Conn is client/server symmetric connection. It implements the io.Reader/io.Writer/io.Closer to read/write or close the connection to the other side. It also has a Send/Recv function to use channels to communicate with the other side.

func Accept

func Accept(w http.ResponseWriter, r *http.Request) (*Conn, error)

func Connect

func Connect(urlStr string, timeout time.Duration) (*Conn, *http.Response, error)

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Conn) Read

func (c *Conn) Read(data []byte) (int, error)

Read reads data from the connection

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Conn) Write

func (c *Conn) Write(data []byte) (int, error)

Write writes data to the connection

type Upgrader

type Upgrader struct {
	StatusCode int
}

func (*Upgrader) Accept

func (u *Upgrader) Accept(w http.ResponseWriter, r *http.Request) (*Conn, error)

Jump to

Keyboard shortcuts

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