Skip to content

Commit

Permalink
plugin forward: add bootstrap support
Browse files Browse the repository at this point in the history
  • Loading branch information
IrineSistiana committed Nov 29, 2020
1 parent cd79c31 commit 0139d93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions dispatcher/config/config_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func GetTemplateConfig() (*Config, error) {
},
Timeout: 10,
InsecureSkipVerify: false,
Bootstrap: []string{"", ""},
Deduplicate: false,
}); err != nil {
return nil, err
Expand Down
5 changes: 2 additions & 3 deletions dispatcher/plugin/functional/forward/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type Args struct {
Upstream []Upstream `yaml:"upstream"`
Timeout int `yaml:"timeout"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
Bootstrap []string `yaml:"bootstrap"`

// options for mosdns
Deduplicate bool `yaml:"deduplicate"`
Expand All @@ -73,9 +74,6 @@ func Init(tag string, argsMap handler.Args) (p handler.Plugin, err error) {
if len(u.Addr) == 0 {
return nil, errors.New("missing upstream address")
}
if len(u.IPAddr) == 0 {
return nil, errors.New("missing upstream ip address")
}

serverIPAddrs := make([]net.IP, 0, len(u.IPAddr))
for _, s := range u.IPAddr {
Expand All @@ -87,6 +85,7 @@ func Init(tag string, argsMap handler.Args) (p handler.Plugin, err error) {
}

opt := upstream.Options{}
opt.Bootstrap = args.Bootstrap
opt.ServerIPAddrs = serverIPAddrs

if args.Timeout <= 0 {
Expand Down

0 comments on commit 0139d93

Please sign in to comment.