-
Notifications
You must be signed in to change notification settings - Fork 36
/
endpoint.go
37 lines (31 loc) · 908 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(*Node) (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
// - endpointChannelProvider
// 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
}
// endpointChannelProvider is an endpoint that provides multiple channels.
type endpointChannelProvider interface {
Endpoint
close()
oneChannelAtAtime() bool
provide() (string, io.ReadWriteCloser, error)
}