]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/google.golang.org/grpc/keepalive/keepalive.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / google.golang.org / grpc / keepalive / keepalive.go
CommitLineData
15c0b25d
AP
1/*
2 *
3 * Copyright 2017 gRPC authors.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
107c1cdb
ND
19// Package keepalive defines configurable parameters for point-to-point
20// healthcheck.
15c0b25d
AP
21package keepalive
22
23import (
24 "time"
25)
26
27// ClientParameters is used to set keepalive parameters on the client-side.
107c1cdb
ND
28// These configure how the client will actively probe to notice when a
29// connection is broken and send pings so intermediaries will be aware of the
30// liveness of the connection. Make sure these parameters are set in
31// coordination with the keepalive policy on the server, as incompatible
32// settings can result in closing of connection.
15c0b25d 33type ClientParameters struct {
107c1cdb
ND
34 // After a duration of this time if the client doesn't see any activity it
35 // pings the server to see if the transport is still alive.
15c0b25d 36 Time time.Duration // The current default value is infinity.
107c1cdb
ND
37 // After having pinged for keepalive check, the client waits for a duration
38 // of Timeout and if no activity is seen even after that the connection is
39 // closed.
15c0b25d 40 Timeout time.Duration // The current default value is 20 seconds.
107c1cdb
ND
41 // If true, client sends keepalive pings even with no active RPCs. If false,
42 // when there are no active RPCs, Time and Timeout will be ignored and no
43 // keepalive pings will be sent.
15c0b25d
AP
44 PermitWithoutStream bool // false by default.
45}
46
107c1cdb
ND
47// ServerParameters is used to set keepalive and max-age parameters on the
48// server-side.
15c0b25d 49type ServerParameters struct {
107c1cdb
ND
50 // MaxConnectionIdle is a duration for the amount of time after which an
51 // idle connection would be closed by sending a GoAway. Idleness duration is
52 // defined since the most recent time the number of outstanding RPCs became
53 // zero or the connection establishment.
15c0b25d 54 MaxConnectionIdle time.Duration // The current default value is infinity.
107c1cdb
ND
55 // MaxConnectionAge is a duration for the maximum amount of time a
56 // connection may exist before it will be closed by sending a GoAway. A
57 // random jitter of +/-10% will be added to MaxConnectionAge to spread out
58 // connection storms.
15c0b25d 59 MaxConnectionAge time.Duration // The current default value is infinity.
107c1cdb
ND
60 // MaxConnectionAgeGrace is an additive period after MaxConnectionAge after
61 // which the connection will be forcibly closed.
15c0b25d 62 MaxConnectionAgeGrace time.Duration // The current default value is infinity.
107c1cdb
ND
63 // After a duration of this time if the server doesn't see any activity it
64 // pings the client to see if the transport is still alive.
15c0b25d 65 Time time.Duration // The current default value is 2 hours.
107c1cdb
ND
66 // After having pinged for keepalive check, the server waits for a duration
67 // of Timeout and if no activity is seen even after that the connection is
68 // closed.
15c0b25d
AP
69 Timeout time.Duration // The current default value is 20 seconds.
70}
71
107c1cdb
ND
72// EnforcementPolicy is used to set keepalive enforcement policy on the
73// server-side. Server will close connection with a client that violates this
74// policy.
15c0b25d 75type EnforcementPolicy struct {
107c1cdb
ND
76 // MinTime is the minimum amount of time a client should wait before sending
77 // a keepalive ping.
15c0b25d 78 MinTime time.Duration // The current default value is 5 minutes.
107c1cdb
ND
79 // If true, server allows keepalive pings even when there are no active
80 // streams(RPCs). If false, and client sends ping when there are no active
81 // streams, server will send GOAWAY and close the connection.
15c0b25d
AP
82 PermitWithoutStream bool // false by default.
83}