mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-13 10:21:10 +01:00
27 lines
442 B
Go
27 lines
442 B
Go
package dns
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type ShutdownState struct {
|
|
Guid string
|
|
}
|
|
|
|
func (s *ShutdownState) Name() string {
|
|
return "dns_state"
|
|
}
|
|
|
|
func (s *ShutdownState) Cleanup() error {
|
|
manager, err := newHostManagerWithGuid(s.Guid)
|
|
if err != nil {
|
|
return fmt.Errorf("create host manager: %w", err)
|
|
}
|
|
|
|
if err := manager.restoreUncleanShutdownDNS(); err != nil {
|
|
return fmt.Errorf("restore unclean shutdown dns: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|