all: add sending logs to ControlD API

This commit is contained in:
Cuong Manh Le
2024-12-06 20:47:52 +07:00
committed by Cuong Manh Le
parent f5ba8be182
commit a63a30c76b
3 changed files with 92 additions and 40 deletions

View File

@@ -1269,7 +1269,7 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
cdLogger := mainLog.Load().With().Str("mode", "cd").Logger()
// Performs self-uninstallation if the ControlD device does not exist.
var uer *controld.UtilityErrorResponse
var uer *controld.ErrorResponse
if errors.As(err, &uer) && uer.ErrorField.Code == controld.InvalidConfigCode {
_ = uninstallInvalidCdUID(p, cdLogger, false)
}

View File

@@ -1044,7 +1044,7 @@ func dnsChanged(iface *net.Interface, nameservers []string) bool {
// selfUninstallCheck checks if the error dues to controld.InvalidConfigCode, perform self-uninstall then.
func selfUninstallCheck(uninstallErr error, p *prog, logger zerolog.Logger) {
var uer *controld.UtilityErrorResponse
var uer *controld.ErrorResponse
if errors.As(uninstallErr, &uer) && uer.ErrorField.Code == controld.InvalidConfigCode {
p.stopDnsWatchers()