MCPcopy
hub / github.com/evilsocket/opensnitch / Connect

Method Connect

daemon/dns/systemd/monitor.go:141–154  ·  view source on GitHub ↗

Connect opens a unix socket with systemd-resolved

()

Source from the content-addressed store, hash-verified

139
140// Connect opens a unix socket with systemd-resolved
141func (r *ResolvedMonitor) Connect() (*varlink.Connection, error) {
142 r.mu.Lock()
143 defer r.mu.Unlock()
144
145 var err error
146 r.Conn, err = varlink.NewConnection(r.Ctx, fmt.Sprintf("unix://%s", socketPath))
147 if err != nil {
148 return nil, err
149 }
150
151 r.connected = true
152 go r.connPoller()
153 return r.Conn, nil
154}
155
156// if we're connected to the unix socket, check every few seconds if we're still
157// connected, and if not, reconnect, to survive to systemd-resolved restarts.

Callers 2

connPollerMethod · 0.95

Calls 3

connPollerMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected