ip/resolver/resolver.go: move WAN_IFACE constant to app/app.go
resolver.go is library code and should not define (or care) about what is a "WAN" interface or not.
This commit is contained in:
parent
4d1103e133
commit
9961cec561
2 changed files with 4 additions and 4 deletions
|
|
@ -12,6 +12,9 @@ import (
|
|||
"dnsupdater/ip/resolver"
|
||||
)
|
||||
|
||||
// Constant name for the virtual WAN interface
|
||||
const WAN_IFACE = "wan"
|
||||
|
||||
type App struct {
|
||||
cache *ip.Cache
|
||||
|
||||
|
|
@ -23,7 +26,7 @@ type App struct {
|
|||
|
||||
func makeCacheCallback(service resolver.Service) ip.CacheDefaultCallback {
|
||||
return func(name string) (net.IP, error) {
|
||||
if name == resolver.WAN_IFACE {
|
||||
if name == WAN_IFACE {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer cancel()
|
||||
return service.Lookup(ctx)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,3 @@ type Service interface {
|
|||
// Lookup the public ip.
|
||||
Lookup(ctx context.Context) (net.IP, error)
|
||||
}
|
||||
|
||||
// Constant name for the virtual WAN interface
|
||||
const WAN_IFACE = "wan"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue