2020-11-13 16:16:47 +00:00
|
|
|
package snapshotsync
|
|
|
|
|
2021-10-02 10:34:57 +00:00
|
|
|
import (
|
2021-12-14 10:13:17 +00:00
|
|
|
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
|
2021-10-02 10:34:57 +00:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
2020-11-13 16:16:47 +00:00
|
|
|
|
|
|
|
//go:generate ls ./../../interfaces/snapshot_downloader
|
|
|
|
//go:generate protoc --go_out=. --go-grpc_out=. --proto_path=./../../interfaces/snapshot_downloader "external_downloader.proto" -I=. -I=./../../build/include/google
|
|
|
|
|
2021-12-14 10:13:17 +00:00
|
|
|
func NewClient(addr string) (proto_downloader.DownloaderClient, func() error, error) {
|
2020-11-13 16:16:47 +00:00
|
|
|
opts := []grpc.DialOption{
|
|
|
|
grpc.WithInsecure(),
|
|
|
|
}
|
|
|
|
|
|
|
|
conn, err := grpc.Dial(addr, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
2021-12-14 10:13:17 +00:00
|
|
|
return proto_downloader.NewDownloaderClient(conn), conn.Close, nil
|
2020-11-13 16:16:47 +00:00
|
|
|
}
|