예제 #1
0
func handleRemoteLocate(ctx *cli.Context, client *daemon.Client) error {
	id, err := id.Cast(ctx.Args()[0])
	if err != nil {
		return ExitCode{
			BadArgs,
			fmt.Sprintf("Invalid ID: %v", err),
		}
	}

	hashes, err := client.RemoteLocate(id, 10, 50000)
	if err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Unable to locate ipfs peers: %v", err),
		}
	}

	for _, hash := range hashes {
		fmt.Println(hash)
	}

	return nil
}