Connect opens a unix socket with systemd-resolved
()
| 139 | |
| 140 | // Connect opens a unix socket with systemd-resolved |
| 141 | func (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. |
no test coverage detected