forked from bluenviron/gomavlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
endpoint.go
37 lines (30 loc) · 883 Bytes
/
endpoint.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package gomavlib
import (
"io"
)
// EndpointConf is the interface implemented by all endpoint configurations.
type EndpointConf interface {
init() (Endpoint, error)
}
// Endpoint is an endpoint, which can create Channels.
type Endpoint interface {
// Conf returns the configuration used to initialize the endpoint
Conf() EndpointConf
isEndpoint()
}
// a endpoint must also implement one of the following:
// - endpointChannelSingle
// - endpointChannelAccepter
// endpointChannelSingle is an endpoint that provides a single channel.
// Read() must not return any error unless Close() is called.
type endpointChannelSingle interface {
Endpoint
Label() string
io.ReadWriteCloser
}
// endpointChannelAccepter is an endpoint that provides multiple channels.
type endpointChannelAccepter interface {
Endpoint
Close() error
Accept() (string, io.ReadWriteCloser, error)
}