Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
id
auth
Commits
e7dc7fdd
Commit
e7dc7fdd
authored
Oct 29, 2018
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update go-common and other dependencies
parent
0932991a
Changes
132
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
21573 additions
and
3255 deletions
+21573
-3255
vendor/git.autistici.org/ai3/go-common/unix/server.go
vendor/git.autistici.org/ai3/go-common/unix/server.go
+1
-1
vendor/github.com/beorn7/perks/quantile/stream.go
vendor/github.com/beorn7/perks/quantile/stream.go
+29
-5
vendor/github.com/coreos/go-systemd/NOTICE
vendor/github.com/coreos/go-systemd/NOTICE
+5
-0
vendor/github.com/coreos/go-systemd/activation/files.go
vendor/github.com/coreos/go-systemd/activation/files.go
+17
-2
vendor/github.com/coreos/go-systemd/activation/listeners.go
vendor/github.com/coreos/go-systemd/activation/listeners.go
+47
-4
vendor/github.com/coreos/go-systemd/activation/packetconns.go
...or/github.com/coreos/go-systemd/activation/packetconns.go
+3
-2
vendor/github.com/coreos/go-systemd/daemon/sdnotify.go
vendor/github.com/coreos/go-systemd/daemon/sdnotify.go
+30
-9
vendor/github.com/coreos/go-systemd/daemon/watchdog.go
vendor/github.com/coreos/go-systemd/daemon/watchdog.go
+5
-4
vendor/github.com/gogo/protobuf/LICENSE
vendor/github.com/gogo/protobuf/LICENSE
+35
-0
vendor/github.com/gogo/protobuf/proto/Makefile
vendor/github.com/gogo/protobuf/proto/Makefile
+2
-2
vendor/github.com/gogo/protobuf/proto/clone.go
vendor/github.com/gogo/protobuf/proto/clone.go
+258
-0
vendor/github.com/gogo/protobuf/proto/custom_gogo.go
vendor/github.com/gogo/protobuf/proto/custom_gogo.go
+39
-0
vendor/github.com/gogo/protobuf/proto/decode.go
vendor/github.com/gogo/protobuf/proto/decode.go
+428
-0
vendor/github.com/gogo/protobuf/proto/discard.go
vendor/github.com/gogo/protobuf/proto/discard.go
+350
-0
vendor/github.com/gogo/protobuf/proto/duration.go
vendor/github.com/gogo/protobuf/proto/duration.go
+100
-0
vendor/github.com/gogo/protobuf/proto/duration_gogo.go
vendor/github.com/gogo/protobuf/proto/duration_gogo.go
+49
-0
vendor/github.com/gogo/protobuf/proto/encode.go
vendor/github.com/gogo/protobuf/proto/encode.go
+218
-0
vendor/github.com/gogo/protobuf/proto/encode_gogo.go
vendor/github.com/gogo/protobuf/proto/encode_gogo.go
+33
-0
vendor/github.com/gogo/protobuf/proto/equal.go
vendor/github.com/gogo/protobuf/proto/equal.go
+300
-0
vendor/github.com/gogo/protobuf/proto/extensions.go
vendor/github.com/gogo/protobuf/proto/extensions.go
+604
-0
vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
+368
-0
vendor/github.com/gogo/protobuf/proto/lib.go
vendor/github.com/gogo/protobuf/proto/lib.go
+929
-0
vendor/github.com/gogo/protobuf/proto/lib_gogo.go
vendor/github.com/gogo/protobuf/proto/lib_gogo.go
+50
-0
vendor/github.com/gogo/protobuf/proto/message_set.go
vendor/github.com/gogo/protobuf/proto/message_set.go
+314
-0
vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
+357
-0
vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go
...or/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go
+59
-0
vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
+308
-0
vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
+56
-0
vendor/github.com/gogo/protobuf/proto/properties.go
vendor/github.com/gogo/protobuf/proto/properties.go
+600
-0
vendor/github.com/gogo/protobuf/proto/properties_gogo.go
vendor/github.com/gogo/protobuf/proto/properties_gogo.go
+36
-0
vendor/github.com/gogo/protobuf/proto/skip_gogo.go
vendor/github.com/gogo/protobuf/proto/skip_gogo.go
+119
-0
vendor/github.com/gogo/protobuf/proto/table_marshal.go
vendor/github.com/gogo/protobuf/proto/table_marshal.go
+2803
-0
vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go
vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go
+388
-0
vendor/github.com/gogo/protobuf/proto/table_merge.go
vendor/github.com/gogo/protobuf/proto/table_merge.go
+657
-0
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
+2058
-0
vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go
...or/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go
+385
-0
vendor/github.com/gogo/protobuf/proto/text.go
vendor/github.com/gogo/protobuf/proto/text.go
+928
-0
vendor/github.com/gogo/protobuf/proto/text_gogo.go
vendor/github.com/gogo/protobuf/proto/text_gogo.go
+57
-0
vendor/github.com/gogo/protobuf/proto/text_parser.go
vendor/github.com/gogo/protobuf/proto/text_parser.go
+998
-0
vendor/github.com/gogo/protobuf/proto/timestamp.go
vendor/github.com/gogo/protobuf/proto/timestamp.go
+113
-0
vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go
vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go
+49
-0
vendor/github.com/golang/protobuf/LICENSE
vendor/github.com/golang/protobuf/LICENSE
+0
-3
vendor/github.com/golang/protobuf/proto/clone.go
vendor/github.com/golang/protobuf/proto/clone.go
+35
-11
vendor/github.com/golang/protobuf/proto/decode.go
vendor/github.com/golang/protobuf/proto/decode.go
+63
-606
vendor/github.com/golang/protobuf/proto/deprecated.go
vendor/github.com/golang/protobuf/proto/deprecated.go
+38
-0
vendor/github.com/golang/protobuf/proto/discard.go
vendor/github.com/golang/protobuf/proto/discard.go
+350
-0
vendor/github.com/golang/protobuf/proto/encode.go
vendor/github.com/golang/protobuf/proto/encode.go
+25
-1184
vendor/github.com/golang/protobuf/proto/equal.go
vendor/github.com/golang/protobuf/proto/equal.go
+15
-15
vendor/github.com/golang/protobuf/proto/extensions.go
vendor/github.com/golang/protobuf/proto/extensions.go
+81
-125
vendor/github.com/golang/protobuf/proto/lib.go
vendor/github.com/golang/protobuf/proto/lib.go
+105
-43
vendor/github.com/golang/protobuf/proto/message_set.go
vendor/github.com/golang/protobuf/proto/message_set.go
+42
-39
vendor/github.com/golang/protobuf/proto/pointer_reflect.go
vendor/github.com/golang/protobuf/proto/pointer_reflect.go
+234
-361
vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
+202
-164
vendor/github.com/golang/protobuf/proto/properties.go
vendor/github.com/golang/protobuf/proto/properties.go
+57
-394
vendor/github.com/golang/protobuf/proto/table_marshal.go
vendor/github.com/golang/protobuf/proto/table_marshal.go
+2767
-0
vendor/github.com/golang/protobuf/proto/table_merge.go
vendor/github.com/golang/protobuf/proto/table_merge.go
+654
-0
vendor/github.com/golang/protobuf/proto/table_unmarshal.go
vendor/github.com/golang/protobuf/proto/table_unmarshal.go
+2051
-0
vendor/github.com/golang/protobuf/proto/text.go
vendor/github.com/golang/protobuf/proto/text.go
+27
-38
vendor/github.com/golang/protobuf/proto/text_parser.go
vendor/github.com/golang/protobuf/proto/text_parser.go
+34
-49
vendor/github.com/prometheus/client_golang/prometheus/collector.go
...thub.com/prometheus/client_golang/prometheus/collector.go
+25
-14
vendor/github.com/prometheus/client_golang/prometheus/counter.go
...github.com/prometheus/client_golang/prometheus/counter.go
+110
-22
vendor/github.com/prometheus/client_golang/prometheus/desc.go
...or/github.com/prometheus/client_golang/prometheus/desc.go
+1
-2
vendor/github.com/prometheus/client_golang/prometheus/doc.go
vendor/github.com/prometheus/client_golang/prometheus/doc.go
+21
-6
vendor/github.com/prometheus/client_golang/prometheus/fnv.go
vendor/github.com/prometheus/client_golang/prometheus/fnv.go
+13
-0
vendor/github.com/prometheus/client_golang/prometheus/gauge.go
...r/github.com/prometheus/client_golang/prometheus/gauge.go
+130
-17
vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
...b.com/prometheus/client_golang/prometheus/go_collector.go
+20
-3
vendor/github.com/prometheus/client_golang/prometheus/histogram.go
...thub.com/prometheus/client_golang/prometheus/histogram.go
+63
-31
vendor/github.com/prometheus/client_golang/prometheus/http.go
...or/github.com/prometheus/client_golang/prometheus/http.go
+7
-19
vendor/github.com/prometheus/client_golang/prometheus/labels.go
.../github.com/prometheus/client_golang/prometheus/labels.go
+13
-0
vendor/github.com/prometheus/client_golang/prometheus/metric.go
.../github.com/prometheus/client_golang/prometheus/metric.go
+37
-28
vendor/github.com/prometheus/client_golang/prometheus/observer.go
...ithub.com/prometheus/client_golang/prometheus/observer.go
+2
-0
vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
.../prometheus/client_golang/prometheus/process_collector.go
+16
-9
vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go
...prometheus/client_golang/prometheus/promhttp/delegator.go
+15
-15
vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go
...etheus/client_golang/prometheus/promhttp/delegator_1_8.go
+16
-16
vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
....com/prometheus/client_golang/prometheus/promhttp/http.go
+119
-12
No files found.
vendor/git.autistici.org/ai3/go-common/unix/server.go
View file @
e7dc7fdd
...
...
@@ -79,7 +79,7 @@ func NewUNIXSocketServer(socketPath string, h Handler) (*SocketServer, error) {
// NewSystemdSocketServer uses systemd socket activation, receiving
// the open socket as a file descriptor on exec.
func
NewSystemdSocketServer
(
h
Handler
)
(
*
SocketServer
,
error
)
{
listeners
,
err
:=
activation
.
Listeners
(
false
)
listeners
,
err
:=
activation
.
Listeners
()
if
err
!=
nil
{
return
nil
,
err
}
...
...
vendor/github.com/beorn7/perks/quantile/stream.go
View file @
e7dc7fdd
...
...
@@ -77,15 +77,20 @@ func NewHighBiased(epsilon float64) *Stream {
// is guaranteed to be within (Quantile±Epsilon).
//
// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
func
NewTargeted
(
targets
map
[
float64
]
float64
)
*
Stream
{
func
NewTargeted
(
targetMap
map
[
float64
]
float64
)
*
Stream
{
// Convert map to slice to avoid slow iterations on a map.
// ƒ is called on the hot path, so converting the map to a slice
// beforehand results in significant CPU savings.
targets
:=
targetMapToSlice
(
targetMap
)
ƒ
:=
func
(
s
*
stream
,
r
float64
)
float64
{
var
m
=
math
.
MaxFloat64
var
f
float64
for
quantile
,
epsilon
:=
range
targets
{
if
quantile
*
s
.
n
<=
r
{
f
=
(
2
*
epsilon
*
r
)
/
quantile
for
_
,
t
:=
range
targets
{
if
t
.
quantile
*
s
.
n
<=
r
{
f
=
(
2
*
t
.
epsilon
*
r
)
/
t
.
quantile
}
else
{
f
=
(
2
*
epsilon
*
(
s
.
n
-
r
))
/
(
1
-
quantile
)
f
=
(
2
*
t
.
epsilon
*
(
s
.
n
-
r
))
/
(
1
-
t
.
quantile
)
}
if
f
<
m
{
m
=
f
...
...
@@ -96,6 +101,25 @@ func NewTargeted(targets map[float64]float64) *Stream {
return
newStream
(
ƒ
)
}
type
target
struct
{
quantile
float64
epsilon
float64
}
func
targetMapToSlice
(
targetMap
map
[
float64
]
float64
)
[]
target
{
targets
:=
make
([]
target
,
0
,
len
(
targetMap
))
for
quantile
,
epsilon
:=
range
targetMap
{
t
:=
target
{
quantile
:
quantile
,
epsilon
:
epsilon
,
}
targets
=
append
(
targets
,
t
)
}
return
targets
}
// Stream computes quantiles for a stream of float64s. It is not thread-safe by
// design. Take care when using across multiple goroutines.
type
Stream
struct
{
...
...
vendor/github.com/coreos/go-systemd/NOTICE
0 → 100644
View file @
e7dc7fdd
CoreOS Project
Copyright 2018 CoreOS, Inc
This product includes software developed at CoreOS, Inc.
(http://www.coreos.com/).
vendor/github.com/coreos/go-systemd/activation/files.go
View file @
e7dc7fdd
...
...
@@ -18,18 +18,26 @@ package activation
import
(
"os"
"strconv"
"strings"
"syscall"
)
// based on: https://gist.github.com/alberts/4640792
const
(
// listenFdsStart corresponds to `SD_LISTEN_FDS_START`.
listenFdsStart
=
3
)
// Files returns a slice containing a `os.File` object for each
// file descriptor passed to this process via systemd fd-passing protocol.
//
// The order of the file descriptors is preserved in the returned slice.
// `unsetEnv` is typically set to `true` in order to avoid clashes in
// fd usage and to avoid leaking environment flags to child processes.
func
Files
(
unsetEnv
bool
)
[]
*
os
.
File
{
if
unsetEnv
{
defer
os
.
Unsetenv
(
"LISTEN_PID"
)
defer
os
.
Unsetenv
(
"LISTEN_FDS"
)
defer
os
.
Unsetenv
(
"LISTEN_FDNAMES"
)
}
pid
,
err
:=
strconv
.
Atoi
(
os
.
Getenv
(
"LISTEN_PID"
))
...
...
@@ -42,10 +50,17 @@ func Files(unsetEnv bool) []*os.File {
return
nil
}
names
:=
strings
.
Split
(
os
.
Getenv
(
"LISTEN_FDNAMES"
),
":"
)
files
:=
make
([]
*
os
.
File
,
0
,
nfds
)
for
fd
:=
listenFdsStart
;
fd
<
listenFdsStart
+
nfds
;
fd
++
{
syscall
.
CloseOnExec
(
fd
)
files
=
append
(
files
,
os
.
NewFile
(
uintptr
(
fd
),
"LISTEN_FD_"
+
strconv
.
Itoa
(
fd
)))
name
:=
"LISTEN_FD_"
+
strconv
.
Itoa
(
fd
)
offset
:=
fd
-
listenFdsStart
if
offset
<
len
(
names
)
&&
len
(
names
[
offset
])
>
0
{
name
=
names
[
offset
]
}
files
=
append
(
files
,
os
.
NewFile
(
uintptr
(
fd
),
name
))
}
return
files
...
...
vendor/github.com/coreos/go-systemd/activation/listeners.go
View file @
e7dc7fdd
...
...
@@ -25,13 +25,33 @@ import (
// The order of the file descriptors is preserved in the returned slice.
// Nil values are used to fill any gaps. For example if systemd were to return file descriptors
// corresponding with "udp, tcp, tcp", then the slice would contain {nil, net.Listener, net.Listener}
func
Listeners
(
unsetEnv
bool
)
([]
net
.
Listener
,
error
)
{
files
:=
Files
(
unsetEnv
)
func
Listeners
()
([]
net
.
Listener
,
error
)
{
files
:=
Files
(
true
)
listeners
:=
make
([]
net
.
Listener
,
len
(
files
))
for
i
,
f
:=
range
files
{
if
pc
,
err
:=
net
.
FileListener
(
f
);
err
==
nil
{
listeners
[
i
]
=
pc
f
.
Close
()
}
}
return
listeners
,
nil
}
// ListenersWithNames maps a listener name to a set of net.Listener instances.
func
ListenersWithNames
()
(
map
[
string
][]
net
.
Listener
,
error
)
{
files
:=
Files
(
true
)
listeners
:=
map
[
string
][]
net
.
Listener
{}
for
_
,
f
:=
range
files
{
if
pc
,
err
:=
net
.
FileListener
(
f
);
err
==
nil
{
current
,
ok
:=
listeners
[
f
.
Name
()]
if
!
ok
{
listeners
[
f
.
Name
()]
=
[]
net
.
Listener
{
pc
}
}
else
{
listeners
[
f
.
Name
()]
=
append
(
current
,
pc
)
}
f
.
Close
()
}
}
return
listeners
,
nil
...
...
@@ -40,8 +60,8 @@ func Listeners(unsetEnv bool) ([]net.Listener, error) {
// TLSListeners returns a slice containing a net.listener for each matching TCP socket type
// passed to this process.
// It uses default Listeners func and forces TCP sockets handlers to use TLS based on tlsConfig.
func
TLSListeners
(
unsetEnv
bool
,
tlsConfig
*
tls
.
Config
)
([]
net
.
Listener
,
error
)
{
listeners
,
err
:=
Listeners
(
unsetEnv
)
func
TLSListeners
(
tlsConfig
*
tls
.
Config
)
([]
net
.
Listener
,
error
)
{
listeners
,
err
:=
Listeners
()
if
listeners
==
nil
||
err
!=
nil
{
return
nil
,
err
...
...
@@ -58,3 +78,26 @@ func TLSListeners(unsetEnv bool, tlsConfig *tls.Config) ([]net.Listener, error)
return
listeners
,
err
}
// TLSListenersWithNames maps a listener name to a net.Listener with
// the associated TLS configuration.
func
TLSListenersWithNames
(
tlsConfig
*
tls
.
Config
)
(
map
[
string
][]
net
.
Listener
,
error
)
{
listeners
,
err
:=
ListenersWithNames
()
if
listeners
==
nil
||
err
!=
nil
{
return
nil
,
err
}
if
tlsConfig
!=
nil
&&
err
==
nil
{
for
_
,
ll
:=
range
listeners
{
// Activate TLS only for TCP sockets
for
i
,
l
:=
range
ll
{
if
l
.
Addr
()
.
Network
()
==
"tcp"
{
ll
[
i
]
=
tls
.
NewListener
(
l
,
tlsConfig
)
}
}
}
}
return
listeners
,
err
}
vendor/github.com/coreos/go-systemd/activation/packetconns.go
View file @
e7dc7fdd
...
...
@@ -24,13 +24,14 @@ import (
// The order of the file descriptors is preserved in the returned slice.
// Nil values are used to fill any gaps. For example if systemd were to return file descriptors
// corresponding with "udp, tcp, udp", then the slice would contain {net.PacketConn, nil, net.PacketConn}
func
PacketConns
(
unsetEnv
bool
)
([]
net
.
PacketConn
,
error
)
{
files
:=
Files
(
unsetEnv
)
func
PacketConns
()
([]
net
.
PacketConn
,
error
)
{
files
:=
Files
(
true
)
conns
:=
make
([]
net
.
PacketConn
,
len
(
files
))
for
i
,
f
:=
range
files
{
if
pc
,
err
:=
net
.
FilePacketConn
(
f
);
err
==
nil
{
conns
[
i
]
=
pc
f
.
Close
()
}
}
return
conns
,
nil
...
...
vendor/github.com/coreos/go-systemd/daemon/sdnotify.go
View file @
e7dc7fdd
// Copyright 2014 Docker, Inc.
// Copyright 2015-2018 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
...
...
@@ -13,7 +14,11 @@
// limitations under the License.
//
// Code forked from Docker project
// Package daemon provides a Go implementation of the sd_notify protocol.
// It can be used to inform systemd of service start-up completion, watchdog
// events, and other status changes.
//
// https://www.freedesktop.org/software/systemd/man/sd_notify.html#Description
package
daemon
import
(
...
...
@@ -21,6 +26,25 @@ import (
"os"
)
const
(
// SdNotifyReady tells the service manager that service startup is finished
// or the service finished loading its configuration.
SdNotifyReady
=
"READY=1"
// SdNotifyStopping tells the service manager that the service is beginning
// its shutdown.
SdNotifyStopping
=
"STOPPING=1"
// SdNotifyReloading tells the service manager that this service is
// reloading its configuration. Note that you must call SdNotifyReady when
// it completed reloading.
SdNotifyReloading
=
"RELOADING=1"
// SdNotifyWatchdog tells the service manager to update the watchdog
// timestamp for the service.
SdNotifyWatchdog
=
"WATCHDOG=1"
)
// SdNotify sends a message to the init daemon. It is common to ignore the error.
// If `unsetEnvironment` is true, the environment variable `NOTIFY_SOCKET`
// will be unconditionally unset.
...
...
@@ -29,7 +53,7 @@ import (
// (false, nil) - notification not supported (i.e. NOTIFY_SOCKET is unset)
// (false, err) - notification supported, but failure happened (e.g. error connecting to NOTIFY_SOCKET or while sending data)
// (true, nil) - notification supported, data has been sent
func
SdNotify
(
unsetEnvironment
bool
,
state
string
)
(
sent
bool
,
err
error
)
{
func
SdNotify
(
unsetEnvironment
bool
,
state
string
)
(
bool
,
error
)
{
socketAddr
:=
&
net
.
UnixAddr
{
Name
:
os
.
Getenv
(
"NOTIFY_SOCKET"
),
Net
:
"unixgram"
,
...
...
@@ -41,10 +65,9 @@ func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) {
}
if
unsetEnvironment
{
err
=
os
.
Unsetenv
(
"NOTIFY_SOCKET"
)
}
if
err
!=
nil
{
return
false
,
err
if
err
:=
os
.
Unsetenv
(
"NOTIFY_SOCKET"
);
err
!=
nil
{
return
false
,
err
}
}
conn
,
err
:=
net
.
DialUnix
(
socketAddr
.
Net
,
nil
,
socketAddr
)
...
...
@@ -54,9 +77,7 @@ func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) {
}
defer
conn
.
Close
()
_
,
err
=
conn
.
Write
([]
byte
(
state
))
// Error sending the message
if
err
!=
nil
{
if
_
,
err
=
conn
.
Write
([]
byte
(
state
));
err
!=
nil
{
return
false
,
err
}
return
true
,
nil
...
...
vendor/github.com/coreos/go-systemd/daemon/watchdog.go
View file @
e7dc7fdd
...
...
@@ -21,10 +21,11 @@ import (
"time"
)
// SdWatchdogEnabled return watchdog information for a service.
// Process should send daemon.SdNotify("WATCHDOG=1") every time / 2.
// If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC`
// and `WATCHDOG_PID` will be unconditionally unset.
// SdWatchdogEnabled returns watchdog information for a service.
// Processes should call daemon.SdNotify(false, daemon.SdNotifyWatchdog) every
// time / 2.
// If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC` and
// `WATCHDOG_PID` will be unconditionally unset.
//
// It returns one of the following:
// (0, nil) - watchdog isn't enabled or we aren't the watched PID.
...
...
vendor/github.com/gogo/protobuf/LICENSE
0 → 100644
View file @
e7dc7fdd
Copyright (c) 2013, The GoGo Authors. All rights reserved.
Protocol Buffers for Go with Gadgets
Go support for Protocol Buffers - Google's data interchange format
Copyright 2010 The Go Authors. All rights reserved.
https://github.com/golang/protobuf
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vendor/github.com/go
lan
g/protobuf/proto/Makefile
→
vendor/github.com/gog
o
/protobuf/proto/Makefile
View file @
e7dc7fdd
...
...
@@ -38,6 +38,6 @@ test: install generate-test-pbs
generate-test-pbs
:
make
install
make
-C
test
data
protoc
--go_out
=
Mtestdata/test.proto
=
github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto
=
github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.
proto
make
-C
test
_proto
make
-C
proto3_
proto
make
vendor/github.com/gogo/protobuf/proto/clone.go
0 → 100644
View file @
e7dc7fdd
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2011 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Protocol buffer deep copy and merge.
// TODO: RawMessage.
package
proto
import
(
"fmt"
"log"
"reflect"
"strings"
)
// Clone returns a deep copy of a protocol buffer.
func
Clone
(
src
Message
)
Message
{
in
:=
reflect
.
ValueOf
(
src
)
if
in
.
IsNil
()
{
return
src
}
out
:=
reflect
.
New
(
in
.
Type
()
.
Elem
())
dst
:=
out
.
Interface
()
.
(
Message
)
Merge
(
dst
,
src
)
return
dst
}
// Merger is the interface representing objects that can merge messages of the same type.
type
Merger
interface
{
// Merge merges src into this message.
// Required and optional fields that are set in src will be set to that value in dst.
// Elements of repeated fields will be appended.
//
// Merge may panic if called with a different argument type than the receiver.
Merge
(
src
Message
)
}
// generatedMerger is the custom merge method that generated protos will have.
// We must add this method since a generate Merge method will conflict with
// many existing protos that have a Merge data field already defined.
type
generatedMerger
interface
{
XXX_Merge
(
src
Message
)
}
// Merge merges src into dst.
// Required and optional fields that are set in src will be set to that value in dst.
// Elements of repeated fields will be appended.
// Merge panics if src and dst are not the same type, or if dst is nil.
func
Merge
(
dst
,
src
Message
)
{
if
m
,
ok
:=
dst
.
(
Merger
);
ok
{
m
.
Merge
(
src
)
return
}
in
:=
reflect
.
ValueOf
(
src
)
out
:=
reflect
.
ValueOf
(
dst
)
if
out
.
IsNil
()
{
panic
(
"proto: nil destination"
)
}
if
in
.
Type
()
!=
out
.
Type
()
{
panic
(
fmt
.
Sprintf
(
"proto.Merge(%T, %T) type mismatch"
,
dst
,
src
))
}
if
in
.
IsNil
()
{
return
// Merge from nil src is a noop
}
if
m
,
ok
:=
dst
.
(
generatedMerger
);
ok
{
m
.
XXX_Merge
(
src
)
return
}
mergeStruct
(
out
.
Elem
(),
in
.
Elem
())
}
func
mergeStruct
(
out
,
in
reflect
.
Value
)
{
sprop
:=
GetProperties
(
in
.
Type
())
for
i
:=
0
;
i
<
in
.
NumField
();
i
++
{
f
:=
in
.
Type
()
.
Field
(
i
)
if
strings
.
HasPrefix
(
f
.
Name
,
"XXX_"
)
{
continue
}
mergeAny
(
out
.
Field
(
i
),
in
.
Field
(
i
),
false
,
sprop
.
Prop
[
i
])
}
if
emIn
,
ok
:=
in
.
Addr
()
.
Interface
()
.
(
extensionsBytes
);
ok
{
emOut
:=
out
.
Addr
()
.
Interface
()
.
(
extensionsBytes
)
bIn
:=
emIn
.
GetExtensions
()
bOut
:=
emOut
.
GetExtensions
()
*
bOut
=
append
(
*
bOut
,
*
bIn
...
)
}
else
if
emIn
,
err
:=
extendable
(
in
.
Addr
()
.
Interface
());
err
==
nil
{
emOut
,
_
:=
extendable
(
out
.
Addr
()
.
Interface
())
mIn
,
muIn
:=
emIn
.
extensionsRead
()
if
mIn
!=
nil
{
mOut
:=
emOut
.
extensionsWrite
()
muIn
.
Lock
()
mergeExtension
(
mOut
,
mIn
)
muIn
.
Unlock
()
}
}
uf
:=
in
.
FieldByName
(
"XXX_unrecognized"
)
if
!
uf
.
IsValid
()
{
return
}
uin
:=
uf
.
Bytes
()
if
len
(
uin
)
>
0
{
out
.
FieldByName
(
"XXX_unrecognized"
)
.
SetBytes
(
append
([]
byte
(
nil
),
uin
...
))
}
}
// mergeAny performs a merge between two values of the same type.
// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
// prop is set if this is a struct field (it may be nil).
func
mergeAny
(
out
,
in
reflect
.
Value
,
viaPtr
bool
,
prop
*
Properties
)
{
if
in
.
Type
()
==
protoMessageType
{
if
!
in
.
IsNil
()
{
if
out
.
IsNil
()
{
out
.
Set
(
reflect
.
ValueOf
(
Clone
(
in
.
Interface
()
.
(
Message
))))
}
else
{
Merge
(
out
.
Interface
()
.
(
Message
),
in
.
Interface
()
.
(
Message
))
}
}
return
}
switch
in
.
Kind
()
{
case
reflect
.
Bool
,
reflect
.
Float32
,
reflect
.
Float64
,
reflect
.
Int32
,
reflect
.
Int64
,
reflect
.
String
,
reflect
.
Uint32
,
reflect
.
Uint64
:
if
!
viaPtr
&&
isProto3Zero
(
in
)
{
return
}
out
.
Set
(
in
)
case
reflect
.
Interface
:
// Probably a oneof field; copy non-nil values.
if
in
.
IsNil
()
{
return
}
// Allocate destination if it is not set, or set to a different type.
// Otherwise we will merge as normal.
if
out
.
IsNil
()
||
out
.
Elem
()
.
Type
()
!=
in
.
Elem
()
.
Type
()
{
out
.
Set
(
reflect
.
New
(
in
.
Elem
()
.
Elem
()
.
Type
()))
// interface -> *T -> T -> new(T)
}
mergeAny
(
out
.
Elem
(),
in
.
Elem
(),
false
,
nil
)
case
reflect
.
Map
:
if
in
.
Len
()
==
0
{
return
}
if
out
.
IsNil
()
{
out
.
Set
(
reflect
.
MakeMap
(
in
.
Type
()))
}
// For maps with value types of *T or []byte we need to deep copy each value.
elemKind
:=
in
.
Type
()
.
Elem
()
.
Kind
()
for
_
,
key
:=
range
in
.
MapKeys
()
{
var
val
reflect
.
Value
switch
elemKind
{
case
reflect
.
Ptr
:
val
=
reflect
.
New
(
in
.
Type
()
.
Elem
()
.
Elem
())
mergeAny
(
val
,
in
.
MapIndex
(
key
),
false
,
nil
)
case
reflect
.
Slice
:
val
=
in
.
MapIndex
(
key
)
val
=
reflect
.
ValueOf
(
append
([]
byte
{},
val
.
Bytes
()
...
))
default
:
val
=
in
.
MapIndex
(
key
)
}
out
.
SetMapIndex
(
key
,
val
)
}
case
reflect
.
Ptr
:
if
in
.
IsNil
()
{
return
}
if
out
.
IsNil
()
{
out
.
Set
(
reflect
.
New
(
in
.
Elem
()
.
Type
()))
}
mergeAny
(
out
.
Elem
(),
in
.
Elem
(),
true
,
nil
)
case
reflect
.
Slice
:
if
in
.
IsNil
()
{
return
}
if
in
.
Type
()
.
Elem
()
.
Kind
()
==
reflect
.
Uint8
{
// []byte is a scalar bytes field, not a repeated field.
// Edge case: if this is in a proto3 message, a zero length
// bytes field is considered the zero value, and should not
// be merged.
if
prop
!=
nil
&&
prop
.
proto3
&&
in
.
Len
()
==
0
{
return
}
// Make a deep copy.
// Append to []byte{} instead of []byte(nil) so that we never end up
// with a nil result.
out
.
SetBytes
(
append
([]
byte
{},
in
.
Bytes
()
...
))
return
}
n
:=
in
.
Len
()
if
out
.
IsNil
()
{
out
.
Set
(
reflect
.
MakeSlice
(
in
.
Type
(),
0
,
n
))
}
switch
in
.
Type
()
.
Elem
()
.
Kind
()
{
case
reflect
.
Bool
,
reflect
.
Float32
,
reflect
.
Float64
,
reflect
.
Int32
,
reflect
.
Int64
,