-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pool: Add easier way to pool configuration
close #432 Signed-off-by: Evgenii Baidakov <[email protected]>
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package pool | ||
|
||
import ( | ||
"crypto/ecdsa" | ||
"crypto/elliptic" | ||
"crypto/rand" | ||
|
||
neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa" | ||
) | ||
|
||
func ExampleNew_easiestWay() { | ||
// Signer generation, like example. | ||
pk, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) | ||
signer := neofsecdsa.SignerRFC6979(*pk) | ||
|
||
pool, _ := New(NewFlatNodeParams([]string{"grpc://localhost:8080", "grpcs://localhost:8081"}), signer, DefaultOptions()) | ||
_ = pool | ||
|
||
// ... | ||
} | ||
|
||
func ExampleNew_adjustingParameters() { | ||
// Signer generation, like example. | ||
pk, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) | ||
signer := neofsecdsa.SignerRFC6979(*pk) | ||
|
||
opts := DefaultOptions() | ||
opts.SetErrorThreshold(10) | ||
|
||
pool, _ := New(NewFlatNodeParams([]string{"grpc://localhost:8080", "grpcs://localhost:8081"}), signer, opts) | ||
_ = pool | ||
|
||
// ... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters