// Fetch pulls down the latest syncthing binary to the provided path.
Fetch pulls down the latest syncthing binary to the provided path.
// Fetch pulls down the latest syncthing binary to the provided path .
func Fetch(path string) error {
	f := &fetcher.Github{
		User:  "syncthing",
		Repo:  "syncthing",
		Asset: matchRelease,
	}
	if err := f.Init(); err != nil {
		return err
	}
	log.Debug("fetching new syncthing binary")
	gzReader, err := f.Fetch()
	if err != nil {
		return err
	}
	tarReader := tar.NewReader(gzReader)
	for {
		header, err := tarReader.Next()
		if err != nil {
			return err
		}
		if strings.HasSuffix(header.Name, "/syncthing") &&
			!strings.Contains(header.Name, "/etc/") {
			return saveBinary(tarReader, path)
		}
	}
}
func Fetch ( path string ) error { f := & fetcher . Github { User : " " , Repo : " " , Asset : matchRelease , } if err := f . Init ( ) ; err != nil { return err } log . Debug ( " " ) gzReader , err := f . Fetch ( ) if err != nil { return err } tarReader := tar . NewReader ( gzReader ) for { header , err := tarReader . Next ( ) if err != nil { return err } if strings . HasSuffix ( header . Name , " " ) && ! strings . Contains ( header . Name , " " ) { return saveBinary ( tarReader , path ) } } }
Fetch pulls down the latest syncthing binary to the provided path.
Fetch pulls down the latest syncthing binary to the provided path .
// There are config files that are named the same thing as the binary. As // they're in etc directories, ignore those too.