Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit 24aa469

Browse filesBrowse files
authored
Merge pull request #771 from Starnop/bug-ip
feature: add golbal dfget params to the dfdaemon config
2 parents 68ba7b4 + 1599fa2 commit 24aa469
Copy full SHA for 24aa469

File tree

Expand file treeCollapse file tree

4 files changed

+23
-46
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+23
-46
lines changed
Open diff view settings
Collapse file

‎cmd/dfdaemon/app/root.go‎

Copy file name to clipboardExpand all lines: cmd/dfdaemon/app/root.go
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,8 @@ func init() {
9191

9292
// dfget download config
9393
rf.String("localrepo", filepath.Join(os.Getenv("HOME"), ".small-dragonfly/dfdaemon/data/"), "temp output dir of dfdaemon")
94-
rf.String("callsystem", "com_ops_dragonfly", "caller name")
9594
rf.String("dfpath", defaultDfgetPath, "dfget path")
9695
rf.String("ratelimit", netutils.NetLimit(), "net speed limit,format:xxxM/K")
97-
rf.String("urlfilter", "Signature&Expires&OSSAccessKeyId", "filter specified url fields")
98-
rf.Bool("notbs", true, "not try back source to download if throw exception")
9996
rf.StringSlice("node", nil, "specify the addresses(host:port) of supernodes that will be passed to dfget.")
10097

10198
exitOnError(bindRootFlags(viper.GetViper()), "bind root command flags")
Collapse file

‎dfdaemon/config/config.go‎

Copy file name to clipboardExpand all lines: dfdaemon/config/config.go
+22-18Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ var fs = afero.NewOsFs()
4040
// Properties holds all configurable properties of dfdaemon.
4141
// The default path is '/etc/dragonfly/dfdaemon.yml'
4242
// For examples:
43+
// dfget_flags: ["--node","192.168.33.21","--verbose","--ip","192.168.33.23",
44+
// "--port","15001","--expiretime","3m0s","--alivetime","5m0s",
45+
// "-f","filterParam1&filterParam2"]
46+
//
4347
// registry_mirror:
4448
// # url for the registry mirror
4549
// remote: https://index.docker.io
@@ -88,18 +92,16 @@ type Properties struct {
8892
CertPem string `yaml:"certpem" json:"certpem"`
8993
KeyPem string `yaml:"keypem" json:"keypem"`
9094

95+
Verbose bool `yaml:"verbose" json:"verbose"`
96+
97+
MaxProcs int `yaml:"maxprocs" json:"maxprocs"`
98+
9199
// dfget config
100+
DfgetFlags []string `yaml:"dfget_flags" json:"dfget_flags"`
92101
SuperNodes []string `yaml:"supernodes" json:"supernodes"`
102+
RateLimit string `yaml:"ratelimit" json:"ratelimit"`
93103
DFRepo string `yaml:"localrepo" json:"localrepo"`
94104
DFPath string `yaml:"dfpath" json:"dfpath"`
95-
RateLimit string `yaml:"ratelimit" json:"ratelimit"`
96-
URLFilter string `yaml:"urlfilter" json:"urlfilter"`
97-
CallSystem string `yaml:"callsystem" json:"callsystem"`
98-
Notbs bool `yaml:"notbs" json:"notbs"`
99-
100-
Verbose bool `yaml:"verbose" json:"verbose"`
101-
102-
MaxProcs int `yaml:"maxprocs" json:"maxprocs"`
103105
}
104106

105107
// Validate validates the config
@@ -137,28 +139,30 @@ func (p *Properties) Validate() error {
137139

138140
// DFGetConfig returns config for dfget downloader
139141
func (p *Properties) DFGetConfig() DFGetConfig {
142+
// init DfgetFlags
143+
var dfgetFlags []string
144+
dfgetFlags = append(dfgetFlags, p.DfgetFlags...)
145+
dfgetFlags = append(dfgetFlags, "--dfdaemon")
146+
if p.Verbose {
147+
dfgetFlags = append(dfgetFlags, "--verbose")
148+
}
149+
140150
return DFGetConfig{
151+
DfgetFlags: dfgetFlags,
141152
SuperNodes: p.SuperNodes,
153+
RateLimit: p.RateLimit,
142154
DFRepo: p.DFRepo,
143155
DFPath: p.DFPath,
144-
RateLimit: p.RateLimit,
145-
URLFilter: p.URLFilter,
146-
CallSystem: p.CallSystem,
147-
Notbs: p.Notbs,
148-
Verbose: p.Verbose,
149156
}
150157
}
151158

152159
// DFGetConfig configures how dfdaemon calls dfget
153160
type DFGetConfig struct {
161+
DfgetFlags []string `yaml:"dfget_flags"`
154162
SuperNodes []string `yaml:"supernodes"`
163+
RateLimit string `yaml:"ratelimit"`
155164
DFRepo string `yaml:"localrepo"`
156165
DFPath string `yaml:"dfpath"`
157-
RateLimit string `yaml:"ratelimit"`
158-
URLFilter string `yaml:"urlfilter"`
159-
CallSystem string `yaml:"callsystem"`
160-
Notbs bool `yaml:"notbs"`
161-
Verbose bool `yaml:"verbose"`
162166
}
163167

164168
// RegistryMirror configures the mirror of the official docker registry
Collapse file

‎dfdaemon/config/config_test.go‎

Copy file name to clipboardExpand all lines: dfdaemon/config/config_test.go
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,6 @@ func (ts *configTestSuite) TestProxyMatch() {
266266

267267
}
268268

269-
func (ts *configTestSuite) TestDFGetConfig() {
270-
r := ts.Require()
271-
cfg := defaultConfig()
272-
dfgetCfg := cfg.DFGetConfig()
273-
r.Equal(cfg.SuperNodes, dfgetCfg.SuperNodes)
274-
r.Equal(cfg.DFRepo, dfgetCfg.DFRepo)
275-
r.Equal(cfg.DFPath, dfgetCfg.DFPath)
276-
r.Equal(cfg.RateLimit, dfgetCfg.RateLimit)
277-
r.Equal(cfg.URLFilter, dfgetCfg.URLFilter)
278-
r.Equal(cfg.CallSystem, dfgetCfg.CallSystem)
279-
r.Equal(cfg.Notbs, dfgetCfg.Notbs)
280-
}
281-
282269
func (ts *configTestSuite) TestMirrorTLSConfig() {
283270
r := ts.Require()
284271

Collapse file

‎dfdaemon/downloader/dfget/dfget.go‎

Copy file name to clipboardExpand all lines: dfdaemon/downloader/dfget/dfget.go
+1-12Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,16 @@ func (dfGetter *DFGetter) getCommand(
6464
url string, header map[string][]string, output string,
6565
) (cmd *exec.Cmd) {
6666
args := []string{
67-
"--dfdaemon",
6867
"-u", url,
6968
"-o", output,
7069
}
71-
72-
if dfGetter.config.Notbs {
73-
args = append(args, "--notbs")
74-
}
75-
76-
if dfGetter.config.Verbose {
77-
args = append(args, "--verbose")
78-
}
70+
args = append(args, dfGetter.config.DfgetFlags...)
7971

8072
add := func(key, value string) {
8173
if v := strings.TrimSpace(value); v != "" {
8274
args = append(args, key, v)
8375
}
8476
}
85-
86-
add("--callsystem", dfGetter.config.CallSystem)
87-
add("-f", dfGetter.config.URLFilter)
8877
add("-s", dfGetter.config.RateLimit)
8978
add("--totallimit", dfGetter.config.RateLimit)
9079
add("--node", strings.Join(dfGetter.config.SuperNodes, ","))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.