github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/cmd/ipfs/name.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag" 7 commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander" 8 ) 9 10 var cmdIpfsName = &commander.Command{ 11 UsageLine: "name [publish | resolve]", 12 Short: "ipfs namespace (ipns) tool", 13 Long: `ipfs name - Get/Set ipfs config values. 14 15 ipfs name publish [<name>] <ref> - Assign the <ref> to <name> 16 ipfs name resolve [<name>] - Resolve the <ref> value of <name> 17 18 IPNS is a PKI namespace, where names are the hashes of public keys, and 19 the private key enables publishing new (signed) values. In both publish 20 and resolve, the default value of <name> is your own identity public key. 21 22 23 Examples: 24 25 Publish a <ref> to your identity name: 26 27 > ipfs name publish QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 28 published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 29 30 Publish a <ref> to another public key: 31 32 > ipfs name publish QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 33 published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 34 35 Resolve the value of your identity: 36 37 > ipfs name resolve 38 QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 39 40 Resolve te value of another name: 41 42 > ipfs name resolve QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n 43 QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy 44 45 `, 46 Run: nameCmd, 47 Flag: *flag.NewFlagSet("ipfs-name", flag.ExitOnError), 48 Subcommands: []*commander.Command{ 49 cmdIpfsPub, 50 cmdIpfsResolve, 51 }, 52 } 53 54 func nameCmd(c *commander.Command, args []string) error { 55 fmt.Println(c.Long) 56 return nil 57 }