mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-26 01:53:42 +01:00
e2f27502e4
Support search domain on Android - pass list of search domains to Android SDK - throw notification in case of search domain changes
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package dns
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
nbdns "github.com/netbirdio/netbird/dns"
|
|
)
|
|
|
|
// MockServer is the mock instance of a dns server
|
|
type MockServer struct {
|
|
InitializeFunc func() error
|
|
StopFunc func()
|
|
UpdateDNSServerFunc func(serial uint64, update nbdns.Config) error
|
|
}
|
|
|
|
// Initialize mock implementation of Initialize from Server interface
|
|
func (m *MockServer) Initialize() error {
|
|
if m.InitializeFunc != nil {
|
|
return m.InitializeFunc()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Stop mock implementation of Stop from Server interface
|
|
func (m *MockServer) Stop() {
|
|
if m.StopFunc != nil {
|
|
m.StopFunc()
|
|
}
|
|
}
|
|
|
|
func (m *MockServer) DnsIP() string {
|
|
return ""
|
|
}
|
|
|
|
func (m *MockServer) OnUpdatedHostDNSServer(strings []string) {
|
|
//TODO implement me
|
|
panic("implement me")
|
|
}
|
|
|
|
// UpdateDNSServer mock implementation of UpdateDNSServer from Server interface
|
|
func (m *MockServer) UpdateDNSServer(serial uint64, update nbdns.Config) error {
|
|
if m.UpdateDNSServerFunc != nil {
|
|
return m.UpdateDNSServerFunc(serial, update)
|
|
}
|
|
return fmt.Errorf("method UpdateDNSServer is not implemented")
|
|
}
|
|
|
|
func (m *MockServer) SearchDomains() []string {
|
|
return make([]string, 0)
|
|
}
|