vendor: bump go-systemd to v17
This commit is contained in:
parent
1d973f59d2
commit
50d626fe02
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -52,8 +52,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/coreos/go-systemd/activation",
|
"ImportPath": "github.com/coreos/go-systemd/activation",
|
||||||
"Comment": "v2-53-g2688e91",
|
"Comment": "v17",
|
||||||
"Rev": "2688e91251d9d8e404e86dd8f096e23b2f086958"
|
"Rev": "39ca1b05acc7ad1220e09f133283b8859a8b71ab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/d2g/dhcp4",
|
"ImportPath": "github.com/d2g/dhcp4",
|
||||||
|
5
vendor/github.com/coreos/go-systemd/NOTICE
generated
vendored
Normal file
5
vendor/github.com/coreos/go-systemd/NOTICE
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CoreOS Project
|
||||||
|
Copyright 2018 CoreOS, Inc
|
||||||
|
|
||||||
|
This product includes software developed at CoreOS, Inc.
|
||||||
|
(http://www.coreos.com/).
|
19
vendor/github.com/coreos/go-systemd/activation/files.go
generated
vendored
19
vendor/github.com/coreos/go-systemd/activation/files.go
generated
vendored
@ -18,18 +18,26 @@ package activation
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// based on: https://gist.github.com/alberts/4640792
|
|
||||||
const (
|
const (
|
||||||
|
// listenFdsStart corresponds to `SD_LISTEN_FDS_START`.
|
||||||
listenFdsStart = 3
|
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 {
|
func Files(unsetEnv bool) []*os.File {
|
||||||
if unsetEnv {
|
if unsetEnv {
|
||||||
defer os.Unsetenv("LISTEN_PID")
|
defer os.Unsetenv("LISTEN_PID")
|
||||||
defer os.Unsetenv("LISTEN_FDS")
|
defer os.Unsetenv("LISTEN_FDS")
|
||||||
|
defer os.Unsetenv("LISTEN_FDNAMES")
|
||||||
}
|
}
|
||||||
|
|
||||||
pid, err := strconv.Atoi(os.Getenv("LISTEN_PID"))
|
pid, err := strconv.Atoi(os.Getenv("LISTEN_PID"))
|
||||||
@ -42,10 +50,17 @@ func Files(unsetEnv bool) []*os.File {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
names := strings.Split(os.Getenv("LISTEN_FDNAMES"), ":")
|
||||||
|
|
||||||
files := make([]*os.File, 0, nfds)
|
files := make([]*os.File, 0, nfds)
|
||||||
for fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ {
|
for fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ {
|
||||||
syscall.CloseOnExec(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
|
return files
|
||||||
|
70
vendor/github.com/coreos/go-systemd/activation/listeners.go
generated
vendored
70
vendor/github.com/coreos/go-systemd/activation/listeners.go
generated
vendored
@ -15,6 +15,7 @@
|
|||||||
package activation
|
package activation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,14 +25,79 @@ import (
|
|||||||
// The order of the file descriptors is preserved in the returned slice.
|
// 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
|
// 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}
|
// corresponding with "udp, tcp, tcp", then the slice would contain {nil, net.Listener, net.Listener}
|
||||||
func Listeners(unsetEnv bool) ([]net.Listener, error) {
|
func Listeners() ([]net.Listener, error) {
|
||||||
files := Files(unsetEnv)
|
files := Files(true)
|
||||||
listeners := make([]net.Listener, len(files))
|
listeners := make([]net.Listener, len(files))
|
||||||
|
|
||||||
for i, f := range files {
|
for i, f := range files {
|
||||||
if pc, err := net.FileListener(f); err == nil {
|
if pc, err := net.FileListener(f); err == nil {
|
||||||
listeners[i] = pc
|
listeners[i] = pc
|
||||||
|
f.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return listeners, nil
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(tlsConfig *tls.Config) ([]net.Listener, error) {
|
||||||
|
listeners, err := Listeners()
|
||||||
|
|
||||||
|
if listeners == nil || err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if tlsConfig != nil && err == nil {
|
||||||
|
for i, l := range listeners {
|
||||||
|
// Activate TLS only for TCP sockets
|
||||||
|
if l.Addr().Network() == "tcp" {
|
||||||
|
listeners[i] = tls.NewListener(l, tlsConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
5
vendor/github.com/coreos/go-systemd/activation/packetconns.go
generated
vendored
5
vendor/github.com/coreos/go-systemd/activation/packetconns.go
generated
vendored
@ -24,13 +24,14 @@ import (
|
|||||||
// The order of the file descriptors is preserved in the returned slice.
|
// 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
|
// 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}
|
// corresponding with "udp, tcp, udp", then the slice would contain {net.PacketConn, nil, net.PacketConn}
|
||||||
func PacketConns(unsetEnv bool) ([]net.PacketConn, error) {
|
func PacketConns() ([]net.PacketConn, error) {
|
||||||
files := Files(unsetEnv)
|
files := Files(true)
|
||||||
conns := make([]net.PacketConn, len(files))
|
conns := make([]net.PacketConn, len(files))
|
||||||
|
|
||||||
for i, f := range files {
|
for i, f := range files {
|
||||||
if pc, err := net.FilePacketConn(f); err == nil {
|
if pc, err := net.FilePacketConn(f); err == nil {
|
||||||
conns[i] = pc
|
conns[i] = pc
|
||||||
|
f.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conns, nil
|
return conns, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user