forked from AliyunContainerService/pouch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
58 lines (46 loc) · 1.99 KB
/
config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package stream
import (
"net/url"
"time"
"github.com/alibaba/pouch/cri/stream/constant"
)
// Keep these constants consistent with the peers in official package:
// k8s.io/kubernetes/pkg/kubelet/server.
const (
// DefaultStreamIdleTimeout is the timeout for idle stream.
DefaultStreamIdleTimeout = 4 * time.Hour
// DefaultStreamCreationTimeout is the timeout for stream creation.
DefaultStreamCreationTimeout = 30 * time.Second
)
// TODO: StreamProtocolV4Name support.
// SupportedStreamingProtocols is the streaming protocols which server supports.
var SupportedStreamingProtocols = []string{
constant.StreamProtocolV1Name,
constant.StreamProtocolV2Name,
constant.StreamProtocolV3Name,
}
// SupportedPortForwardProtocols is the portforward protocols which server supports.
var SupportedPortForwardProtocols = []string{constant.PortForwardProtocolV1Name}
// Config defines the options used for running the stream server.
type Config struct {
// Address is the addr:port address the server will listen on.
Address string
// BaseURL is the optional base URL for constructing streaming URLs.
// If empty, the baseURL will be constructed from the serve address.
BaseURL *url.URL
// StreamIdleTimeout is how long to leave idle connections open for.
StreamIdleTimeout time.Duration
// StreamCreationTimeout is how long to wait for clients to create streams. Only used for SPDY streaming.
StreamCreationTimeout time.Duration
// SupportedStreamingProtocols is the streaming protocols which server supports.
SupportedRemoteCommandProtocols []string
// SupportedPortForwardProtocol is the portforward protocols which server supports.
SupportedPortForwardProtocols []string
}
// DefaultConfig provides default values for server Config.
var DefaultConfig = Config{
StreamIdleTimeout: DefaultStreamIdleTimeout,
StreamCreationTimeout: DefaultStreamCreationTimeout,
SupportedRemoteCommandProtocols: SupportedStreamingProtocols,
SupportedPortForwardProtocols: SupportedPortForwardProtocols,
}