Import path:
gitlab.soludian.com/soludian/fountain/clients/fquic_client
fquic_client
import "gitlab.soludian.com/soludian/fountain/clients/fquic_client"Index
- Constants
- Variables
- type Client
- func GetFountainInstance(opts ...Option) *Client
- func InstallFountainInstance(opts ...Option) *Client
- func New() *Client
- func NewClient(c *config) *Client
- func WithConfig(c *config) *Client
- func WithConfigKey(configKey string) *Client
- func (c *Client) AcceptStream(ctx context.Context) (*quic.Stream, error)
- func (c *Client) AcceptUniStream(ctx context.Context) (*quic.ReceiveStream, error)
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) Disconnect() error
- func (c *Client) GetConnectionState() quic.ConnectionState
- func (c *Client) GetLocalAddr() net.Addr
- func (c *Client) GetRemoteAddr() net.Addr
- func (c *Client) IsConnected() bool
- func (c *Client) OpenStream(ctx context.Context) (*quic.Stream, error)
- func (c *Client) OpenUniStream(ctx context.Context) (*quic.SendStream, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) ReceiveDatagram(ctx context.Context) ([]byte, error)
- func (c *Client) SendDatagram(data []byte) error
- type Option
- func WithConnectionReceiveWindow(initial, max uint64) Option
- func WithConnectionTimeout(timeout time.Duration) Option
- func WithDatagrams(enable bool) Option
- func WithHandshakeIdleTimeout(timeout time.Duration) Option
- func WithInsecureSkipVerify(skip bool) Option
- func WithKeepAlivePeriod(period time.Duration) Option
- func WithMaxIdleTimeout(timeout time.Duration) Option
- func WithMaxIncomingStreams(max int64) Option
- func WithMaxIncomingUniStreams(max int64) Option
- func WithMetrics(enable bool) Option
- func WithName(name string) Option
- func WithRetrySettings(maxAttempts int, delay time.Duration) Option
- func WithServerAddr(addr string) Option
- func WithServerName(name string) Option
- func WithSlowLogThreshold(threshold time.Duration) Option
- func WithStreamReceiveWindow(initial, max uint64) Option
- type OptionFunc
Constants
const (
KPackageName = "fquic_client"
)Variables
var KDefaultClientName = env.GetFullAppService(KPackageName)type Client
Client represents a QUIC client
type Client struct {
// contains filtered or unexported fields
}func GetFountainInstance
func GetFountainInstance(opts ...Option) *ClientGetFountainInstance is an alias for InstallFountainInstance for compatibility
func InstallFountainInstance
func InstallFountainInstance(opts ...Option) *ClientInstallFountainInstance creates and configures a QUIC client
func New
func New() *ClientNew creates a new QUIC client with default configuration
func NewClient
func NewClient(c *config) *ClientNewClient creates a new QUIC client with the given configuration
func WithConfig
func WithConfig(c *config) *ClientWithConfig creates a new QUIC client with provided configuration
func WithConfigKey
func WithConfigKey(configKey string) *ClientWithConfigKey creates a new QUIC client with configuration from config key
func (*Client) AcceptStream
func (c *Client) AcceptStream(ctx context.Context) (*quic.Stream, error)AcceptStream accepts an incoming stream
func (*Client) AcceptUniStream
func (c *Client) AcceptUniStream(ctx context.Context) (*quic.ReceiveStream, error)AcceptUniStream accepts an incoming unidirectional stream
func (*Client) Connect
func (c *Client) Connect(ctx context.Context) errorConnect establishes a connection to the QUIC server
func (*Client) Disconnect
func (c *Client) Disconnect() errorDisconnect closes the connection to the QUIC server
func (*Client) GetConnectionState
func (c *Client) GetConnectionState() quic.ConnectionStateGetConnectionState returns the connection state
func (*Client) GetLocalAddr
func (c *Client) GetLocalAddr() net.AddrGetLocalAddr returns the local address of the connection
func (*Client) GetRemoteAddr
func (c *Client) GetRemoteAddr() net.AddrGetRemoteAddr returns the remote address of the connection
func (*Client) IsConnected
func (c *Client) IsConnected() boolIsConnected returns whether the client is connected
func (*Client) OpenStream
func (c *Client) OpenStream(ctx context.Context) (*quic.Stream, error)OpenStream opens a new bidirectional stream
func (*Client) OpenUniStream
func (c *Client) OpenUniStream(ctx context.Context) (*quic.SendStream, error)OpenUniStream opens a new unidirectional stream
func (*Client) Ping
func (c *Client) Ping(ctx context.Context) errorPing sends a ping frame to keep the connection alive
func (*Client) ReceiveDatagram
func (c *Client) ReceiveDatagram(ctx context.Context) ([]byte, error)ReceiveDatagram receives a datagram
func (*Client) SendDatagram
func (c *Client) SendDatagram(data []byte) errorSendDatagram sends a datagram
type Option
Option defines the interface for configuring QUIC client options
type Option interface {
Apply(c *config)
}func WithConnectionReceiveWindow
func WithConnectionReceiveWindow(initial, max uint64) OptionWithConnectionReceiveWindow sets the initial and maximum connection receive window
func WithConnectionTimeout
func WithConnectionTimeout(timeout time.Duration) OptionWithConnectionTimeout sets the connection timeout
func WithDatagrams
func WithDatagrams(enable bool) OptionWithDatagrams enables or disables datagram support
func WithHandshakeIdleTimeout
func WithHandshakeIdleTimeout(timeout time.Duration) OptionWithHandshakeIdleTimeout sets the handshake idle timeout
func WithInsecureSkipVerify
func WithInsecureSkipVerify(skip bool) OptionWithInsecureSkipVerify sets whether to skip TLS verification
func WithKeepAlivePeriod
func WithKeepAlivePeriod(period time.Duration) OptionWithKeepAlivePeriod sets the keep-alive period
func WithMaxIdleTimeout
func WithMaxIdleTimeout(timeout time.Duration) OptionWithMaxIdleTimeout sets the maximum idle timeout
func WithMaxIncomingStreams
func WithMaxIncomingStreams(max int64) OptionWithMaxIncomingStreams sets the maximum number of incoming bidirectional streams
func WithMaxIncomingUniStreams
func WithMaxIncomingUniStreams(max int64) OptionWithMaxIncomingUniStreams sets the maximum number of incoming unidirectional streams
func WithMetrics
func WithMetrics(enable bool) OptionWithMetrics enables or disables metrics
func WithName
func WithName(name string) OptionWithName sets the client name
func WithRetrySettings
func WithRetrySettings(maxAttempts int, delay time.Duration) OptionWithRetrySettings sets the retry maximum attempts and delay
func WithServerAddr
func WithServerAddr(addr string) OptionWithServerAddr sets the server address
func WithServerName
func WithServerName(name string) OptionWithServerName sets the server name for TLS verification
func WithSlowLogThreshold
func WithSlowLogThreshold(threshold time.Duration) OptionWithSlowLogThreshold sets the slow log threshold
func WithStreamReceiveWindow
func WithStreamReceiveWindow(initial, max uint64) OptionWithStreamReceiveWindow sets the initial and maximum stream receive window
type OptionFunc
OptionFunc is a function that implements the Option interface
type OptionFunc func(c *config)func (OptionFunc) Apply
func (f OptionFunc) Apply(c *config)Apply implements the Option interface
Generated by gomarkdoc