Skip to content

Commit

Permalink
feat(worker): add 'use_ipv4' option for rsync provider
Browse files Browse the repository at this point in the history
  • Loading branch information
bigeagle committed Sep 7, 2017
1 parent a50a360 commit a475b04
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions worker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type mirrorConfig struct {

Command string `toml:"command"`
UseIPv6 bool `toml:"use_ipv6"`
UseIPv4 bool `toml:"use_ipv4"`
ExcludeFile string `toml:"exclude_file"`
Username string `toml:"username"`
Password string `toml:"password"`
Expand Down
1 change: 1 addition & 0 deletions worker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider {
logDir: logDir,
logFile: filepath.Join(logDir, "latest.log"),
useIPv6: mirror.UseIPv6,
useIPv4: mirror.UseIPv4,
interval: time.Duration(mirror.Interval) * time.Minute,
}
p, err := newRsyncProvider(rc)
Expand Down
4 changes: 3 additions & 1 deletion worker/rsync_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type rsyncConfig struct {
rsyncCmd string
upstreamURL, username, password, excludeFile string
workingDir, logDir, logFile string
useIPv6 bool
useIPv6, useIPv4 bool
interval time.Duration
}

Expand Down Expand Up @@ -49,6 +49,8 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {

if c.useIPv6 {
options = append(options, "-6")
} else if c.useIPv4 {
options = append(options, "-4")
}

if c.excludeFile != "" {
Expand Down

0 comments on commit a475b04

Please sign in to comment.