Skip to content

Import path: gitlab.soludian.com/soludian/fountain/clients/fquic_client

fquic_client

go
import "gitlab.soludian.com/soludian/fountain/clients/fquic_client"

Index

Constants

go
const (
    KPackageName = "fquic_client"
)

Variables

go
var KDefaultClientName = env.GetFullAppService(KPackageName)

type Client

Client represents a QUIC client

go
type Client struct {
    // contains filtered or unexported fields
}

func GetFountainInstance

go
func GetFountainInstance(opts ...Option) *Client

GetFountainInstance is an alias for InstallFountainInstance for compatibility

func InstallFountainInstance

go
func InstallFountainInstance(opts ...Option) *Client

InstallFountainInstance creates and configures a QUIC client

func New

go
func New() *Client

New creates a new QUIC client with default configuration

func NewClient

go
func NewClient(c *config) *Client

NewClient creates a new QUIC client with the given configuration

func WithConfig

go
func WithConfig(c *config) *Client

WithConfig creates a new QUIC client with provided configuration

func WithConfigKey

go
func WithConfigKey(configKey string) *Client

WithConfigKey creates a new QUIC client with configuration from config key

func (*Client) AcceptStream

go
func (c *Client) AcceptStream(ctx context.Context) (*quic.Stream, error)

AcceptStream accepts an incoming stream

func (*Client) AcceptUniStream

go
func (c *Client) AcceptUniStream(ctx context.Context) (*quic.ReceiveStream, error)

AcceptUniStream accepts an incoming unidirectional stream

func (*Client) Connect

go
func (c *Client) Connect(ctx context.Context) error

Connect establishes a connection to the QUIC server

func (*Client) Disconnect

go
func (c *Client) Disconnect() error

Disconnect closes the connection to the QUIC server

func (*Client) GetConnectionState

go
func (c *Client) GetConnectionState() quic.ConnectionState

GetConnectionState returns the connection state

func (*Client) GetLocalAddr

go
func (c *Client) GetLocalAddr() net.Addr

GetLocalAddr returns the local address of the connection

func (*Client) GetRemoteAddr

go
func (c *Client) GetRemoteAddr() net.Addr

GetRemoteAddr returns the remote address of the connection

func (*Client) IsConnected

go
func (c *Client) IsConnected() bool

IsConnected returns whether the client is connected

func (*Client) OpenStream

go
func (c *Client) OpenStream(ctx context.Context) (*quic.Stream, error)

OpenStream opens a new bidirectional stream

func (*Client) OpenUniStream

go
func (c *Client) OpenUniStream(ctx context.Context) (*quic.SendStream, error)

OpenUniStream opens a new unidirectional stream

func (*Client) Ping

go
func (c *Client) Ping(ctx context.Context) error

Ping sends a ping frame to keep the connection alive

func (*Client) ReceiveDatagram

go
func (c *Client) ReceiveDatagram(ctx context.Context) ([]byte, error)

ReceiveDatagram receives a datagram

func (*Client) SendDatagram

go
func (c *Client) SendDatagram(data []byte) error

SendDatagram sends a datagram

type Option

Option defines the interface for configuring QUIC client options

go
type Option interface {
    Apply(c *config)
}

func WithConnectionReceiveWindow

go
func WithConnectionReceiveWindow(initial, max uint64) Option

WithConnectionReceiveWindow sets the initial and maximum connection receive window

func WithConnectionTimeout

go
func WithConnectionTimeout(timeout time.Duration) Option

WithConnectionTimeout sets the connection timeout

func WithDatagrams

go
func WithDatagrams(enable bool) Option

WithDatagrams enables or disables datagram support

func WithHandshakeIdleTimeout

go
func WithHandshakeIdleTimeout(timeout time.Duration) Option

WithHandshakeIdleTimeout sets the handshake idle timeout

func WithInsecureSkipVerify

go
func WithInsecureSkipVerify(skip bool) Option

WithInsecureSkipVerify sets whether to skip TLS verification

func WithKeepAlivePeriod

go
func WithKeepAlivePeriod(period time.Duration) Option

WithKeepAlivePeriod sets the keep-alive period

func WithMaxIdleTimeout

go
func WithMaxIdleTimeout(timeout time.Duration) Option

WithMaxIdleTimeout sets the maximum idle timeout

func WithMaxIncomingStreams

go
func WithMaxIncomingStreams(max int64) Option

WithMaxIncomingStreams sets the maximum number of incoming bidirectional streams

func WithMaxIncomingUniStreams

go
func WithMaxIncomingUniStreams(max int64) Option

WithMaxIncomingUniStreams sets the maximum number of incoming unidirectional streams

func WithMetrics

go
func WithMetrics(enable bool) Option

WithMetrics enables or disables metrics

func WithName

go
func WithName(name string) Option

WithName sets the client name

func WithRetrySettings

go
func WithRetrySettings(maxAttempts int, delay time.Duration) Option

WithRetrySettings sets the retry maximum attempts and delay

func WithServerAddr

go
func WithServerAddr(addr string) Option

WithServerAddr sets the server address

func WithServerName

go
func WithServerName(name string) Option

WithServerName sets the server name for TLS verification

func WithSlowLogThreshold

go
func WithSlowLogThreshold(threshold time.Duration) Option

WithSlowLogThreshold sets the slow log threshold

func WithStreamReceiveWindow

go
func WithStreamReceiveWindow(initial, max uint64) Option

WithStreamReceiveWindow sets the initial and maximum stream receive window

type OptionFunc

OptionFunc is a function that implements the Option interface

go
type OptionFunc func(c *config)

func (OptionFunc) Apply

go
func (f OptionFunc) Apply(c *config)

Apply implements the Option interface

Generated by gomarkdoc