connection

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecvTransactionHandshake

func RecvTransactionHandshake(stream *qpStream.Stream) (*pb.Transaction, error)

RecvTransactionHandshake receives a transaction request from the client when a transaction is opened. This method is used internally when opening a transaction. So, you may don't need to use it directly.

func TransactionHandshake

func TransactionHandshake(stream *qpStream.Stream, transactionName string, transactionID []byte) error

TransactionHandshake sends a transaction request to the server when a transaction is opened. This method is used internally when opening a transaction. So, you may don't need to use it directly.

Types

type Connection

type Connection struct {
	Conn quic.Connection
	// contains filtered or unexported fields
}

Connection is a connection instance that is created when a client connects to a server.

func New

func New(logLevel int, conn quic.Connection) (*Connection, error)

New creates a new connection instance. This method is used internally by quics-protocol. So, you may don't need to use it directly.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection.

func (*Connection) CloseWithError

func (c *Connection) CloseWithError(message string) error

CloseWithError closes the connection with an error message.

func (*Connection) OpenTransaction

func (c *Connection) OpenTransaction(transactionName string, transactionFunc func(stream *qpStream.Stream, transactionName string, transactionID []byte) error) error

OpenTransaction opens a transaction to the server. The transaction name and transaction function are needed as parameters. The transaction name is used to determine which handler to use on the receiving side. `transactionFunc“ is called when the transaction is opened. The stream, transaction name, and transaction id are passed as parameters. The stream is used to send and receive messages and files.

Jump to

Keyboard shortcuts

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