hopp/connection.go

22 lines
564 B
Go
Raw Normal View History

2025-01-09 00:31:15 -07:00
package hopp
import "io"
import "context"
// Conn is a HOPP connection.
type Conn interface {
io.Closer
OpenTrans(ctx context.Context) (Trans, error)
AcceptTrans(ctx context.Context) (Trans, error)
}
// Trans is a HOPP transaction.
type Trans interface {
io.Closer
ID() int64
Send(ctx context.Context, method uint16, data []byte) error
Receive(ctx context.Context) (method uint16, data []byte, err error)
SendDatagram(ctx context.Context, method uint16, data []byte) error
ReceiveDatagram(ctx context.Context) (method uint16, data []byte, err error)
}