Skip to content

Commit

Permalink
refactor(bootstap): prepare for resolver package split
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinkChaos committed Dec 6, 2023
1 parent ef29cdc commit 29a5681
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resolver/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (b *Bootstrap) Resolve(ctx context.Context, request *model.Request) (*model
}

func (b *Bootstrap) UpstreamIPs(ctx context.Context, r *UpstreamResolver) (*IPSet, error) {
hostname := r.cfg.Host
hostname := r.Upstream().Host

if ip := net.ParseIP(hostname); ip != nil { // nil-safe when hostname is an IP: makes writing tests easier
return newIPSet([]net.IP{ip}), nil
Expand Down
4 changes: 4 additions & 0 deletions resolver/upstream_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ func (r UpstreamResolver) String() string {
return fmt.Sprintf("%s '%s'", r.Type(), r.cfg)
}

func (r UpstreamResolver) Upstream() config.Upstream {
return r.cfg.Upstream
}

func (r *UpstreamResolver) log() *logrus.Entry {
return r.typed.log().WithField("upstream", r.cfg.String())
}
Expand Down

0 comments on commit 29a5681

Please sign in to comment.