Initial commit
This commit is contained in:
21
connection.go
Normal file
21
connection.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user