22 lines
564 B
Go
22 lines
564 B
Go
|
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)
|
||
|
}
|