mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 10:24:40 +01:00
Merge pull request #31 from Zirkelite/master
Fix systemd socket support
This commit is contained in:
commit
eb4f392071
1 changed files with 12 additions and 8 deletions
|
@ -9,18 +9,22 @@ import (
|
|||
)
|
||||
|
||||
func (proxy *Proxy) SystemDListeners() error {
|
||||
listeners, err := activation.Listeners(true)
|
||||
if err != nil && len(listeners) > 0 {
|
||||
listeners, err := activation.Listeners(false)
|
||||
if err == nil && len(listeners) > 0 {
|
||||
for i, listener := range listeners {
|
||||
dlog.Noticef("Wiring systemd TCP socket #%d", i)
|
||||
proxy.tcpListener(listener.(*net.TCPListener))
|
||||
if listener != nil {
|
||||
dlog.Noticef("Wiring systemd TCP socket #%d", i)
|
||||
go proxy.tcpListener(listener.(*net.TCPListener))
|
||||
}
|
||||
}
|
||||
}
|
||||
packetConns, err := activation.PacketConns(true)
|
||||
if err != nil && len(packetConns) > 0 {
|
||||
packetConns, err := activation.PacketConns(false)
|
||||
if err == nil && len(packetConns) > 0 {
|
||||
for i, packetConn := range packetConns {
|
||||
dlog.Noticef("Wiring systemd UDP socket #%d", i)
|
||||
proxy.udpListener(packetConn.(*net.UDPConn))
|
||||
if packetConn != nil {
|
||||
dlog.Noticef("Wiring systemd UDP socket #%d", i)
|
||||
go proxy.udpListener(packetConn.(*net.UDPConn))
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue