mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
33 lines
450 B
Go
33 lines
450 B
Go
|
package sync
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/ledgerwatch/erigon-lib/downloader"
|
||
|
)
|
||
|
|
||
|
func CheckRemote(rcCli *downloader.RCloneClient, src string) error {
|
||
|
|
||
|
remotes, err := rcCli.ListRemotes(context.Background())
|
||
|
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
hasRemote := false
|
||
|
|
||
|
for _, remote := range remotes {
|
||
|
if src == remote {
|
||
|
hasRemote = true
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if !hasRemote {
|
||
|
return fmt.Errorf("unknown remote: %s", src)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|