erigon-pulse/turbo/snapshotsync/client.go
Alex Sharov ecb10e8548
Snapshots download and seed (#3117)
* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* Squashed 'interfaces/' content from commit e5b1945d0

git-subtree-dir: interfaces
git-subtree-split: e5b1945d02da7a7f00e2289034ee90a6edd60184

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save
2021-12-14 10:13:17 +00:00

23 lines
655 B
Go

package snapshotsync
import (
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
"google.golang.org/grpc"
)
//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
func NewClient(addr string) (proto_downloader.DownloaderClient, func() error, error) {
opts := []grpc.DialOption{
grpc.WithInsecure(),
}
conn, err := grpc.Dial(addr, opts...)
if err != nil {
return nil, nil, err
}
return proto_downloader.NewDownloaderClient(conn), conn.Close, nil
}