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

Method Subscribe

daemon/dns/systemd/monitor.go:178–192  ·  view source on GitHub ↗

Subscribe sends the instruction to systemd-resolved to start monitoring DNS answers.

()

Source from the content-addressed store, hash-verified

176// Subscribe sends the instruction to systemd-resolved to start monitoring
177// DNS answers.
178func (r *ResolvedMonitor) Subscribe() error {
179 if r.isConnected() == false {
180 return errors.New("Not connected")
181 }
182 var err error
183 type emptyT struct{}
184 empty := &emptyT{}
185 r.receiverCb, err = r.Conn.Send(r.Ctx, resolvedSubscribeMethod, empty, varlink.Continues|varlink.More)
186 if err != nil {
187 return err
188 }
189 go r.monitor(r.Ctx, r.ChanResponse, r.ChanConnError, r.receiverCb)
190
191 return nil
192}
193
194// monitor will listen for DNS answers from systemd-resolved.
195func (r *ResolvedMonitor) monitor(ctx context.Context, chanResponse chan *MonitorResponse, chanConnError chan error, callback resolvedCallback) {

Callers 2

connPollerMethod · 0.95

Calls 2

isConnectedMethod · 0.95
monitorMethod · 0.95

Tested by

no test coverage detected