examples/scope: small scope exploder command line tool (#3266)
this provides a small tool that breaks a scope into its constituent parts Change-Id: If011dd457a175eeb6e013a17d1aee4f3edfb8b0c
This commit is contained in:
parent
34764e5c97
commit
863e4cacbe
31
examples/scope/main.go
Normal file
31
examples/scope/main.go
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"storj.io/storj/lib/uplink"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("usage:", os.Args[0], "<scope>")
|
||||
os.Exit(1)
|
||||
}
|
||||
scope, err := uplink.ParseScope(os.Args[1])
|
||||
if err != nil {
|
||||
fmt.Println("invalid scope:", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
encaccess, err := scope.EncryptionAccess.Serialize()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("satellite: %s\napi key: %s\nenc access: %s\n",
|
||||
scope.SatelliteAddr,
|
||||
scope.APIKey.Serialize(),
|
||||
encaccess)
|
||||
}
|
Loading…
Reference in New Issue
Block a user