Subscribe sends the instruction to systemd-resolved to start monitoring DNS answers.
()
| 176 | // Subscribe sends the instruction to systemd-resolved to start monitoring |
| 177 | // DNS answers. |
| 178 | func (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. |
| 195 | func (r *ResolvedMonitor) monitor(ctx context.Context, chanResponse chan *MonitorResponse, chanConnError chan error, callback resolvedCallback) { |
no test coverage detected