├── .dockerignore ├── .gitattributes ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── compose-consensus-4-batch.yml ├── compose-consensus-4-classic.yml ├── compose-consensus-4-defaults.yml ├── compose-consensus-4-links.yml ├── compose-consensus-4-sieve.yml ├── compose-consensus-4.md ├── compose-consensus-4.yml ├── compose-defaults.yml ├── compose-sieve.yml ├── docker-compose.yml ├── events ├── config.go ├── consumer │ ├── adapter.go │ └── consumer.go ├── events_test.go └── producer │ ├── eventhelper.go │ ├── events.go │ ├── handler.go │ ├── producer.go │ └── register_internal_events.go ├── idsBuild.sh ├── infiniteloop.sh ├── main.go ├── obc-ca ├── Dockerfile ├── obcca.yaml ├── obcca │ ├── ca.go │ ├── eca.go │ ├── obcca_test.yaml │ ├── tca.go │ ├── tlsca.go │ ├── tlsca_test.go │ ├── util.go │ ├── validity_period.go │ └── validity_period_test.go ├── protos │ ├── ca.pb.go │ └── ca.proto └── server.go ├── openchain.yaml ├── openchain ├── admin.go ├── admin_test.go ├── api.go ├── api_test.go ├── chaincode │ ├── chaincode_support.go │ ├── config.go │ ├── exectransaction.go │ ├── exectransaction_test.go │ ├── handler.go │ └── shim │ │ ├── chaincode.go │ │ └── handler.go ├── config.go ├── config │ └── config.go ├── consensus │ ├── consensus.go │ ├── controller │ │ └── controller.go │ ├── helper │ │ ├── handler.go │ │ └── helper.go │ ├── noops │ │ ├── config.yaml │ │ ├── configutil.go │ │ ├── noops.go │ │ └── txq.go │ ├── obcpbft │ │ ├── config.yaml │ │ ├── fuzz_test.go │ │ ├── messages.pb.go │ │ ├── messages.proto │ │ ├── obc-batch.go │ │ ├── obc-batch_test.go │ │ ├── obc-classic.go │ │ ├── obc-pbft.go │ │ ├── obc-sieve.go │ │ ├── obc-sieve_test.go │ │ ├── pbft-core.go │ │ ├── pbft-core_mock_test.go │ │ ├── pbft-core_test.go │ │ ├── sign.go │ │ ├── statetransfer_mock_test.go │ │ ├── statetransfer_test.go │ │ └── viewchange.go │ └── statetransfer │ │ └── statetransfer.go ├── container │ ├── config.go │ ├── controller.go │ ├── controller_test.go │ ├── hashfromcode.go │ ├── vm.go │ └── vm_test.go ├── crypto │ ├── client.go │ ├── client_chain.go │ ├── client_crypto.go │ ├── client_ecert_handler.go │ ├── client_impl.go │ ├── client_ks.go │ ├── client_tca.go │ ├── client_tcert_handler.go │ ├── client_tx.go │ ├── crypto.go │ ├── crypto_test.go │ ├── crypto_test.yaml │ ├── ecies │ │ ├── crypto.go │ │ └── generic │ │ │ ├── engine.go │ │ │ ├── engine_test.go │ │ │ ├── es.go │ │ │ ├── kg.go │ │ │ ├── params.go │ │ │ ├── pk.go │ │ │ ├── sk.go │ │ │ ├── spi.go │ │ │ └── spi_test.go │ ├── node.go │ ├── node_conf.go │ ├── node_crypto.go │ ├── node_eca.go │ ├── node_impl.go │ ├── node_ks.go │ ├── node_sign.go │ ├── node_tca.go │ ├── node_tlsca.go │ ├── peer.go │ ├── peer_impl.go │ ├── utils │ │ ├── aes.go │ │ ├── cert.go │ │ ├── conf.go │ │ ├── elliptic.go │ │ ├── errs.go │ │ ├── hash.go │ │ ├── io.go │ │ ├── keys.go │ │ ├── random.go │ │ └── slice.go │ ├── validator.go │ ├── validator_chain.go │ ├── validator_eca.go │ ├── validator_impl.go │ ├── validator_ks.go │ └── validator_sign.go ├── db │ ├── db.go │ ├── db_test.go │ ├── db_test.yaml │ └── db_test_exports.go ├── devops.go ├── devops_test.go ├── discovery.go ├── discovery_test.go ├── example │ └── chaincode │ │ ├── chaincode_example01 │ │ └── chaincode_example01.go │ │ ├── chaincode_example02 │ │ └── chaincode_example02.go │ │ ├── chaincode_example03 │ │ └── chaincode_example03.go │ │ ├── chaincode_example04 │ │ └── chaincode_example04.go │ │ └── chaincode_example05 │ │ └── chaincode_example05.go ├── fsm.go ├── fsm_test.go ├── ledger │ ├── README.md │ ├── blockchain.go │ ├── blockchain_indexes.go │ ├── blockchain_indexes_async.go │ ├── blockchain_indexes_async_test.go │ ├── blockchain_indexes_test.go │ ├── blockchain_test.go │ ├── genesis │ │ ├── genesis.go │ │ ├── genesis_test.go │ │ └── genesis_test.yaml │ ├── ledger.go │ ├── ledger_test.go │ ├── ledger_test_exports.go │ ├── pkg_test.go │ ├── statemgmt │ │ ├── buckettree │ │ │ ├── bucket_hash.go │ │ │ ├── bucket_hash_test.go │ │ │ ├── bucket_key.go │ │ │ ├── bucket_key_test.go │ │ │ ├── bucket_node.go │ │ │ ├── bucket_node_test.go │ │ │ ├── bucket_tree_delta.go │ │ │ ├── bucket_tree_delta_test.go │ │ │ ├── config.go │ │ │ ├── config_test.go │ │ │ ├── data_key.go │ │ │ ├── data_key_test.go │ │ │ ├── data_node.go │ │ │ ├── data_nodes_delta.go │ │ │ ├── data_nodes_delta_test.go │ │ │ ├── db_helper.go │ │ │ ├── pkg_test.go │ │ │ ├── range_scan_iterator.go │ │ │ ├── range_scan_iterator_test.go │ │ │ ├── snapshot_iterator.go │ │ │ ├── snapshot_iterator_test.go │ │ │ ├── state_impl.go │ │ │ ├── state_impl_test.go │ │ │ └── test.yaml │ │ ├── commons.go │ │ ├── hashable_state.go │ │ ├── state │ │ │ ├── composite_range_scan_iterator.go │ │ │ ├── composite_range_scan_iterator_test.go │ │ │ ├── pkg_test.go │ │ │ ├── state.go │ │ │ ├── state_snapshot.go │ │ │ ├── state_snapshot_test.go │ │ │ ├── state_test.go │ │ │ └── test.yaml │ │ ├── state_delta.go │ │ ├── state_delta_iterator.go │ │ ├── state_delta_iterator_test.go │ │ ├── state_delta_test.go │ │ ├── test_exports.go │ │ └── trie │ │ │ ├── byteTrieKey.go │ │ │ ├── hexTrieKey.go │ │ │ ├── pkg_test.go │ │ │ ├── range_scan_iterator.go │ │ │ ├── range_scan_iterator_test.go │ │ │ ├── snapshot_iterator.go │ │ │ ├── snapshot_iterator_test.go │ │ │ ├── state_trie.go │ │ │ ├── state_trie_test.go │ │ │ ├── test.yaml │ │ │ ├── trie_db_helper.go │ │ │ ├── trie_delta.go │ │ │ ├── trie_key.go │ │ │ ├── trie_node.go │ │ │ └── trie_node_test.go │ ├── test.yaml │ ├── testutil │ │ └── test_util.go │ └── util │ │ └── util.go ├── logging.go ├── peer │ ├── bddtests │ │ ├── compose-defaults.yml │ │ ├── docker-compose-1.yml │ │ ├── docker-compose-2-tls-basic.yml │ │ ├── docker-compose-3.yml │ │ ├── docker-compose-4-consensus-base.yml │ │ ├── docker-compose-4-consensus-batch.yml │ │ ├── docker-compose-4-consensus-classic.yml │ │ ├── docker-compose-4-consensus-noops.yml │ │ ├── docker-compose-4-consensus-sieve.yml │ │ ├── docker-compose-4.yml │ │ ├── docker-compose-5.yml │ │ ├── environment.py │ │ ├── peer_basic.feature │ │ ├── steps │ │ │ ├── __init__.py │ │ │ ├── bdd_test_util.py │ │ │ └── peer_basic_impl.py │ │ ├── tlsca.cert │ │ └── tlsca.priv │ ├── errors.go │ ├── handler.go │ ├── handler_sync_state.go │ ├── peer.go │ └── peer_test.go ├── rest │ ├── api.ts │ ├── rest_api.go │ ├── rest_api.json │ └── rest_util.go ├── system_chaincode │ └── validity_period_update │ │ └── validity_period_update.go └── util │ ├── queue.go │ ├── queue_test.go │ ├── utils.go │ └── utils_test.go ├── protos ├── api.pb.go ├── api.proto ├── block.go ├── block_test.go ├── chaincode.pb.go ├── chaincode.proto ├── devops.pb.go ├── devops.proto ├── events.pb.go ├── events.proto ├── init.go ├── openchain.pb.go ├── openchain.proto ├── server_admin.pb.go ├── server_admin.proto ├── transaction.go └── transaction_test.go └── vendor ├── github.com ├── BurntSushi │ └── toml │ │ ├── COMPATIBLE │ │ ├── COPYING │ │ ├── Makefile │ │ ├── README.md │ │ ├── decode.go │ │ ├── decode_meta.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── encoding_types.go │ │ ├── encoding_types_1.1.go │ │ ├── lex.go │ │ ├── parse.go │ │ ├── session.vim │ │ ├── type_check.go │ │ └── type_fields.go ├── cpuguy83 │ └── go-md2man │ │ └── md2man │ │ ├── md2man.go │ │ └── roff.go ├── fsouza │ └── go-dockerclient │ │ ├── AUTHORS │ │ ├── DOCKER-LICENSE │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.markdown │ │ ├── auth.go │ │ ├── change.go │ │ ├── client.go │ │ ├── container.go │ │ ├── env.go │ │ ├── event.go │ │ ├── exec.go │ │ ├── external │ │ └── github.com │ │ │ ├── Sirupsen │ │ │ └── logrus │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── entry.go │ │ │ │ ├── exported.go │ │ │ │ ├── formatter.go │ │ │ │ ├── hooks.go │ │ │ │ ├── json_formatter.go │ │ │ │ ├── logger.go │ │ │ │ ├── logrus.go │ │ │ │ ├── terminal_bsd.go │ │ │ │ ├── terminal_freebsd.go │ │ │ │ ├── terminal_linux.go │ │ │ │ ├── terminal_notwindows.go │ │ │ │ ├── terminal_openbsd.go │ │ │ │ ├── terminal_windows.go │ │ │ │ ├── text_formatter.go │ │ │ │ └── writer.go │ │ │ ├── docker │ │ │ └── docker │ │ │ │ ├── opts │ │ │ │ ├── envfile.go │ │ │ │ ├── hosts_unix.go │ │ │ │ ├── hosts_windows.go │ │ │ │ ├── ip.go │ │ │ │ ├── opts.go │ │ │ │ └── ulimit.go │ │ │ │ ├── pkg │ │ │ │ ├── archive │ │ │ │ │ ├── README.md │ │ │ │ │ ├── archive.go │ │ │ │ │ ├── archive_unix.go │ │ │ │ │ ├── archive_windows.go │ │ │ │ │ ├── changes.go │ │ │ │ │ ├── changes_linux.go │ │ │ │ │ ├── changes_other.go │ │ │ │ │ ├── changes_unix.go │ │ │ │ │ ├── changes_windows.go │ │ │ │ │ ├── copy.go │ │ │ │ │ ├── copy_unix.go │ │ │ │ │ ├── copy_windows.go │ │ │ │ │ ├── diff.go │ │ │ │ │ ├── example_changes.go │ │ │ │ │ ├── time_linux.go │ │ │ │ │ ├── time_unsupported.go │ │ │ │ │ └── wrap.go │ │ │ │ ├── fileutils │ │ │ │ │ └── fileutils.go │ │ │ │ ├── homedir │ │ │ │ │ └── homedir.go │ │ │ │ ├── ioutils │ │ │ │ │ ├── fmt.go │ │ │ │ │ ├── multireader.go │ │ │ │ │ ├── readers.go │ │ │ │ │ ├── scheduler.go │ │ │ │ │ ├── scheduler_gccgo.go │ │ │ │ │ ├── writeflusher.go │ │ │ │ │ └── writers.go │ │ │ │ ├── parsers │ │ │ │ │ └── parsers.go │ │ │ │ ├── pools │ │ │ │ │ └── pools.go │ │ │ │ ├── promise │ │ │ │ │ └── promise.go │ │ │ │ ├── stdcopy │ │ │ │ │ └── stdcopy.go │ │ │ │ ├── system │ │ │ │ │ ├── errors.go │ │ │ │ │ ├── events_windows.go │ │ │ │ │ ├── filesys.go │ │ │ │ │ ├── filesys_windows.go │ │ │ │ │ ├── lstat.go │ │ │ │ │ ├── lstat_windows.go │ │ │ │ │ ├── meminfo.go │ │ │ │ │ ├── meminfo_linux.go │ │ │ │ │ ├── meminfo_unsupported.go │ │ │ │ │ ├── meminfo_windows.go │ │ │ │ │ ├── mknod.go │ │ │ │ │ ├── mknod_windows.go │ │ │ │ │ ├── stat.go │ │ │ │ │ ├── stat_freebsd.go │ │ │ │ │ ├── stat_linux.go │ │ │ │ │ ├── stat_unsupported.go │ │ │ │ │ ├── stat_windows.go │ │ │ │ │ ├── umask.go │ │ │ │ │ ├── umask_windows.go │ │ │ │ │ ├── utimes_darwin.go │ │ │ │ │ ├── utimes_freebsd.go │ │ │ │ │ ├── utimes_linux.go │ │ │ │ │ ├── utimes_unsupported.go │ │ │ │ │ ├── xattrs_linux.go │ │ │ │ │ └── xattrs_unsupported.go │ │ │ │ ├── ulimit │ │ │ │ │ └── ulimit.go │ │ │ │ └── units │ │ │ │ │ ├── duration.go │ │ │ │ │ └── size.go │ │ │ │ └── volume │ │ │ │ └── volume.go │ │ │ └── opencontainers │ │ │ └── runc │ │ │ └── libcontainer │ │ │ └── user │ │ │ ├── MAINTAINERS │ │ │ ├── lookup.go │ │ │ ├── lookup_unix.go │ │ │ ├── lookup_unsupported.go │ │ │ └── user.go │ │ ├── image.go │ │ ├── misc.go │ │ ├── network.go │ │ ├── signal.go │ │ ├── tar.go │ │ ├── tls.go │ │ └── volume.go ├── gocraft │ └── web │ │ ├── BENCHMARK_RESULTS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cover.sh │ │ ├── logger_middleware.go │ │ ├── options_handler.go │ │ ├── panic_handler.go │ │ ├── request.go │ │ ├── response_writer.go │ │ ├── router_serve.go │ │ ├── router_setup.go │ │ ├── show_errors_middleware.go │ │ ├── static_middleware.go │ │ └── tree.go ├── golang │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── jsonpb │ │ └── jsonpb.go │ │ ├── proto │ │ ├── Makefile │ │ ├── clone.go │ │ ├── decode.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── text.go │ │ └── text_parser.go │ │ └── protoc-gen-go │ │ ├── Makefile │ │ ├── descriptor │ │ ├── Makefile │ │ ├── descriptor.pb.go │ │ └── descriptor.pb.golden │ │ ├── doc.go │ │ ├── generator │ │ ├── Makefile │ │ └── generator.go │ │ ├── internal │ │ └── grpc │ │ │ └── grpc.go │ │ ├── link_grpc.go │ │ ├── main.go │ │ └── plugin │ │ ├── Makefile │ │ ├── plugin.pb.go │ │ └── plugin.pb.golden ├── google │ └── gofuzz │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ └── fuzz.go ├── howeyc │ └── gopass │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── bsd.go │ │ ├── nix.go │ │ ├── pass.go │ │ └── win.go ├── inconshreveable │ └── mousetrap │ │ ├── LICENSE │ │ ├── README.md │ │ ├── trap_others.go │ │ ├── trap_windows.go │ │ └── trap_windows_1.4.go ├── kr │ ├── pretty │ │ ├── License │ │ ├── Readme │ │ ├── diff.go │ │ ├── formatter.go │ │ ├── pretty.go │ │ └── zero.go │ └── text │ │ ├── License │ │ ├── Readme │ │ ├── doc.go │ │ ├── indent.go │ │ └── wrap.go ├── looplab │ └── fsm │ │ ├── LICENSE │ │ ├── README.md │ │ ├── errors.go │ │ ├── event.go │ │ ├── fsm.go │ │ └── wercker.yml ├── magiconair │ └── properties │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── lex.go │ │ ├── load.go │ │ ├── parser.go │ │ ├── properties.go │ │ └── rangecheck.go ├── mattn │ └── go-sqlite3 │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backup.go │ │ ├── callback.go │ │ ├── code │ │ ├── sqlite3-binding.c │ │ ├── sqlite3-binding.h │ │ └── sqlite3ext.h │ │ ├── doc.go │ │ ├── error.go │ │ ├── sqlite3-binding.c │ │ ├── sqlite3-binding.h │ │ ├── sqlite3.go │ │ ├── sqlite3_icu.go │ │ ├── sqlite3_libsqlite3.go │ │ ├── sqlite3_load_extension.go │ │ ├── sqlite3_omit_load_extension.go │ │ ├── sqlite3_other.go │ │ └── sqlite3_windows.go ├── mitchellh │ └── mapstructure │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode_hooks.go │ │ ├── error.go │ │ └── mapstructure.go ├── op │ └── go-logging │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backend.go │ │ ├── format.go │ │ ├── level.go │ │ ├── log.go │ │ ├── logger.go │ │ ├── memory.go │ │ ├── multi.go │ │ ├── syslog.go │ │ └── syslog_fallback.go ├── russross │ └── blackfriday │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── block.go │ │ ├── html.go │ │ ├── inline.go │ │ ├── latex.go │ │ ├── markdown.go │ │ └── smartypants.go ├── shurcooL │ └── sanitized_anchor_name │ │ ├── README.md │ │ └── main.go ├── spf13 │ ├── cast │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cast.go │ │ └── caste.go │ ├── cobra │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── bash_completions.go │ │ ├── bash_completions.md │ │ ├── cobra.go │ │ ├── command.go │ │ ├── doc_util.go │ │ ├── man_docs.go │ │ ├── man_docs.md │ │ ├── md_docs.go │ │ └── md_docs.md │ ├── jwalterweatherman │ │ ├── LICENSE │ │ ├── README.md │ │ └── thatswhyyoualwaysleaveanote.go │ ├── pflag │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bool.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── string.go │ │ ├── string_slice.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ └── uint8.go │ └── viper │ │ ├── LICENSE │ │ ├── README.md │ │ ├── util.go │ │ └── viper.go └── tecbot │ └── gorocksdb │ ├── LICENSE │ ├── README.md │ ├── backup.go │ ├── cache.go │ ├── cf_handle.go │ ├── compaction_filter.go │ ├── comparator.go │ ├── db.go │ ├── doc.go │ ├── dynflag.go │ ├── embedflag.go │ ├── env.go │ ├── filter_policy.go │ ├── gorocksdb.c │ ├── gorocksdb.h │ ├── iterator.go │ ├── merge_operator.go │ ├── options.go │ ├── options_block_based_table.go │ ├── options_compaction.go │ ├── options_compression.go │ ├── options_flush.go │ ├── options_read.go │ ├── options_write.go │ ├── slice.go │ ├── slice_transform.go │ ├── snapshot.go │ ├── util.go │ └── write_batch.go ├── golang.org └── x │ ├── crypto │ ├── LICENSE │ ├── PATENTS │ ├── hkdf │ │ └── hkdf.go │ ├── sha3 │ │ ├── doc.go │ │ ├── hashes.go │ │ ├── keccakf.go │ │ ├── register.go │ │ ├── sha3.go │ │ ├── shake.go │ │ ├── xor.go │ │ ├── xor_generic.go │ │ └── xor_unaligned.go │ └── ssh │ │ ├── buffer.go │ │ ├── certs.go │ │ ├── channel.go │ │ ├── cipher.go │ │ ├── client.go │ │ ├── client_auth.go │ │ ├── common.go │ │ ├── connection.go │ │ ├── doc.go │ │ ├── handshake.go │ │ ├── kex.go │ │ ├── keys.go │ │ ├── mac.go │ │ ├── messages.go │ │ ├── mux.go │ │ ├── server.go │ │ ├── session.go │ │ ├── tcpip.go │ │ ├── terminal │ │ ├── terminal.go │ │ ├── util.go │ │ ├── util_bsd.go │ │ ├── util_linux.go │ │ └── util_windows.go │ │ └── transport.go │ ├── net │ ├── context │ │ └── context.go │ ├── http2 │ │ ├── Dockerfile │ │ ├── Makefile │ │ ├── README │ │ ├── errors.go │ │ ├── fixed_buffer.go │ │ ├── flow.go │ │ ├── frame.go │ │ ├── gotrack.go │ │ ├── headermap.go │ │ ├── hpack │ │ │ ├── encode.go │ │ │ ├── hpack.go │ │ │ ├── huffman.go │ │ │ └── tables.go │ │ ├── http2.go │ │ ├── pipe.go │ │ ├── server.go │ │ ├── transport.go │ │ ├── write.go │ │ └── writesched.go │ ├── internal │ │ └── timeseries │ │ │ └── timeseries.go │ └── trace │ │ ├── events.go │ │ ├── histogram.go │ │ └── trace.go │ └── tools │ ├── cmd │ └── cover │ │ ├── README │ │ ├── cover.go │ │ ├── cover_test.go │ │ ├── doc.go │ │ ├── func.go │ │ └── html.go │ └── cover │ └── profile.go ├── google.golang.org └── grpc │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── Makefile │ ├── PATENTS │ ├── README.md │ ├── call.go │ ├── clientconn.go │ ├── codegen.sh │ ├── codes │ ├── code_string.go │ └── codes.go │ ├── credentials │ └── credentials.go │ ├── doc.go │ ├── grpclog │ └── logger.go │ ├── metadata │ └── metadata.go │ ├── picker.go │ ├── rpc_util.go │ ├── server.go │ ├── stream.go │ ├── trace.go │ └── transport │ ├── control.go │ ├── http2_client.go │ ├── http2_server.go │ ├── http_util.go │ └── transport.go ├── google └── protobuf │ ├── empty.pb.go │ └── timestamp.pb.go ├── gopkg.in └── yaml.v2 │ ├── LICENSE │ ├── LICENSE.libyaml │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── vendor.json /.dockerignore: -------------------------------------------------------------------------------- 1 | obc-peer 2 | .git 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf 2 | *.tpl text eol=lf 3 | *.conf text eol=lf 4 | *.solc text eol=lf 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local build binaries 2 | obc-peer 3 | node-cli/node-cli 4 | *.pyc 5 | /build/_workspace 6 | /bin 7 | .idea 8 | *.iml 9 | .DS_Store 10 | tags 11 | .tags 12 | /obcca/.obcca -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | from golang:1.5.1 2 | ENV GO15VENDOREXPERIMENT=1 3 | # Install RocksDB 4 | RUN cd /opt && git clone --branch v4.1 --single-branch --depth 1 https://github.com/facebook/rocksdb.git && cd rocksdb && make shared_lib 5 | ENV LD_LIBRARY_PATH=/opt/rocksdb:$LD_LIBRARY_PATH 6 | RUN apt-get update && apt-get install -y libsnappy-dev zlib1g-dev libbz2-dev 7 | # Copy GOPATH src and install Peer 8 | RUN mkdir -p /var/openchain/db 9 | RUN mkdir -p /var/openchain/production 10 | WORKDIR $GOPATH/src/github.com/openblockchain/obc-peer/ 11 | COPY . . 12 | RUN CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install && cp $GOPATH/src/github.com/openblockchain/obc-peer/openchain.yaml $GOPATH/bin 13 | RUN cp $GOPATH/src/github.com/openblockchain/obc-peer/openchain/consensus/obcpbft/config.yaml $GOPATH/bin 14 | # RUN CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install 15 | # RUN cd obc-ca && go install 16 | -------------------------------------------------------------------------------- /compose-consensus-4-batch.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | environment: 3 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 4 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=batch 5 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 6 | 7 | vp1: 8 | environment: 9 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 10 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=batch 11 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 12 | 13 | vp2: 14 | environment: 15 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 16 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=batch 17 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 18 | 19 | vp3: 20 | environment: 21 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 22 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=batch 23 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 24 | -------------------------------------------------------------------------------- /compose-consensus-4-classic.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | environment: 3 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 4 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=classic 5 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 6 | 7 | vp1: 8 | environment: 9 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 10 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=classic 11 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 12 | 13 | vp2: 14 | environment: 15 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 16 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=classic 17 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 18 | 19 | vp3: 20 | environment: 21 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 22 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=classic 23 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 24 | -------------------------------------------------------------------------------- /compose-consensus-4-defaults.yml: -------------------------------------------------------------------------------- 1 | vp: 2 | image: openchain-peer 3 | environment: 4 | - OPENCHAIN_PEER_ADDRESSAUTODETECT=true 5 | command: obc-peer peer 6 | -------------------------------------------------------------------------------- /compose-consensus-4-links.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | links: 3 | - obcca 4 | 5 | vp1: 6 | links: 7 | - vp0 8 | - obcca 9 | 10 | vp2: 11 | links: 12 | - vp0 13 | - obcca 14 | 15 | vp3: 16 | links: 17 | - vp0 18 | - obcca 19 | 20 | cli: 21 | links: 22 | - obcca 23 | - vp0 24 | - vp1 25 | - vp2 26 | - vp3 27 | -------------------------------------------------------------------------------- /compose-consensus-4-sieve.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | environment: 3 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 4 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 5 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 6 | 7 | vp1: 8 | environment: 9 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 10 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 11 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 12 | 13 | vp2: 14 | environment: 15 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 16 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 17 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 18 | 19 | vp3: 20 | environment: 21 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 22 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 23 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 24 | -------------------------------------------------------------------------------- /compose-defaults.yml: -------------------------------------------------------------------------------- 1 | vp: 2 | build: . 3 | environment: 4 | - OPENCHAIN_PEER_ADDRESSAUTODETECT=true 5 | command: obc-peer peer 6 | -------------------------------------------------------------------------------- /compose-sieve.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | environment: 3 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 4 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 5 | 6 | vp1: 7 | environment: 8 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 9 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 10 | 11 | vp2: 12 | environment: 13 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 14 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 15 | 16 | vp3: 17 | environment: 18 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 19 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 20 | 21 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 8 | - OPENCHAIN_PEER_VALIDATOR_REPLICAS_IPS=vp0:30303 vp1:30303 vp2:30303 vp3:30303 9 | 10 | vp1: 11 | extends: 12 | service: vp0 13 | environment: 14 | - OPENCHAIN_PEER_ID=vp1 15 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 16 | links: 17 | - vp0 18 | 19 | vp2: 20 | extends: 21 | service: vp0 22 | environment: 23 | - OPENCHAIN_PEER_ID=vp2 24 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 25 | links: 26 | - vp0 27 | 28 | vp3: 29 | extends: 30 | service: vp0 31 | environment: 32 | - OPENCHAIN_PEER_ID=vp3 33 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 34 | links: 35 | - vp0 36 | -------------------------------------------------------------------------------- /events/consumer/adapter.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package consumer 21 | 22 | import ( 23 | ehpb "github.com/openblockchain/obc-peer/protos" 24 | ) 25 | 26 | //EventAdapter is the interface by which a openchain event client registers interested events and 27 | //receives messages from the openchain event Server 28 | type EventAdapter interface { 29 | GetInterestedEvents() ([]*ehpb.Interest, error) 30 | Recv(msg *ehpb.OpenchainEvent) (bool,error) 31 | Disconnected(err error) 32 | } 33 | -------------------------------------------------------------------------------- /events/producer/eventhelper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package producer 21 | 22 | import ( 23 | ehpb "github.com/openblockchain/obc-peer/protos" 24 | ) 25 | 26 | //CreateBlockEvent creates a OpenchainEvent from a Block 27 | func CreateBlockEvent(te *ehpb.Block) *ehpb.OpenchainEvent { 28 | return &ehpb.OpenchainEvent{&ehpb.OpenchainEvent_Block{Block: te}} 29 | } 30 | -------------------------------------------------------------------------------- /infiniteloop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Use this script as the command for the cli Docker container 3 | # in the compose-consensus-4 set. It keeps the container up while we wait for other setup to complete 4 | 5 | set -e 6 | 7 | while true 8 | do 9 | echo "ttd" 10 | sleep 10m 11 | done 12 | -------------------------------------------------------------------------------- /obc-ca/Dockerfile: -------------------------------------------------------------------------------- 1 | from golang:1.5.1 2 | ENV GO15VENDOREXPERIMENT=1 3 | # Install RocksDB 4 | RUN cd /opt && git clone --branch v4.1 --single-branch --depth 1 https://github.com/facebook/rocksdb.git && cd rocksdb && make shared_lib 5 | ENV LD_LIBRARY_PATH=/opt/rocksdb:$LD_LIBRARY_PATH 6 | RUN apt-get update && apt-get install -y libsnappy-dev zlib1g-dev libbz2-dev 7 | # Copy GOPATH src and install Peer 8 | RUN mkdir -p /var/openchain/db 9 | WORKDIR $GOPATH/src/github.com/openblockchain/obc-peer/ 10 | COPY . . 11 | WORKDIR obc-ca 12 | RUN pwd 13 | RUN CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install && cp $GOPATH/src/github.com/openblockchain/obc-peer/obc-ca/obcca.yaml $GOPATH/bin 14 | # RUN CGO_CFLAGS="-I/opt/rocksdb/include" CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" go install 15 | -------------------------------------------------------------------------------- /openchain/admin_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package openchain 21 | 22 | import "testing" 23 | 24 | func TestServer_Status(t *testing.T) { 25 | t.Skip("TBD") 26 | //performHandshake(t, peerClientConn) 27 | } 28 | -------------------------------------------------------------------------------- /openchain/consensus/noops/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ############################################################################### 3 | # 4 | # NOOPS PROPERTIES 5 | # 6 | # These properties may be passed as environment variables when starting up 7 | # a validating peer with prefix OPENCHAIN_NOOPS. For example: 8 | # OPENCHAIN_NOOPS_BLOCK_SIZE=1000 9 | # OPENCHAIN_NOOPS_BLOCK_TIMEOUT=2 10 | # 11 | ############################################################################### 12 | 13 | # Define properties for a block: A block is created whenever "size" or "timeout" 14 | # occurs. When we process a block, we grab all transactions in the queue, so 15 | # the number of transactions in a block may be greater than the "size". 16 | block: 17 | # Number of transactions per block. Must be > 0. Set to 1 for testing 18 | size: 500 19 | 20 | # Number of seconds to wait for a block. Min is 1 second 21 | timeout: 1 22 | -------------------------------------------------------------------------------- /openchain/consensus/noops/configutil.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package noops 21 | 22 | import ( 23 | "fmt" 24 | "strings" 25 | 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | const configPrefix = "OPENCHAIN_NOOPS" 30 | 31 | func loadConfig() (config *viper.Viper) { 32 | config = viper.New() 33 | 34 | // for environment variables 35 | config.SetEnvPrefix(configPrefix) 36 | config.AutomaticEnv() 37 | replacer := strings.NewReplacer(".", "_") 38 | config.SetEnvKeyReplacer(replacer) 39 | 40 | config.SetConfigName("config") 41 | config.AddConfigPath("./") 42 | config.AddConfigPath("./openchain/consensus/noops/") 43 | err := config.ReadInConfig() 44 | if err != nil { 45 | panic(fmt.Errorf("Error reading %s plugin config: %s", configPrefix, err)) 46 | } 47 | return config 48 | } 49 | -------------------------------------------------------------------------------- /openchain/consensus/noops/txq.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package noops 21 | 22 | import ( 23 | pb "github.com/openblockchain/obc-peer/protos" 24 | ) 25 | 26 | type txq struct { 27 | i int 28 | q []*pb.Transaction 29 | } 30 | 31 | func newTXQ(size int) *txq { 32 | o := &txq{} 33 | o.i = 0 34 | if size < 1 { 35 | size = 1 36 | } 37 | o.q = make([]*pb.Transaction, size) 38 | return o 39 | } 40 | 41 | func (o *txq) append(tx *pb.Transaction) { 42 | if cap(o.q) > o.i { 43 | o.q[o.i] = tx 44 | o.i++ 45 | } 46 | } 47 | 48 | func (o *txq) getTXs() []*pb.Transaction { 49 | length := o.i 50 | o.i = 0 51 | return o.q[:length] 52 | } 53 | 54 | func (o *txq) isFull() bool { 55 | if cap(o.q) == o.i { 56 | return true 57 | } 58 | return false 59 | } 60 | 61 | func (o *txq) size() int { 62 | return o.i 63 | } 64 | 65 | func (o *txq) reset() { 66 | o.i = 0 67 | } 68 | -------------------------------------------------------------------------------- /openchain/crypto/client_crypto.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package crypto 21 | 22 | func (client *clientImpl) initCryptoEngine() error { 23 | // Load TCertOwnerKDFKey 24 | if err := client.loadTCertOwnerKDFKey(); err != nil { 25 | return err 26 | } 27 | 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /openchain/crypto/ecies/generic/engine_test.go: -------------------------------------------------------------------------------- 1 | package generic 2 | -------------------------------------------------------------------------------- /openchain/crypto/ecies/generic/params.go: -------------------------------------------------------------------------------- 1 | package generic 2 | 3 | import ( 4 | "crypto" 5 | "crypto/cipher" 6 | "hash" 7 | ) 8 | 9 | type Params struct { 10 | Hash func() hash.Hash 11 | hashAlgo crypto.Hash 12 | Cipher func([]byte) (cipher.Block, error) 13 | BlockSize int 14 | KeyLen int 15 | } 16 | -------------------------------------------------------------------------------- /openchain/crypto/ecies/generic/pk.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package generic 21 | 22 | import ( 23 | "crypto/ecdsa" 24 | "io" 25 | ) 26 | 27 | type publicKeyImpl struct { 28 | pub *ecdsa.PublicKey 29 | rand io.Reader 30 | params *Params 31 | } 32 | 33 | func (pk *publicKeyImpl) GetRand() io.Reader { 34 | return pk.rand 35 | } 36 | 37 | func (pk *publicKeyImpl) IsPublic() bool { 38 | return true 39 | } 40 | -------------------------------------------------------------------------------- /openchain/crypto/node.go: -------------------------------------------------------------------------------- 1 | package crypto 2 | 3 | import "github.com/op/go-logging" 4 | 5 | // Log 6 | 7 | var log = logging.MustGetLogger("CRYPTO") 8 | -------------------------------------------------------------------------------- /openchain/crypto/utils/hash.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package utils 21 | 22 | import ( 23 | "crypto/hmac" 24 | "golang.org/x/crypto/sha3" 25 | "hash" 26 | ) 27 | 28 | var ( 29 | newHash = sha3.New384 30 | ) 31 | 32 | // NewHash returns a new hash function 33 | func NewHash() hash.Hash { 34 | return newHash() 35 | } 36 | 37 | // Hash hashes the msh using the predefined hash function 38 | func Hash(msg []byte) []byte { 39 | hash := NewHash() 40 | hash.Write(msg) 41 | return hash.Sum(nil) 42 | } 43 | 44 | // HMAC hmacs x using key key 45 | func HMAC(key, x []byte) []byte { 46 | mac := hmac.New(newHash, key) 47 | mac.Write(x) 48 | 49 | return mac.Sum(nil) 50 | } 51 | 52 | // HMACTruncated hmacs x using key key and truncate to truncation 53 | func HMACTruncated(key, x []byte, truncation int) []byte { 54 | mac := hmac.New(newHash, key) 55 | mac.Write(x) 56 | 57 | return mac.Sum(nil)[:truncation] 58 | } 59 | -------------------------------------------------------------------------------- /openchain/crypto/utils/random.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package utils 21 | 22 | import "crypto/rand" 23 | 24 | // GetRandomBytes returns len random looking bytes 25 | func GetRandomBytes(len int) ([]byte, error) { 26 | key := make([]byte, len) 27 | 28 | _, err := rand.Read(key) 29 | if err != nil { 30 | return nil, err 31 | } 32 | 33 | return key, nil 34 | } 35 | -------------------------------------------------------------------------------- /openchain/crypto/utils/slice.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package utils 21 | 22 | // Clone clones the passed slice 23 | func Clone(src []byte) []byte { 24 | clone := make([]byte, len(src)) 25 | copy(clone, src) 26 | 27 | return clone 28 | } 29 | -------------------------------------------------------------------------------- /openchain/crypto/validator_sign.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package crypto 21 | 22 | import ( 23 | "github.com/openblockchain/obc-peer/openchain/crypto/utils" 24 | ) 25 | 26 | func (validator *validatorImpl) sign(signKey interface{}, msg []byte) ([]byte, error) { 27 | sigma, err := utils.ECDSASign(signKey, msg) 28 | 29 | validator.peer.node.log.Debug("Signing message [%s], sigma [%s].", utils.EncodeBase64(msg), utils.EncodeBase64(sigma)) 30 | 31 | return sigma, err 32 | } 33 | 34 | func (validator *validatorImpl) verify(verKey interface{}, msg, signature []byte) (bool, error) { 35 | validator.peer.node.log.Debug("Verifing signature [%s] against message [%s].", 36 | utils.EncodeBase64(signature), 37 | utils.EncodeBase64(msg), 38 | ) 39 | 40 | return utils.ECDSAVerify(verKey, msg, signature) 41 | } 42 | -------------------------------------------------------------------------------- /openchain/db/db_test.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Peer section 4 | # 5 | ############################################################################### 6 | peer: 7 | # Path on the file system where peer will store data 8 | fileSystemPath: /var/openchain/test/db_test 9 | -------------------------------------------------------------------------------- /openchain/discovery.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package openchain 21 | 22 | import "github.com/spf13/viper" 23 | 24 | // GetRootNode place holder function for providing a boostrap address for a Validating Peer. 25 | func GetRootNode() (string, error) { 26 | return viper.GetString("peer.discovery.rootnode"), nil 27 | } 28 | -------------------------------------------------------------------------------- /openchain/discovery_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package openchain 21 | 22 | import "testing" 23 | 24 | func TestDiscovery_GetRootNode(t *testing.T) { 25 | rootNode, err := GetRootNode() 26 | if err != nil { 27 | t.Fail() 28 | t.Logf("Error getting rootnode: %s", err) 29 | } 30 | t.Logf("RootNode value: %s", rootNode) 31 | 32 | } 33 | -------------------------------------------------------------------------------- /openchain/ledger/README.md: -------------------------------------------------------------------------------- 1 | ## Ledger Package 2 | 3 | This package implements the ledger for Openchain which includes the blockchain and global state. 4 | 5 | If you're looking for API to work with the blockchain or state, look in `ledger.go`. This is the file where all public functions are exposed and is extensively documented. The sections in the file are: 6 | 7 | ### Transaction-batch functions 8 | 9 | These are functions that consensus should call. `BeginTxBatch` followed by `CommitTxBatch` or `RollbackTxBatch`. These functions will add a block to the blockchain with the specified transactions. 10 | 11 | ### World-state functions 12 | 13 | These functions are used to modify the global state. They would generally be called by the VM based on requests from chaincode. 14 | 15 | ### Blockchain functions 16 | 17 | These functions can be used to retrieve blocks/transactions from the blockchain or other information such as the blockchain size. Addition of blocks to the blockchain is done though the transaction-batch related functions. 18 | -------------------------------------------------------------------------------- /openchain/ledger/ledger_test_exports.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package ledger 21 | 22 | import ( 23 | "github.com/openblockchain/obc-peer/openchain/db" 24 | "github.com/openblockchain/obc-peer/openchain/ledger/testutil" 25 | "testing" 26 | ) 27 | 28 | var testDBWrapper = db.NewTestDBWrapper() 29 | 30 | func InitTestLedger(t *testing.T) *Ledger { 31 | testDBWrapper.CreateFreshDB(t) 32 | _, err := GetLedger() 33 | testutil.AssertNoError(t, err, "Error while constructing ledger") 34 | newLedger, err := newLedger() 35 | testutil.AssertNoError(t, err, "Error while constructing ledger") 36 | ledger = newLedger 37 | return newLedger 38 | } 39 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/buckettree/data_key_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package buckettree 21 | 22 | import ( 23 | "testing" 24 | 25 | "github.com/openblockchain/obc-peer/openchain/ledger/testutil" 26 | ) 27 | 28 | func TestDataKey(t *testing.T) { 29 | conf = newConfig(26, 3, fnvHash) 30 | dataKey := newDataKey("chaincodeID", "key") 31 | encodedBytes := dataKey.getEncodedBytes() 32 | dataKeyFromEncodedBytes := newDataKeyFromEncodedBytes(encodedBytes) 33 | testutil.AssertEquals(t, dataKey, dataKeyFromEncodedBytes) 34 | } 35 | 36 | func TestDataKeyGetBucketKey(t *testing.T) { 37 | conf = newConfig(26, 3, fnvHash) 38 | newDataKey("chaincodeID1", "key1").getBucketKey() 39 | newDataKey("chaincodeID1", "key2").getBucketKey() 40 | newDataKey("chaincodeID2", "key1").getBucketKey() 41 | newDataKey("chaincodeID2", "key2").getBucketKey() 42 | } 43 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/buckettree/test.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Peer section 4 | # 5 | ############################################################################### 6 | peer: 7 | # Path on the file system where peer will store data 8 | fileSystemPath: /var/openchain/test/ledger/statemgmt/buckettree/testdb 9 | ledger: 10 | state: 11 | dataStructure: 12 | name: buckettree 13 | configs: 14 | numBuckets: 19 15 | maxGroupingAtEachLevel: 3 16 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/state/test.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Peer section 4 | # 5 | ############################################################################### 6 | peer: 7 | # Path on the file system where peer will store data 8 | fileSystemPath: /var/openchain/test/ledge/statemgmt/state/testdb 9 | 10 | ledger: 11 | 12 | state: 13 | 14 | # Control the number state deltas that are maintained. This takes additional 15 | # disk space, but allow the state to be rolled backwards and forwards 16 | # without the need to replay transactions. 17 | deltaHistorySize: 500 18 | dataStructure: 19 | name: buckettree 20 | configs: 21 | numBuckets: 10009 22 | maxGroupingAtEachLevel: 10 23 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/test_exports.go: -------------------------------------------------------------------------------- 1 | package statemgmt 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/openblockchain/obc-peer/openchain/ledger/testutil" 7 | ) 8 | 9 | // AssertIteratorContains - tests wether the iterator (itr) contains expected results (provided in map) 10 | func AssertIteratorContains(t *testing.T, itr RangeScanIterator, expected map[string][]byte) { 11 | count := 0 12 | actual := make(map[string][]byte) 13 | for itr.Next() { 14 | count++ 15 | k, v := itr.GetKeyValue() 16 | actual[k] = v 17 | } 18 | 19 | t.Logf("Results from iterator: %s", actual) 20 | testutil.AssertEquals(t, count, len(expected)) 21 | for k, v := range expected { 22 | testutil.AssertEquals(t, actual[k], v) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/trie/test.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Peer section 4 | # 5 | ############################################################################### 6 | peer: 7 | # Path on the file system where peer will store data 8 | fileSystemPath: /var/openchain/test/ledger/statemgmt/trie/testdb 9 | -------------------------------------------------------------------------------- /openchain/ledger/statemgmt/trie/trie_db_helper.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package trie 21 | 22 | import ( 23 | "github.com/openblockchain/obc-peer/openchain/db" 24 | ) 25 | 26 | func fetchTrieNodeFromDB(key *trieKey) (*trieNode, error) { 27 | stateTrieLogger.Debug("Enter fetchTrieNodeFromDB() for trieKey [%s]", key) 28 | openchainDB := db.GetDBHandle() 29 | trieNodeBytes, err := openchainDB.GetFromStateCF(key.getEncodedBytes()) 30 | if err != nil { 31 | stateTrieLogger.Error("Error in retrieving trie node from DB for triekey [%s]. Error:%s", key, err) 32 | return nil, err 33 | } 34 | 35 | if trieNodeBytes == nil { 36 | return nil, nil 37 | } 38 | 39 | trieNode, err := unmarshalTrieNode(key, trieNodeBytes) 40 | if err != nil { 41 | stateTrieLogger.Error("Error in unmarshalling trie node for triekey [%s]. Error:%s", key, err) 42 | return nil, err 43 | } 44 | stateTrieLogger.Debug("Exit fetchTrieNodeFromDB() for trieKey [%s]", key) 45 | return trieNode, nil 46 | } 47 | -------------------------------------------------------------------------------- /openchain/ledger/test.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Peer section 4 | # 5 | ############################################################################### 6 | peer: 7 | # Path on the file system where peer will store data 8 | fileSystemPath: /var/openchain/test/ledger_test 9 | 10 | ledger: 11 | 12 | state: 13 | 14 | # Control the number state deltas that are maintained. This takes additional 15 | # disk space, but allow the state to be rolled backwards and forwards 16 | # without the need to replay transactions. 17 | deltaHistorySize: 500 18 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/compose-defaults.yml: -------------------------------------------------------------------------------- 1 | vp: 2 | image: openchain-peer 3 | environment: 4 | - OPENCHAIN_PEER_ADDRESSAUTODETECT=true 5 | - OPENCHAIN_VM_ENDPOINT=http://172.17.0.1:4243 6 | # TODO: This is currently required due to BUG in variant logic based upon log level. 7 | - OPENCHAIN_LOGGING_LEVEL=DEBUG 8 | command: obc-peer peer 9 | 10 | obcca: 11 | image: obcca 12 | environment: 13 | - OPENCHAIN_VM_ENDPOINT=http://172.17.0.1:4243 14 | command: obc-ca 15 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-1.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | 8 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-2-tls-basic.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | - OPENCHAIN_PEER_TLS_ENABLED=true 8 | - OPENCHAIN_PEER_TLS_SERVER-HOST-OVERRIDE=OBC 9 | - OPENCHAIN_PEER_TLS_CERT_FILE=./openchain/peer/bddtests/tlsca.cert 10 | - OPENCHAIN_PEER_TLS_KEY_FILE=./openchain/peer/bddtests/tlsca.priv 11 | 12 | vp1: 13 | extends: 14 | service: vp0 15 | environment: 16 | - OPENCHAIN_PEER_ID=vp1 17 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 18 | links: 19 | - vp0 20 | 21 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-3.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | 8 | vp1: 9 | extends: 10 | service: vp0 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp1 13 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 14 | links: 15 | - vp0 16 | 17 | vp2: 18 | extends: 19 | service: vp0 20 | environment: 21 | - OPENCHAIN_PEER_ID=vp2 22 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 23 | links: 24 | - vp0 25 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4-consensus-base.yml: -------------------------------------------------------------------------------- 1 | vpBase: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_SECURITY_ENABLED=true 7 | - OPENCHAIN_PEER_PKI_ECA_PADDR=obcca0:50051 8 | - OPENCHAIN_PEER_PKI_TCA_PADDR=obcca0:50051 9 | - OPENCHAIN_PEER_PKI_TLSCA_PADDR=obcca0:50051 10 | - OPENCHAIN_PEER_PKI_TLS_ROOTCERT_FILE=./openchain/peer/bddtests/tlsca.cert 11 | # TODO: Currently required due to issue reading obbca configuration location 12 | - OPENCHAIN_OBCPBFT_GENERAL_N=4 13 | 14 | vpSieve: 15 | extends: 16 | service: vpBase 17 | environment: 18 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 19 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 20 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=sieve 21 | 22 | vpClassic: 23 | extends: 24 | service: vpBase 25 | environment: 26 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 27 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 28 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=classic 29 | 30 | vpBatch: 31 | extends: 32 | service: vpBase 33 | environment: 34 | - OPENCHAIN_PEER_VALIDATOR_CONSENSUS=obcpbft 35 | - OPENCHAIN_OBCPBFT_GENERAL_TIMEOUT_REQUEST=10s 36 | - OPENCHAIN_OBCPBFT_GENERAL_MODE=batch 37 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4-consensus-batch.yml: -------------------------------------------------------------------------------- 1 | obcca0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: obcca 5 | working_dir: /go/src/github.com/openblockchain/obc-peer/obc-ca 6 | 7 | vp0: 8 | extends: 9 | file: docker-compose-4-consensus-base.yml 10 | service: vpBatch 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp0 13 | - OPENCHAIN_SECURITY_ENROLLID=test_vp0 14 | - OPENCHAIN_SECURITY_ENROLLSECRET=MwYpmSRjupbT 15 | links: 16 | - obcca0 17 | 18 | vp1: 19 | extends: 20 | file: docker-compose-4-consensus-base.yml 21 | service: vpBatch 22 | environment: 23 | - OPENCHAIN_PEER_ID=vp1 24 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 25 | - OPENCHAIN_SECURITY_ENROLLID=test_vp1 26 | - OPENCHAIN_SECURITY_ENROLLSECRET=5wgHK9qqYaPy 27 | links: 28 | - obcca0 29 | - vp0 30 | 31 | vp2: 32 | extends: 33 | file: docker-compose-4-consensus-base.yml 34 | service: vpBatch 35 | environment: 36 | - OPENCHAIN_PEER_ID=vp2 37 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 38 | - OPENCHAIN_SECURITY_ENROLLID=test_vp2 39 | - OPENCHAIN_SECURITY_ENROLLSECRET=vQelbRvja7cJ 40 | links: 41 | - obcca0 42 | - vp0 43 | 44 | vp3: 45 | extends: 46 | file: docker-compose-4-consensus-base.yml 47 | service: vpBatch 48 | environment: 49 | - OPENCHAIN_PEER_ID=vp3 50 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 51 | - OPENCHAIN_SECURITY_ENROLLID=test_vp3 52 | - OPENCHAIN_SECURITY_ENROLLSECRET=9LKqKH5peurL 53 | links: 54 | - obcca0 55 | - vp0 56 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4-consensus-classic.yml: -------------------------------------------------------------------------------- 1 | obcca0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: obcca 5 | working_dir: /go/src/github.com/openblockchain/obc-peer/obc-ca 6 | 7 | vp0: 8 | extends: 9 | file: docker-compose-4-consensus-base.yml 10 | service: vpClassic 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp0 13 | - OPENCHAIN_SECURITY_ENROLLID=test_vp0 14 | - OPENCHAIN_SECURITY_ENROLLSECRET=MwYpmSRjupbT 15 | links: 16 | - obcca0 17 | 18 | vp1: 19 | extends: 20 | file: docker-compose-4-consensus-base.yml 21 | service: vpClassic 22 | environment: 23 | - OPENCHAIN_PEER_ID=vp1 24 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 25 | - OPENCHAIN_SECURITY_ENROLLID=test_vp1 26 | - OPENCHAIN_SECURITY_ENROLLSECRET=5wgHK9qqYaPy 27 | links: 28 | - obcca0 29 | - vp0 30 | 31 | vp2: 32 | extends: 33 | file: docker-compose-4-consensus-base.yml 34 | service: vpClassic 35 | environment: 36 | - OPENCHAIN_PEER_ID=vp2 37 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 38 | - OPENCHAIN_SECURITY_ENROLLID=test_vp2 39 | - OPENCHAIN_SECURITY_ENROLLSECRET=vQelbRvja7cJ 40 | links: 41 | - obcca0 42 | - vp0 43 | 44 | vp3: 45 | extends: 46 | file: docker-compose-4-consensus-base.yml 47 | service: vpClassic 48 | environment: 49 | - OPENCHAIN_PEER_ID=vp3 50 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 51 | - OPENCHAIN_SECURITY_ENROLLID=test_vp3 52 | - OPENCHAIN_SECURITY_ENROLLSECRET=9LKqKH5peurL 53 | links: 54 | - obcca0 55 | - vp0 56 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4-consensus-noops.yml: -------------------------------------------------------------------------------- 1 | obcca0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: obcca 5 | working_dir: /go/src/github.com/openblockchain/obc-peer/obc-ca 6 | 7 | vp0: 8 | extends: 9 | file: docker-compose-4-consensus-base.yml 10 | service: vpBase 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp0 13 | - OPENCHAIN_SECURITY_ENROLLID=test_vp0 14 | - OPENCHAIN_SECURITY_ENROLLSECRET=MwYpmSRjupbT 15 | links: 16 | - obcca0 17 | 18 | vp1: 19 | extends: 20 | file: docker-compose-4-consensus-base.yml 21 | service: vpBase 22 | environment: 23 | - OPENCHAIN_PEER_ID=vp1 24 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 25 | - OPENCHAIN_SECURITY_ENROLLID=test_vp1 26 | - OPENCHAIN_SECURITY_ENROLLSECRET=5wgHK9qqYaPy 27 | links: 28 | - obcca0 29 | - vp0 30 | 31 | vp2: 32 | extends: 33 | file: docker-compose-4-consensus-base.yml 34 | service: vpBase 35 | environment: 36 | - OPENCHAIN_PEER_ID=vp2 37 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 38 | - OPENCHAIN_SECURITY_ENROLLID=test_vp2 39 | - OPENCHAIN_SECURITY_ENROLLSECRET=vQelbRvja7cJ 40 | links: 41 | - obcca0 42 | - vp0 43 | 44 | vp3: 45 | extends: 46 | file: docker-compose-4-consensus-base.yml 47 | service: vpBase 48 | environment: 49 | - OPENCHAIN_PEER_ID=vp3 50 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 51 | - OPENCHAIN_SECURITY_ENROLLID=test_vp3 52 | - OPENCHAIN_SECURITY_ENROLLSECRET=9LKqKH5peurL 53 | links: 54 | - obcca0 55 | - vp0 56 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4-consensus-sieve.yml: -------------------------------------------------------------------------------- 1 | obcca0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: obcca 5 | working_dir: /go/src/github.com/openblockchain/obc-peer/obc-ca 6 | 7 | vp0: 8 | extends: 9 | file: docker-compose-4-consensus-base.yml 10 | service: vpSieve 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp0 13 | - OPENCHAIN_SECURITY_ENROLLID=test_vp0 14 | - OPENCHAIN_SECURITY_ENROLLSECRET=MwYpmSRjupbT 15 | links: 16 | - obcca0 17 | 18 | vp1: 19 | extends: 20 | file: docker-compose-4-consensus-base.yml 21 | service: vpSieve 22 | environment: 23 | - OPENCHAIN_PEER_ID=vp1 24 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 25 | - OPENCHAIN_SECURITY_ENROLLID=test_vp1 26 | - OPENCHAIN_SECURITY_ENROLLSECRET=5wgHK9qqYaPy 27 | links: 28 | - obcca0 29 | - vp0 30 | 31 | vp2: 32 | extends: 33 | file: docker-compose-4-consensus-base.yml 34 | service: vpSieve 35 | environment: 36 | - OPENCHAIN_PEER_ID=vp2 37 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 38 | - OPENCHAIN_SECURITY_ENROLLID=test_vp2 39 | - OPENCHAIN_SECURITY_ENROLLSECRET=vQelbRvja7cJ 40 | links: 41 | - obcca0 42 | - vp0 43 | 44 | vp3: 45 | extends: 46 | file: docker-compose-4-consensus-base.yml 47 | service: vpSieve 48 | environment: 49 | - OPENCHAIN_PEER_ID=vp3 50 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 51 | - OPENCHAIN_SECURITY_ENROLLID=test_vp3 52 | - OPENCHAIN_SECURITY_ENROLLSECRET=9LKqKH5peurL 53 | links: 54 | - obcca0 55 | - vp0 56 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-4.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | 8 | vp1: 9 | extends: 10 | service: vp0 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp1 13 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 14 | links: 15 | - vp0 16 | 17 | vp2: 18 | extends: 19 | service: vp0 20 | environment: 21 | - OPENCHAIN_PEER_ID=vp2 22 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 23 | links: 24 | - vp0 25 | 26 | vp3: 27 | extends: 28 | service: vp0 29 | environment: 30 | - OPENCHAIN_PEER_ID=vp3 31 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 32 | links: 33 | - vp0 34 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/docker-compose-5.yml: -------------------------------------------------------------------------------- 1 | vp0: 2 | extends: 3 | file: compose-defaults.yml 4 | service: vp 5 | environment: 6 | - OPENCHAIN_PEER_ID=vp0 7 | 8 | vp1: 9 | extends: 10 | service: vp0 11 | environment: 12 | - OPENCHAIN_PEER_ID=vp1 13 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 14 | links: 15 | - vp0 16 | 17 | vp2: 18 | extends: 19 | service: vp0 20 | environment: 21 | - OPENCHAIN_PEER_ID=vp2 22 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 23 | links: 24 | - vp0 25 | 26 | vp3: 27 | extends: 28 | service: vp0 29 | environment: 30 | - OPENCHAIN_PEER_ID=vp3 31 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 32 | links: 33 | - vp0 34 | 35 | vp4: 36 | extends: 37 | service: vp0 38 | environment: 39 | - OPENCHAIN_PEER_ID=vp4 40 | - OPENCHAIN_PEER_DISCOVERY_ROOTNODE=vp0:30303 41 | links: 42 | - vp0 43 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/environment.py: -------------------------------------------------------------------------------- 1 | 2 | from steps.bdd_test_util import cli_call 3 | 4 | def after_scenario(context, scenario): 5 | if 'doNotDecompose' in scenario.tags: 6 | print("Not going to decompose after scenario {0}, with yaml '{1}'".format(scenario.name, context.compose_yaml)) 7 | else: 8 | if 'compose_yaml' in context: 9 | print("Decomposing with yaml '{0}' after scenario {1}, ".format(context.compose_yaml, scenario.name)) 10 | context.compose_output, context.compose_error, context.compose_returncode = \ 11 | cli_call(context, ["docker-compose", "-f", context.compose_yaml, "kill"], expect_success=True) 12 | context.compose_output, context.compose_error, context.compose_returncode = \ 13 | cli_call(context, ["docker-compose", "-f", context.compose_yaml, "rm","-f"], expect_success=True) 14 | # now remove any other containers (chaincodes) 15 | context.compose_output, context.compose_error, context.compose_returncode = \ 16 | cli_call(context, ["docker", "ps", "-qa"], expect_success=True) 17 | if context.compose_returncode == 0: 18 | # Remove each container 19 | for containerId in context.compose_output.splitlines(): 20 | #print("docker rm {0}".format(containerId)) 21 | context.compose_output, context.compose_error, context.compose_returncode = \ 22 | cli_call(context, ["docker", "rm", containerId], expect_success=True) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/steps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcbrock/obc-peer/e338d6a25865db96c4e6374168473965a2b39054/openchain/peer/bddtests/steps/__init__.py -------------------------------------------------------------------------------- /openchain/peer/bddtests/steps/bdd_test_util.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | 4 | 5 | def cli_call(context, arg_list, expect_success=True): 6 | """Executes a CLI command in a subprocess and return the results. 7 | 8 | @param context: the behave context 9 | @param arg_list: a list command arguments 10 | @param expect_success: use False to return even if an error occurred when executing the command 11 | @return: (string, string, int) output message, error message, return code 12 | """ 13 | #arg_list[0] = "update-" + arg_list[0] 14 | 15 | # We need to run the cli command by actually calling the python command 16 | # the update-cli.py script has a #!/bin/python as the first line 17 | # which calls the system python, not the virtual env python we 18 | # setup for running the update-cli 19 | p = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 20 | output, error = p.communicate() 21 | if p.returncode != 0: 22 | if output is not None: 23 | print("Output:\n" + output) 24 | if error is not None: 25 | print("Error Message:\n" + error) 26 | if expect_success: 27 | raise subprocess.CalledProcessError(p.returncode, arg_list, output) 28 | return output, error, p.returncode 29 | 30 | 31 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/tlsca.cert: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBwTCCAUegAwIBAgIBATAKBggqhkjOPQQDAzApMQswCQYDVQQGEwJVUzEMMAoG 3 | A1UEChMDSUJNMQwwCgYDVQQDEwNPQkMwHhcNMTYwMTIxMjI0OTUxWhcNMTYwNDIw 4 | MjI0OTUxWjApMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMQwwCgYDVQQDEwNP 5 | QkMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR6YAoPOwMzIVi+P83V79I6BeIyJeaM 6 | meqWbmwQsTRlKD6g0L0YvczQO2vp+DbxRN11okGq3O/ctcPzvPXvm7Mcbb3whgXW 7 | RjbsX6wn25tF2/hU6fQsyQLPiJuNj/yxknSjQzBBMA4GA1UdDwEB/wQEAwIChDAP 8 | BgNVHRMBAf8EBTADAQH/MA0GA1UdDgQGBAQBAgMEMA8GA1UdIwQIMAaABAECAwQw 9 | CgYIKoZIzj0EAwMDaAAwZQIxAITGmq+x5N7Q1jrLt3QFRtTKsuNIosnlV4LR54l3 10 | yyDo17Ts0YLyC0pZQFd+GURSOQIwP/XAwoMcbJJtOVeW/UL2EOqmKA2ygmWX5kte 11 | 9Lngf550S6gPEWuDQOcY95B+x3eH 12 | -----END CERTIFICATE----- 13 | -------------------------------------------------------------------------------- /openchain/peer/bddtests/tlsca.priv: -------------------------------------------------------------------------------- 1 | -----BEGIN ECDSA PRIVATE KEY----- 2 | MIGkAgEBBDDSK85W5GPJ4WVYV/6I8NQuwXswMvoNJ/FzKjCgdWLAfcvYM4jO/rIo 3 | ytwrwphFijigBwYFK4EEACKhZANiAAR6YAoPOwMzIVi+P83V79I6BeIyJeaMmeqW 4 | bmwQsTRlKD6g0L0YvczQO2vp+DbxRN11okGq3O/ctcPzvPXvm7Mcbb3whgXWRjbs 5 | X6wn25tF2/hU6fQsyQLPiJuNj/yxknQ= 6 | -----END ECDSA PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /openchain/peer/errors.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package peer 21 | 22 | import ( 23 | "fmt" 24 | 25 | pb "github.com/openblockchain/obc-peer/protos" 26 | ) 27 | 28 | // DuplicateHandlerError returned if attempt to register same chaincodeID while a stream already exists. 29 | type DuplicateHandlerError struct { 30 | To pb.PeerEndpoint 31 | } 32 | 33 | func (d *DuplicateHandlerError) Error() string { 34 | return fmt.Sprintf("Duplicate Handler error: %s", d.To) 35 | } 36 | 37 | func newDuplicateHandlerError(msgHandler MessageHandler) error { 38 | to, err := msgHandler.To() 39 | if err != nil { 40 | return fmt.Errorf("Error creating Duplicate Handler error: %s", err) 41 | } 42 | return &DuplicateHandlerError{To: to} 43 | } 44 | -------------------------------------------------------------------------------- /openchain/rest/rest_util.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package rest 21 | 22 | import "encoding/json" 23 | 24 | // isJSON is a helper function to determine if a given string is proper JSON. 25 | func isJSON(s string) bool { 26 | var js map[string]interface{} 27 | return json.Unmarshal([]byte(s), &js) == nil 28 | } 29 | -------------------------------------------------------------------------------- /openchain/util/queue_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package util 21 | 22 | import ( 23 | "testing" 24 | ) 25 | 26 | func TestQueue(t *testing.T) { 27 | q := NewQueue() 28 | q.Push("first") 29 | q.Push("second") 30 | q.Push("third") 31 | t.Logf("Size: %d\n", q.Size()) 32 | t.Logf("Pop: %v\n", q.Pop()) 33 | if q.Size() != 2 { 34 | t.Fatalf("Wrong queue size != 2: %d", q.Size()) 35 | } 36 | t.Logf("Pop: %v\n", q.Pop()) 37 | t.Logf("Pop: %v\n", q.Pop()) 38 | if q.Size() != 0 { 39 | t.Fatalf("Wrong queue size != 0: %d", q.Size()) 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /protos/init.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package protos 21 | 22 | import "github.com/op/go-logging" 23 | 24 | var logger *logging.Logger 25 | 26 | func init() { 27 | // Create package logger. 28 | logger = logging.MustGetLogger("protos") 29 | } 30 | -------------------------------------------------------------------------------- /protos/server_admin.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | syntax = "proto3"; 21 | 22 | package protos; 23 | 24 | import "google/protobuf/empty.proto"; 25 | 26 | // Interface exported by the server. 27 | service Admin { 28 | // Return the serve status. 29 | rpc GetStatus(google.protobuf.Empty) returns (ServerStatus) {} 30 | rpc StartServer(google.protobuf.Empty) returns (ServerStatus) {} 31 | rpc StopServer(google.protobuf.Empty) returns (ServerStatus) {} 32 | } 33 | 34 | message ServerStatus { 35 | 36 | enum StatusCode { 37 | UNDEFINED = 0; 38 | STARTED = 1; 39 | STOPPED = 2; 40 | PAUSED = 3; 41 | ERROR = 4; 42 | UNKNOWN = 5; 43 | } 44 | 45 | StatusCode status = 1; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /protos/transaction_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package protos 21 | 22 | import ( 23 | "testing" 24 | 25 | "github.com/golang/protobuf/proto" 26 | ) 27 | 28 | func Test_Transaction_CreateNew(t *testing.T) { 29 | 30 | cidBytes, err := proto.Marshal(&ChaincodeID{Path: "Contract001"}) 31 | if err != nil { 32 | t.Fatalf("Could not marshal chaincode: %s", err) 33 | } 34 | tx := &Transaction{ChaincodeID: cidBytes} 35 | t.Logf("Transaction: %v", tx) 36 | 37 | data, err := proto.Marshal(tx) 38 | if err != nil { 39 | t.Errorf("Error marshalling transaction: %s", err) 40 | } 41 | t.Logf("Marshalled data: %v", data) 42 | 43 | // TODO: This doesn't seem like a proper test. Needs to be edited. 44 | txUnmarshalled := &Transaction{} 45 | err = proto.Unmarshal(data, txUnmarshalled) 46 | t.Logf("Unmarshalled transaction: %v", txUnmarshalled) 47 | if err != nil { 48 | t.Errorf("Error unmarshalling block: %s", err) 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/COMPATIBLE: -------------------------------------------------------------------------------- 1 | Compatible with TOML version 2 | [v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md) 3 | 4 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | 15 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | go install ./... 3 | 4 | test: install 5 | go test -v 6 | toml-test toml-test-decoder 7 | toml-test -encoder toml-test-encoder 8 | 9 | fmt: 10 | gofmt -w *.go */*.go 11 | colcheck *.go */*.go 12 | 13 | tags: 14 | find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS 15 | 16 | push: 17 | git push origin master 18 | git push github master 19 | 20 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package toml provides facilities for decoding and encoding TOML configuration 3 | files via reflection. There is also support for delaying decoding with 4 | the Primitive type, and querying the set of keys in a TOML document with the 5 | MetaData type. 6 | 7 | The specification implemented: https://github.com/mojombo/toml 8 | 9 | The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify 10 | whether a file is a valid TOML document. It can also be used to print the 11 | type of each key in a TOML document. 12 | 13 | Testing 14 | 15 | There are two important types of tests used for this package. The first is 16 | contained inside '*_test.go' files and uses the standard Go unit testing 17 | framework. These tests are primarily devoted to holistically testing the 18 | decoder and encoder. 19 | 20 | The second type of testing is used to verify the implementation's adherence 21 | to the TOML specification. These tests have been factored into their own 22 | project: https://github.com/BurntSushi/toml-test 23 | 24 | The reason the tests are in a separate project is so that they can be used by 25 | any implementation of TOML. Namely, it is language agnostic. 26 | */ 27 | package toml 28 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/encoding_types.go: -------------------------------------------------------------------------------- 1 | // +build go1.2 2 | 3 | package toml 4 | 5 | // In order to support Go 1.1, we define our own TextMarshaler and 6 | // TextUnmarshaler types. For Go 1.2+, we just alias them with the 7 | // standard library interfaces. 8 | 9 | import ( 10 | "encoding" 11 | ) 12 | 13 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 14 | // so that Go 1.1 can be supported. 15 | type TextMarshaler encoding.TextMarshaler 16 | 17 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 18 | // here so that Go 1.1 can be supported. 19 | type TextUnmarshaler encoding.TextUnmarshaler 20 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/encoding_types_1.1.go: -------------------------------------------------------------------------------- 1 | // +build !go1.2 2 | 3 | package toml 4 | 5 | // These interfaces were introduced in Go 1.2, so we add them manually when 6 | // compiling for Go 1.1. 7 | 8 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 9 | // so that Go 1.1 can be supported. 10 | type TextMarshaler interface { 11 | MarshalText() (text []byte, err error) 12 | } 13 | 14 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 15 | // here so that Go 1.1 can be supported. 16 | type TextUnmarshaler interface { 17 | UnmarshalText(text []byte) error 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/session.vim: -------------------------------------------------------------------------------- 1 | au BufWritePost *.go silent!make tags > /dev/null 2>&1 2 | -------------------------------------------------------------------------------- /vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "github.com/russross/blackfriday" 5 | ) 6 | 7 | func Render(doc []byte) []byte { 8 | renderer := RoffRenderer(0) 9 | extensions := 0 10 | extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS 11 | extensions |= blackfriday.EXTENSION_TABLES 12 | extensions |= blackfriday.EXTENSION_FENCED_CODE 13 | extensions |= blackfriday.EXTENSION_AUTOLINK 14 | extensions |= blackfriday.EXTENSION_SPACE_HEADERS 15 | extensions |= blackfriday.EXTENSION_FOOTNOTES 16 | extensions |= blackfriday.EXTENSION_TITLEBLOCK 17 | 18 | return blackfriday.Markdown(doc, renderer, extensions) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/DOCKER-LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | You can find the Docker license at the following link: 6 | https://raw.githubusercontent.com/docker/docker/master/LICENSE 7 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, go-dockerclient authors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: \ 2 | all \ 3 | vendor \ 4 | lint \ 5 | vet \ 6 | fmt \ 7 | fmtcheck \ 8 | pretest \ 9 | test \ 10 | cov \ 11 | clean 12 | 13 | SRCS = $(shell git ls-files '*.go' | grep -v '^external/') 14 | PKGS = ./. ./testing 15 | 16 | all: test 17 | 18 | vendor: 19 | @ go get -v github.com/mjibson/party 20 | party -d external -c -u 21 | 22 | lint: 23 | @ go get -v github.com/golang/lint/golint 24 | $(foreach file,$(SRCS),golint $(file) || exit;) 25 | 26 | vet: 27 | @-go get -v golang.org/x/tools/cmd/vet 28 | $(foreach pkg,$(PKGS),go vet $(pkg);) 29 | 30 | fmt: 31 | gofmt -w $(SRCS) 32 | 33 | fmtcheck: 34 | $(foreach file,$(SRCS),gofmt $(file) | diff -u $(file) - || exit;) 35 | 36 | pretest: lint vet fmtcheck 37 | 38 | test: pretest 39 | $(foreach pkg,$(PKGS),go test $(pkg) || exit;) 40 | 41 | cov: 42 | @ go get -v github.com/axw/gocov/gocov 43 | @ go get golang.org/x/tools/cmd/cover 44 | gocov test | gocov report 45 | 46 | clean: 47 | $(foreach pkg,$(PKGS),go clean $(pkg) || exit;) 48 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/change.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 go-dockerclient authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package docker 6 | 7 | import "fmt" 8 | 9 | // ChangeType is a type for constants indicating the type of change 10 | // in a container 11 | type ChangeType int 12 | 13 | const ( 14 | // ChangeModify is the ChangeType for container modifications 15 | ChangeModify ChangeType = iota 16 | 17 | // ChangeAdd is the ChangeType for additions to a container 18 | ChangeAdd 19 | 20 | // ChangeDelete is the ChangeType for deletions from a container 21 | ChangeDelete 22 | ) 23 | 24 | // Change represents a change in a container. 25 | // 26 | // See https://goo.gl/9GsTIF for more details. 27 | type Change struct { 28 | Path string 29 | Kind ChangeType 30 | } 31 | 32 | func (change *Change) String() string { 33 | var kind string 34 | switch change.Kind { 35 | case ChangeModify: 36 | kind = "C" 37 | case ChangeAdd: 38 | kind = "A" 39 | case ChangeDelete: 40 | kind = "D" 41 | } 42 | return fmt.Sprintf("%s %s", kind, change.Path) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # (Unreleased) 2 | 3 | logrus/core: improve performance of text formatter by 40% 4 | logrus/core: expose `LevelHooks` type 5 | 6 | # 0.8.2 7 | 8 | logrus: fix more Fatal family functions 9 | 10 | # 0.8.1 11 | 12 | logrus: fix not exiting on `Fatalf` and `Fatalln` 13 | 14 | # 0.8.0 15 | 16 | logrus: defaults to stderr instead of stdout 17 | hooks/sentry: add special field for `*http.Request` 18 | formatter/text: ignore Windows for colors 19 | 20 | # 0.7.3 21 | 22 | formatter/\*: allow configuration of timestamp layout 23 | 24 | # 0.7.2 25 | 26 | formatter/text: Add configuration option for time format (#158) 27 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | _, ok := data["time"] 35 | if ok { 36 | data["fields.time"] = data["time"] 37 | } 38 | 39 | _, ok = data["msg"] 40 | if ok { 41 | data["fields.msg"] = data["msg"] 42 | } 43 | 44 | _, ok = data["level"] 45 | if ok { 46 | data["fields.level"] = data["level"] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | timestampFormat := f.TimestampFormat 28 | if timestampFormat == "" { 29 | timestampFormat = DefaultTimestampFormat 30 | } 31 | 32 | data["time"] = entry.Time.Format(timestampFormat) 33 | data["msg"] = entry.Message 34 | data["level"] = entry.Level.String() 35 | 36 | serialized, err := json.Marshal(data) 37 | if err != nil { 38 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 39 | } 40 | return append(serialized, '\n'), nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package logrus 4 | 5 | import "syscall" 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | type Termios syscall.Termios 10 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_freebsd.go: -------------------------------------------------------------------------------- 1 | /* 2 | Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. 3 | */ 4 | package logrus 5 | 6 | import ( 7 | "syscall" 8 | ) 9 | 10 | const ioctlReadTermios = syscall.TIOCGETA 11 | 12 | type Termios struct { 13 | Iflag uint32 14 | Oflag uint32 15 | Cflag uint32 16 | Lflag uint32 17 | Cc [20]uint8 18 | Ispeed uint32 19 | Ospeed uint32 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if the given file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stdout 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_openbsd.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "syscall" 4 | 5 | const ioctlReadTermios = syscall.TIOCGETA 6 | 7 | type Termios syscall.Termios 8 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if the given file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stdout 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | reader, writer := io.Pipe() 11 | 12 | go logger.writerScanner(reader) 13 | runtime.SetFinalizer(writer, writerFinalizer) 14 | 15 | return writer 16 | } 17 | 18 | func (logger *Logger) writerScanner(reader *io.PipeReader) { 19 | scanner := bufio.NewScanner(reader) 20 | for scanner.Scan() { 21 | logger.Print(scanner.Text()) 22 | } 23 | if err := scanner.Err(); err != nil { 24 | logger.Errorf("Error while reading from Writer: %s", err) 25 | } 26 | reader.Close() 27 | } 28 | 29 | func writerFinalizer(writer *io.PipeWriter) { 30 | writer.Close() 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package opts 4 | 5 | import "fmt" 6 | 7 | var DefaultHost = fmt.Sprintf("unix://%s", DefaultUnixSocket) 8 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package opts 4 | 5 | import "fmt" 6 | 7 | var DefaultHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort) 8 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip.go: -------------------------------------------------------------------------------- 1 | package opts 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // IpOpt type that hold an IP 9 | type IpOpt struct { 10 | *net.IP 11 | } 12 | 13 | func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt { 14 | o := &IpOpt{ 15 | IP: ref, 16 | } 17 | o.Set(defaultVal) 18 | return o 19 | } 20 | 21 | func (o *IpOpt) Set(val string) error { 22 | ip := net.ParseIP(val) 23 | if ip == nil { 24 | return fmt.Errorf("%s is not an ip address", val) 25 | } 26 | *o.IP = ip 27 | return nil 28 | } 29 | 30 | func (o *IpOpt) String() string { 31 | if *o.IP == nil { 32 | return "" 33 | } 34 | return o.IP.String() 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ulimit.go: -------------------------------------------------------------------------------- 1 | package opts 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ulimit" 7 | ) 8 | 9 | type UlimitOpt struct { 10 | values *map[string]*ulimit.Ulimit 11 | } 12 | 13 | func NewUlimitOpt(ref *map[string]*ulimit.Ulimit) *UlimitOpt { 14 | if ref == nil { 15 | ref = &map[string]*ulimit.Ulimit{} 16 | } 17 | return &UlimitOpt{ref} 18 | } 19 | 20 | func (o *UlimitOpt) Set(val string) error { 21 | l, err := ulimit.Parse(val) 22 | if err != nil { 23 | return err 24 | } 25 | 26 | (*o.values)[l.Name] = l 27 | 28 | return nil 29 | } 30 | 31 | func (o *UlimitOpt) String() string { 32 | var out []string 33 | for _, v := range *o.values { 34 | out = append(out, v.String()) 35 | } 36 | 37 | return fmt.Sprintf("%v", out) 38 | } 39 | 40 | func (o *UlimitOpt) GetList() []*ulimit.Ulimit { 41 | var ulimits []*ulimit.Ulimit 42 | for _, v := range *o.values { 43 | ulimits = append(ulimits, v) 44 | } 45 | 46 | return ulimits 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/README.md: -------------------------------------------------------------------------------- 1 | This code provides helper functions for dealing with archive files. 2 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/archive_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package archive 4 | 5 | import ( 6 | "archive/tar" 7 | "fmt" 8 | "os" 9 | "strings" 10 | ) 11 | 12 | // canonicalTarNameForPath returns platform-specific filepath 13 | // to canonical posix-style path for tar archival. p is relative 14 | // path. 15 | func CanonicalTarNameForPath(p string) (string, error) { 16 | // windows: convert windows style relative path with backslashes 17 | // into forward slashes. Since windows does not allow '/' or '\' 18 | // in file names, it is mostly safe to replace however we must 19 | // check just in case 20 | if strings.Contains(p, "/") { 21 | return "", fmt.Errorf("Windows path contains forward slash: %s", p) 22 | } 23 | return strings.Replace(p, string(os.PathSeparator), "/", -1), nil 24 | 25 | } 26 | 27 | // chmodTarEntry is used to adjust the file permissions used in tar header based 28 | // on the platform the archival is done. 29 | func chmodTarEntry(perm os.FileMode) os.FileMode { 30 | perm &= 0755 31 | // Add the x bit: make everything +x from windows 32 | perm |= 0111 33 | 34 | return perm 35 | } 36 | 37 | func setHeaderForSpecialDevice(hdr *tar.Header, ta *tarAppender, name string, stat interface{}) (nlink uint32, inode uint64, err error) { 38 | // do nothing. no notion of Rdev, Inode, Nlink in stat on Windows 39 | return 40 | } 41 | 42 | // handleTarTypeBlockCharFifo is an OS-specific helper function used by 43 | // createTarFile to handle the following types of header: Block; Char; Fifo 44 | func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { 45 | return nil 46 | } 47 | 48 | func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package archive 4 | 5 | import ( 6 | "syscall" 7 | 8 | "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system" 9 | ) 10 | 11 | func statDifferent(oldStat *system.Stat_t, newStat *system.Stat_t) bool { 12 | // Don't look at size for dirs, its not a good measure of change 13 | if oldStat.Mode() != newStat.Mode() || 14 | oldStat.Uid() != newStat.Uid() || 15 | oldStat.Gid() != newStat.Gid() || 16 | oldStat.Rdev() != newStat.Rdev() || 17 | // Don't look at size for dirs, its not a good measure of change 18 | (oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR && 19 | (!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) { 20 | return true 21 | } 22 | return false 23 | } 24 | 25 | func (info *FileInfo) isDir() bool { 26 | return info.parent == nil || info.stat.Mode()&syscall.S_IFDIR != 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/changes_windows.go: -------------------------------------------------------------------------------- 1 | package archive 2 | 3 | import ( 4 | "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system" 5 | ) 6 | 7 | func statDifferent(oldStat *system.Stat_t, newStat *system.Stat_t) bool { 8 | 9 | // Don't look at size for dirs, its not a good measure of change 10 | if oldStat.ModTime() != newStat.ModTime() || 11 | oldStat.Mode() != newStat.Mode() || 12 | oldStat.Size() != newStat.Size() && !oldStat.IsDir() { 13 | return true 14 | } 15 | return false 16 | } 17 | 18 | func (info *FileInfo) isDir() bool { 19 | return info.parent == nil || info.stat.IsDir() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package archive 4 | 5 | import ( 6 | "path/filepath" 7 | ) 8 | 9 | func normalizePath(path string) string { 10 | return filepath.ToSlash(path) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_windows.go: -------------------------------------------------------------------------------- 1 | package archive 2 | 3 | import ( 4 | "path/filepath" 5 | ) 6 | 7 | func normalizePath(path string) string { 8 | return filepath.FromSlash(path) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/time_linux.go: -------------------------------------------------------------------------------- 1 | package archive 2 | 3 | import ( 4 | "syscall" 5 | "time" 6 | ) 7 | 8 | func timeToTimespec(time time.Time) (ts syscall.Timespec) { 9 | if time.IsZero() { 10 | // Return UTIME_OMIT special value 11 | ts.Sec = 0 12 | ts.Nsec = ((1 << 30) - 2) 13 | return 14 | } 15 | return syscall.NsecToTimespec(time.UnixNano()) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/time_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package archive 4 | 5 | import ( 6 | "syscall" 7 | "time" 8 | ) 9 | 10 | func timeToTimespec(time time.Time) (ts syscall.Timespec) { 11 | nsec := int64(0) 12 | if !time.IsZero() { 13 | nsec = time.UnixNano() 14 | } 15 | return syscall.NsecToTimespec(nsec) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/wrap.go: -------------------------------------------------------------------------------- 1 | package archive 2 | 3 | import ( 4 | "archive/tar" 5 | "bytes" 6 | "io/ioutil" 7 | ) 8 | 9 | // Generate generates a new archive from the content provided 10 | // as input. 11 | // 12 | // `files` is a sequence of path/content pairs. A new file is 13 | // added to the archive for each pair. 14 | // If the last pair is incomplete, the file is created with an 15 | // empty content. For example: 16 | // 17 | // Generate("foo.txt", "hello world", "emptyfile") 18 | // 19 | // The above call will return an archive with 2 files: 20 | // * ./foo.txt with content "hello world" 21 | // * ./empty with empty content 22 | // 23 | // FIXME: stream content instead of buffering 24 | // FIXME: specify permissions and other archive metadata 25 | func Generate(input ...string) (Archive, error) { 26 | files := parseStringPairs(input...) 27 | buf := new(bytes.Buffer) 28 | tw := tar.NewWriter(buf) 29 | for _, file := range files { 30 | name, content := file[0], file[1] 31 | hdr := &tar.Header{ 32 | Name: name, 33 | Size: int64(len(content)), 34 | } 35 | if err := tw.WriteHeader(hdr); err != nil { 36 | return nil, err 37 | } 38 | if _, err := tw.Write([]byte(content)); err != nil { 39 | return nil, err 40 | } 41 | } 42 | if err := tw.Close(); err != nil { 43 | return nil, err 44 | } 45 | return ioutil.NopCloser(buf), nil 46 | } 47 | 48 | func parseStringPairs(input ...string) (output [][2]string) { 49 | output = make([][2]string, 0, len(input)/2+1) 50 | for i := 0; i < len(input); i += 2 { 51 | var pair [2]string 52 | pair[0] = input[i] 53 | if i+1 < len(input) { 54 | pair[1] = input[i+1] 55 | } 56 | output = append(output, pair) 57 | } 58 | return 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir.go: -------------------------------------------------------------------------------- 1 | package homedir 2 | 3 | import ( 4 | "os" 5 | "runtime" 6 | 7 | "github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user" 8 | ) 9 | 10 | // Key returns the env var name for the user's home dir based on 11 | // the platform being run on 12 | func Key() string { 13 | if runtime.GOOS == "windows" { 14 | return "USERPROFILE" 15 | } 16 | return "HOME" 17 | } 18 | 19 | // Get returns the home directory of the current user with the help of 20 | // environment variables depending on the target operating system. 21 | // Returned path should be used with "path/filepath" to form new paths. 22 | func Get() string { 23 | home := os.Getenv(Key()) 24 | if home == "" && runtime.GOOS != "windows" { 25 | if u, err := user.CurrentUser(); err == nil { 26 | return u.Home 27 | } 28 | } 29 | return home 30 | } 31 | 32 | // GetShortcutString returns the string that is shortcut to user's home directory 33 | // in the native shell of the platform running on. 34 | func GetShortcutString() string { 35 | if runtime.GOOS == "windows" { 36 | return "%USERPROFILE%" // be careful while using in format functions 37 | } 38 | return "~" 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/fmt.go: -------------------------------------------------------------------------------- 1 | package ioutils 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | ) 7 | 8 | // FprintfIfNotEmpty prints the string value if it's not empty 9 | func FprintfIfNotEmpty(w io.Writer, format, value string) (int, error) { 10 | if value != "" { 11 | return fmt.Fprintf(w, format, value) 12 | } 13 | return 0, nil 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/scheduler.go: -------------------------------------------------------------------------------- 1 | // +build !gccgo 2 | 3 | package ioutils 4 | 5 | func callSchedulerIfNecessary() { 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/scheduler_gccgo.go: -------------------------------------------------------------------------------- 1 | // +build gccgo 2 | 3 | package ioutils 4 | 5 | import ( 6 | "runtime" 7 | ) 8 | 9 | func callSchedulerIfNecessary() { 10 | //allow or force Go scheduler to switch context, without explicitly 11 | //forcing this will make it hang when using gccgo implementation 12 | runtime.Gosched() 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writeflusher.go: -------------------------------------------------------------------------------- 1 | package ioutils 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "sync" 7 | ) 8 | 9 | type WriteFlusher struct { 10 | sync.Mutex 11 | w io.Writer 12 | flusher http.Flusher 13 | flushed bool 14 | } 15 | 16 | func (wf *WriteFlusher) Write(b []byte) (n int, err error) { 17 | wf.Lock() 18 | defer wf.Unlock() 19 | n, err = wf.w.Write(b) 20 | wf.flushed = true 21 | wf.flusher.Flush() 22 | return n, err 23 | } 24 | 25 | // Flush the stream immediately. 26 | func (wf *WriteFlusher) Flush() { 27 | wf.Lock() 28 | defer wf.Unlock() 29 | wf.flushed = true 30 | wf.flusher.Flush() 31 | } 32 | 33 | func (wf *WriteFlusher) Flushed() bool { 34 | wf.Lock() 35 | defer wf.Unlock() 36 | return wf.flushed 37 | } 38 | 39 | func NewWriteFlusher(w io.Writer) *WriteFlusher { 40 | var flusher http.Flusher 41 | if f, ok := w.(http.Flusher); ok { 42 | flusher = f 43 | } else { 44 | flusher = &NopFlusher{} 45 | } 46 | return &WriteFlusher{w: w, flusher: flusher} 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/writers.go: -------------------------------------------------------------------------------- 1 | package ioutils 2 | 3 | import "io" 4 | 5 | type NopWriter struct{} 6 | 7 | func (*NopWriter) Write(buf []byte) (int, error) { 8 | return len(buf), nil 9 | } 10 | 11 | type nopWriteCloser struct { 12 | io.Writer 13 | } 14 | 15 | func (w *nopWriteCloser) Close() error { return nil } 16 | 17 | func NopWriteCloser(w io.Writer) io.WriteCloser { 18 | return &nopWriteCloser{w} 19 | } 20 | 21 | type NopFlusher struct{} 22 | 23 | func (f *NopFlusher) Flush() {} 24 | 25 | type writeCloserWrapper struct { 26 | io.Writer 27 | closer func() error 28 | } 29 | 30 | func (r *writeCloserWrapper) Close() error { 31 | return r.closer() 32 | } 33 | 34 | func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser { 35 | return &writeCloserWrapper{ 36 | Writer: r, 37 | closer: closer, 38 | } 39 | } 40 | 41 | // Wrap a concrete io.Writer and hold a count of the number 42 | // of bytes written to the writer during a "session". 43 | // This can be convenient when write return is masked 44 | // (e.g., json.Encoder.Encode()) 45 | type WriteCounter struct { 46 | Count int64 47 | Writer io.Writer 48 | } 49 | 50 | func NewWriteCounter(w io.Writer) *WriteCounter { 51 | return &WriteCounter{ 52 | Writer: w, 53 | } 54 | } 55 | 56 | func (wc *WriteCounter) Write(p []byte) (count int, err error) { 57 | count, err = wc.Writer.Write(p) 58 | wc.Count += int64(count) 59 | return 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/promise/promise.go: -------------------------------------------------------------------------------- 1 | package promise 2 | 3 | // Go is a basic promise implementation: it wraps calls a function in a goroutine, 4 | // and returns a channel which will later return the function's return value. 5 | func Go(f func() error) chan error { 6 | ch := make(chan error, 1) 7 | go func() { 8 | ch <- f() 9 | }() 10 | return ch 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/errors.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | var ( 8 | ErrNotSupportedPlatform = errors.New("platform and architecture is not supported") 9 | ) 10 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/filesys.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package system 4 | 5 | import ( 6 | "os" 7 | ) 8 | 9 | func MkdirAll(path string, perm os.FileMode) error { 10 | return os.MkdirAll(path, perm) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/filesys_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package system 4 | 5 | import ( 6 | "os" 7 | "regexp" 8 | "syscall" 9 | ) 10 | 11 | // MkdirAll implementation that is volume path aware for Windows. 12 | func MkdirAll(path string, perm os.FileMode) error { 13 | if re := regexp.MustCompile(`^\\\\\?\\Volume{[a-z0-9-]+}$`); re.MatchString(path) { 14 | return nil 15 | } 16 | 17 | // The rest of this method is copied from os.MkdirAll and should be kept 18 | // as-is to ensure compatibility. 19 | 20 | // Fast path: if we can tell whether path is a directory or file, stop with success or error. 21 | dir, err := os.Stat(path) 22 | if err == nil { 23 | if dir.IsDir() { 24 | return nil 25 | } 26 | return &os.PathError{ 27 | Op: "mkdir", 28 | Path: path, 29 | Err: syscall.ENOTDIR, 30 | } 31 | } 32 | 33 | // Slow path: make sure parent exists and then call Mkdir for path. 34 | i := len(path) 35 | for i > 0 && os.IsPathSeparator(path[i-1]) { // Skip trailing path separator. 36 | i-- 37 | } 38 | 39 | j := i 40 | for j > 0 && !os.IsPathSeparator(path[j-1]) { // Scan backward over element. 41 | j-- 42 | } 43 | 44 | if j > 1 { 45 | // Create parent 46 | err = MkdirAll(path[0:j-1], perm) 47 | if err != nil { 48 | return err 49 | } 50 | } 51 | 52 | // Parent now exists; invoke Mkdir and use its result. 53 | err = os.Mkdir(path, perm) 54 | if err != nil { 55 | // Handle arguments like "foo/." by 56 | // double-checking that directory doesn't exist. 57 | dir, err1 := os.Lstat(path) 58 | if err1 == nil && dir.IsDir() { 59 | return nil 60 | } 61 | return err 62 | } 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package system 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | // Lstat takes a path to a file and returns 10 | // a system.Stat_t type pertaining to that file. 11 | // 12 | // Throws an error if the file does not exist 13 | func Lstat(path string) (*Stat_t, error) { 14 | s := &syscall.Stat_t{} 15 | if err := syscall.Lstat(path, s); err != nil { 16 | return nil, err 17 | } 18 | return fromStatT(s) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package system 4 | 5 | import ( 6 | "os" 7 | ) 8 | 9 | // Some explanation for my own sanity, and hopefully maintainers in the 10 | // future. 11 | // 12 | // Lstat calls os.Lstat to get a fileinfo interface back. 13 | // This is then copied into our own locally defined structure. 14 | // Note the Linux version uses fromStatT to do the copy back, 15 | // but that not strictly necessary when already in an OS specific module. 16 | 17 | func Lstat(path string) (*Stat_t, error) { 18 | fi, err := os.Lstat(path) 19 | if err != nil { 20 | return nil, err 21 | } 22 | 23 | return &Stat_t{ 24 | name: fi.Name(), 25 | size: fi.Size(), 26 | mode: fi.Mode(), 27 | modTime: fi.ModTime(), 28 | isDir: fi.IsDir()}, nil 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | // MemInfo contains memory statistics of the host system. 4 | type MemInfo struct { 5 | // Total usable RAM (i.e. physical RAM minus a few reserved bits and the 6 | // kernel binary code). 7 | MemTotal int64 8 | 9 | // Amount of free memory. 10 | MemFree int64 11 | 12 | // Total amount of swap space available. 13 | SwapTotal int64 14 | 15 | // Amount of swap space that is currently unused. 16 | SwapFree int64 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!windows 2 | 3 | package system 4 | 5 | func ReadMemInfo() (*MemInfo, error) { 6 | return nil, ErrNotSupportedPlatform 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_windows.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | var ( 9 | modkernel32 = syscall.NewLazyDLL("kernel32.dll") 10 | 11 | procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") 12 | ) 13 | 14 | // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx 15 | // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx 16 | type memorystatusex struct { 17 | dwLength uint32 18 | dwMemoryLoad uint32 19 | ullTotalPhys uint64 20 | ullAvailPhys uint64 21 | ullTotalPageFile uint64 22 | ullAvailPageFile uint64 23 | ullTotalVirtual uint64 24 | ullAvailVirtual uint64 25 | ullAvailExtendedVirtual uint64 26 | } 27 | 28 | // ReadMemInfo retrieves memory statistics of the host system and returns a 29 | // MemInfo type. 30 | func ReadMemInfo() (*MemInfo, error) { 31 | msi := &memorystatusex{ 32 | dwLength: 64, 33 | } 34 | r1, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(msi))) 35 | if r1 == 0 { 36 | return &MemInfo{}, nil 37 | } 38 | return &MemInfo{ 39 | MemTotal: int64(msi.ullTotalPhys), 40 | MemFree: int64(msi.ullAvailPhys), 41 | SwapTotal: int64(msi.ullTotalPageFile), 42 | SwapFree: int64(msi.ullAvailPageFile), 43 | }, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/mknod.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package system 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | // Mknod creates a filesystem node (file, device special file or named pipe) named path 10 | // with attributes specified by mode and dev 11 | func Mknod(path string, mode uint32, dev int) error { 12 | return syscall.Mknod(path, mode, dev) 13 | } 14 | 15 | // Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes. 16 | // They are, from low to high: the lower 8 bits of the minor, then 12 bits of the major, 17 | // then the top 12 bits of the minor 18 | func Mkdev(major int64, minor int64) uint32 { 19 | return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff)) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/mknod_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package system 4 | 5 | func Mknod(path string, mode uint32, dev int) error { 6 | return ErrNotSupportedPlatform 7 | } 8 | 9 | func Mkdev(major int64, minor int64) uint32 { 10 | panic("Mkdev not implemented on Windows.") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package system 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | // Stat_t type contains status of a file. It contains metadata 10 | // like permission, owner, group, size, etc about a file 11 | type Stat_t struct { 12 | mode uint32 13 | uid uint32 14 | gid uint32 15 | rdev uint64 16 | size int64 17 | mtim syscall.Timespec 18 | } 19 | 20 | func (s Stat_t) Mode() uint32 { 21 | return s.mode 22 | } 23 | 24 | func (s Stat_t) Uid() uint32 { 25 | return s.uid 26 | } 27 | 28 | func (s Stat_t) Gid() uint32 { 29 | return s.gid 30 | } 31 | 32 | func (s Stat_t) Rdev() uint64 { 33 | return s.rdev 34 | } 35 | 36 | func (s Stat_t) Size() int64 { 37 | return s.size 38 | } 39 | 40 | func (s Stat_t) Mtim() syscall.Timespec { 41 | return s.mtim 42 | } 43 | 44 | func (s Stat_t) GetLastModification() syscall.Timespec { 45 | return s.Mtim() 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_freebsd.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fromStatT converts a syscall.Stat_t type to a system.Stat_t type 8 | func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { 9 | return &Stat_t{size: s.Size, 10 | mode: uint32(s.Mode), 11 | uid: s.Uid, 12 | gid: s.Gid, 13 | rdev: uint64(s.Rdev), 14 | mtim: s.Mtimespec}, nil 15 | } 16 | 17 | // Stat takes a path to a file and returns 18 | // a system.Stat_t type pertaining to that file. 19 | // 20 | // Throws an error if the file does not exist 21 | func Stat(path string) (*Stat_t, error) { 22 | s := &syscall.Stat_t{} 23 | if err := syscall.Stat(path, s); err != nil { 24 | return nil, err 25 | } 26 | return fromStatT(s) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_linux.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fromStatT converts a syscall.Stat_t type to a system.Stat_t type 8 | func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { 9 | return &Stat_t{size: s.Size, 10 | mode: s.Mode, 11 | uid: s.Uid, 12 | gid: s.Gid, 13 | rdev: s.Rdev, 14 | mtim: s.Mtim}, nil 15 | } 16 | 17 | // FromStatT exists only on linux, and loads a system.Stat_t from a 18 | // syscal.Stat_t. 19 | func FromStatT(s *syscall.Stat_t) (*Stat_t, error) { 20 | return fromStatT(s) 21 | } 22 | 23 | // Stat takes a path to a file and returns 24 | // a system.Stat_t type pertaining to that file. 25 | // 26 | // Throws an error if the file does not exist 27 | func Stat(path string) (*Stat_t, error) { 28 | s := &syscall.Stat_t{} 29 | if err := syscall.Stat(path, s); err != nil { 30 | return nil, err 31 | } 32 | return fromStatT(s) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!windows,!freebsd 2 | 3 | package system 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | // fromStatT creates a system.Stat_t type from a syscall.Stat_t type 10 | func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { 11 | return &Stat_t{size: s.Size, 12 | mode: uint32(s.Mode), 13 | uid: s.Uid, 14 | gid: s.Gid, 15 | rdev: uint64(s.Rdev), 16 | mtim: s.Mtimespec}, nil 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package system 4 | 5 | import ( 6 | "os" 7 | "time" 8 | ) 9 | 10 | type Stat_t struct { 11 | name string 12 | size int64 13 | mode os.FileMode 14 | modTime time.Time 15 | isDir bool 16 | } 17 | 18 | func (s Stat_t) Name() string { 19 | return s.name 20 | } 21 | 22 | func (s Stat_t) Size() int64 { 23 | return s.size 24 | } 25 | 26 | func (s Stat_t) Mode() os.FileMode { 27 | return s.mode 28 | } 29 | 30 | func (s Stat_t) ModTime() time.Time { 31 | return s.modTime 32 | } 33 | 34 | func (s Stat_t) IsDir() bool { 35 | return s.isDir 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/umask.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package system 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | func Umask(newmask int) (oldmask int, err error) { 10 | return syscall.Umask(newmask), nil 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/umask_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package system 4 | 5 | func Umask(newmask int) (oldmask int, err error) { 6 | // should not be called on cli code path 7 | return 0, ErrNotSupportedPlatform 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_darwin.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import "syscall" 4 | 5 | func LUtimesNano(path string, ts []syscall.Timespec) error { 6 | return ErrNotSupportedPlatform 7 | } 8 | 9 | func UtimesNano(path string, ts []syscall.Timespec) error { 10 | return syscall.UtimesNano(path, ts) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_freebsd.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | func LUtimesNano(path string, ts []syscall.Timespec) error { 9 | var _path *byte 10 | _path, err := syscall.BytePtrFromString(path) 11 | if err != nil { 12 | return err 13 | } 14 | 15 | if _, _, err := syscall.Syscall(syscall.SYS_LUTIMES, uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), 0); err != 0 && err != syscall.ENOSYS { 16 | return err 17 | } 18 | 19 | return nil 20 | } 21 | 22 | func UtimesNano(path string, ts []syscall.Timespec) error { 23 | return syscall.UtimesNano(path, ts) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_linux.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | func LUtimesNano(path string, ts []syscall.Timespec) error { 9 | // These are not currently available in syscall 10 | AT_FDCWD := -100 11 | AT_SYMLINK_NOFOLLOW := 0x100 12 | 13 | var _path *byte 14 | _path, err := syscall.BytePtrFromString(path) 15 | if err != nil { 16 | return err 17 | } 18 | 19 | if _, _, err := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(AT_FDCWD), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), uintptr(AT_SYMLINK_NOFOLLOW), 0, 0); err != 0 && err != syscall.ENOSYS { 20 | return err 21 | } 22 | 23 | return nil 24 | } 25 | 26 | func UtimesNano(path string, ts []syscall.Timespec) error { 27 | return syscall.UtimesNano(path, ts) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!freebsd,!darwin 2 | 3 | package system 4 | 5 | import "syscall" 6 | 7 | func LUtimesNano(path string, ts []syscall.Timespec) error { 8 | return ErrNotSupportedPlatform 9 | } 10 | 11 | func UtimesNano(path string, ts []syscall.Timespec) error { 12 | return ErrNotSupportedPlatform 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/xattrs_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package system 4 | 5 | func Lgetxattr(path string, attr string) ([]byte, error) { 6 | return nil, ErrNotSupportedPlatform 7 | } 8 | 9 | func Lsetxattr(path string, attr string, data []byte, flags int) error { 10 | return ErrNotSupportedPlatform 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/units/duration.go: -------------------------------------------------------------------------------- 1 | // Package units provides helper function to parse and print size and time units 2 | // in human-readable format. 3 | package units 4 | 5 | import ( 6 | "fmt" 7 | "time" 8 | ) 9 | 10 | // HumanDuration returns a human-readable approximation of a duration 11 | // (eg. "About a minute", "4 hours ago", etc.). 12 | func HumanDuration(d time.Duration) string { 13 | if seconds := int(d.Seconds()); seconds < 1 { 14 | return "Less than a second" 15 | } else if seconds < 60 { 16 | return fmt.Sprintf("%d seconds", seconds) 17 | } else if minutes := int(d.Minutes()); minutes == 1 { 18 | return "About a minute" 19 | } else if minutes < 60 { 20 | return fmt.Sprintf("%d minutes", minutes) 21 | } else if hours := int(d.Hours()); hours == 1 { 22 | return "About an hour" 23 | } else if hours < 48 { 24 | return fmt.Sprintf("%d hours", hours) 25 | } else if hours < 24*7*2 { 26 | return fmt.Sprintf("%d days", hours/24) 27 | } else if hours < 24*30*3 { 28 | return fmt.Sprintf("%d weeks", hours/24/7) 29 | } else if hours < 24*365*2 { 30 | return fmt.Sprintf("%d months", hours/24/30) 31 | } 32 | return fmt.Sprintf("%d years", int(d.Hours())/24/365) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Tianon Gravi (@tianon) 2 | Aleksa Sarai (@cyphar) 3 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 2 | 3 | package user 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | // Unix-specific path to the passwd and group formatted files. 11 | const ( 12 | unixPasswdPath = "/etc/passwd" 13 | unixGroupPath = "/etc/group" 14 | ) 15 | 16 | func GetPasswdPath() (string, error) { 17 | return unixPasswdPath, nil 18 | } 19 | 20 | func GetPasswd() (io.ReadCloser, error) { 21 | return os.Open(unixPasswdPath) 22 | } 23 | 24 | func GetGroupPath() (string, error) { 25 | return unixGroupPath, nil 26 | } 27 | 28 | func GetGroup() (io.ReadCloser, error) { 29 | return os.Open(unixGroupPath) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/lookup_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 2 | 3 | package user 4 | 5 | import "io" 6 | 7 | func GetPasswdPath() (string, error) { 8 | return "", ErrUnsupported 9 | } 10 | 11 | func GetPasswd() (io.ReadCloser, error) { 12 | return nil, ErrUnsupported 13 | } 14 | 15 | func GetGroupPath() (string, error) { 16 | return "", ErrUnsupported 17 | } 18 | 19 | func GetGroup() (io.ReadCloser, error) { 20 | return nil, ErrUnsupported 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/fsouza/go-dockerclient/signal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 go-dockerclient authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package docker 6 | 7 | // Signal represents a signal that can be send to the container on 8 | // KillContainer call. 9 | type Signal int 10 | 11 | // These values represent all signals available on Linux, where containers will 12 | // be running. 13 | const ( 14 | SIGABRT = Signal(0x6) 15 | SIGALRM = Signal(0xe) 16 | SIGBUS = Signal(0x7) 17 | SIGCHLD = Signal(0x11) 18 | SIGCLD = Signal(0x11) 19 | SIGCONT = Signal(0x12) 20 | SIGFPE = Signal(0x8) 21 | SIGHUP = Signal(0x1) 22 | SIGILL = Signal(0x4) 23 | SIGINT = Signal(0x2) 24 | SIGIO = Signal(0x1d) 25 | SIGIOT = Signal(0x6) 26 | SIGKILL = Signal(0x9) 27 | SIGPIPE = Signal(0xd) 28 | SIGPOLL = Signal(0x1d) 29 | SIGPROF = Signal(0x1b) 30 | SIGPWR = Signal(0x1e) 31 | SIGQUIT = Signal(0x3) 32 | SIGSEGV = Signal(0xb) 33 | SIGSTKFLT = Signal(0x10) 34 | SIGSTOP = Signal(0x13) 35 | SIGSYS = Signal(0x1f) 36 | SIGTERM = Signal(0xf) 37 | SIGTRAP = Signal(0x5) 38 | SIGTSTP = Signal(0x14) 39 | SIGTTIN = Signal(0x15) 40 | SIGTTOU = Signal(0x16) 41 | SIGUNUSED = Signal(0x1f) 42 | SIGURG = Signal(0x17) 43 | SIGUSR1 = Signal(0xa) 44 | SIGUSR2 = Signal(0xc) 45 | SIGVTALRM = Signal(0x1a) 46 | SIGWINCH = Signal(0x1c) 47 | SIGXCPU = Signal(0x18) 48 | SIGXFSZ = Signal(0x19) 49 | ) 50 | -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jonathan Novak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/cover.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | go test -covermode=count -coverprofile=count.out . 4 | go tool cover -html=count.out 5 | go tool cover -func=count.out -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/logger_middleware.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "log" 5 | "os" 6 | "time" 7 | ) 8 | 9 | // Logger can be set to your own logger. Logger only applies to the LoggerMiddleware. 10 | var Logger = log.New(os.Stdout, "", 0) 11 | 12 | // LoggerMiddleware is generic middleware that will log requests to Logger (by default, Stdout). 13 | func LoggerMiddleware(rw ResponseWriter, req *Request, next NextMiddlewareFunc) { 14 | startTime := time.Now() 15 | 16 | next(rw, req) 17 | 18 | duration := time.Since(startTime).Nanoseconds() 19 | var durationUnits string 20 | switch { 21 | case duration > 2000000: 22 | durationUnits = "ms" 23 | duration /= 1000000 24 | case duration > 1000: 25 | durationUnits = "μs" 26 | duration /= 1000 27 | default: 28 | durationUnits = "ns" 29 | } 30 | 31 | Logger.Printf("[%d %s] %d '%s'\n", duration, durationUnits, rw.StatusCode(), req.URL.Path) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/options_handler.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "net/http" 5 | "reflect" 6 | "strings" 7 | ) 8 | 9 | func (r *Router) genericOptionsHandler(ctx reflect.Value, methods []string) func(rw ResponseWriter, req *Request) { 10 | return func(rw ResponseWriter, req *Request) { 11 | if r.optionsHandler.IsValid() { 12 | invoke(r.optionsHandler, ctx, []reflect.Value{reflect.ValueOf(rw), reflect.ValueOf(req), reflect.ValueOf(methods)}) 13 | } else { 14 | rw.Header().Add("Access-Control-Allow-Methods", strings.Join(methods, ", ")) 15 | rw.WriteHeader(http.StatusOK) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/panic_handler.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "log" 5 | "os" 6 | ) 7 | 8 | // PanicReporter can receive panics that happen when serving a request and report them to a log of some sort. 9 | type PanicReporter interface { 10 | // Panic is called with the URL of the request, the result of calling recover, and the stack. 11 | Panic(url string, err interface{}, stack string) 12 | } 13 | 14 | // PanicHandler will be logged to in panic conditions (eg, division by zero in an app handler). 15 | // Applications can set web.PanicHandler = your own logger, if they wish. 16 | // In terms of logging the requests / responses, see logger_middleware. That is a completely separate system. 17 | var PanicHandler = PanicReporter(logPanicReporter{ 18 | log: log.New(os.Stderr, "ERROR ", log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile), 19 | }) 20 | 21 | type logPanicReporter struct { 22 | log *log.Logger 23 | } 24 | 25 | func (l logPanicReporter) Panic(url string, err interface{}, stack string) { 26 | l.log.Printf("PANIC\nURL: %v\nERROR: %v\nSTACK:\n%s\n", url, err, stack) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/gocraft/web/request.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "net/http" 5 | "reflect" 6 | ) 7 | 8 | // Request wraps net/http's Request and gocraf/web specific fields. In particular, PathParams is used to access 9 | // captures params in your URL. A Request is sent to handlers on each request. 10 | type Request struct { 11 | *http.Request 12 | 13 | // PathParams exists if you have wildcards in your URL that you need to capture. 14 | // Eg, /users/:id/tickets/:ticket_id and /users/1/tickets/33 would yield the map {id: "3", ticket_id: "33"} 15 | PathParams map[string]string 16 | 17 | // The actual route that got invoked 18 | route *route 19 | 20 | rootContext reflect.Value // Root context. Set immediately. 21 | targetContext reflect.Value // The target context corresponding to the route. Not set until root middleware is done. 22 | } 23 | 24 | // IsRouted can be called from middleware to determine if the request has been routed yet. 25 | func (r *Request) IsRouted() bool { 26 | return r.route != nil 27 | } 28 | 29 | // RoutePath returns the routed path string. Eg, if a route was registered with 30 | // router.Get("/suggestions/:suggestion_id/comments", f), then RoutePath will return "/suggestions/:suggestion_id/comments". 31 | func (r *Request) RoutePath() string { 32 | if r.route != nil { 33 | return r.route.Path 34 | } 35 | return "" 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Go support for Protocol Buffers - Google's data interchange format 2 | 3 | Copyright 2010 The Go Authors. All rights reserved. 4 | https://github.com/golang/protobuf 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following disclaimer 14 | in the documentation and/or other materials provided with the 15 | distribution. 16 | * Neither the name of Google Inc. nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | -------------------------------------------------------------------------------- /vendor/github.com/google/gofuzz/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package fuzz is a library for populating go objects with random values. 18 | package fuzz 19 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Chris Howey 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/README.md: -------------------------------------------------------------------------------- 1 | # getpasswd in Go [![GoDoc](https://godoc.org/github.com/howeyc/gopass?status.svg)](https://godoc.org/github.com/howeyc/gopass) 2 | 3 | Retrieve password from user terminal input without echo 4 | 5 | Verified on BSD, Linux, and Windows. 6 | 7 | Example: 8 | ```go 9 | package main 10 | 11 | import "fmt" 12 | import "github.com/howeyc/gopass" 13 | 14 | func main() { 15 | fmt.Printf("Password: ") 16 | pass := gopass.GetPasswd() // Silent, for *'s use gopass.GetPasswdMasked() 17 | // Do something with pass 18 | } 19 | ``` 20 | 21 | Caution: Multi-byte characters not supported! 22 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/bsd.go: -------------------------------------------------------------------------------- 1 | // +build openbsd netbsd 2 | 3 | package gopass 4 | 5 | /* 6 | #include 7 | #include 8 | #include 9 | 10 | int getch() { 11 | int ch; 12 | struct termios t_old, t_new; 13 | 14 | tcgetattr(STDIN_FILENO, &t_old); 15 | t_new = t_old; 16 | t_new.c_lflag &= ~(ICANON | ECHO); 17 | tcsetattr(STDIN_FILENO, TCSANOW, &t_new); 18 | 19 | ch = getchar(); 20 | 21 | tcsetattr(STDIN_FILENO, TCSANOW, &t_old); 22 | return ch; 23 | } 24 | */ 25 | import "C" 26 | 27 | func getch() byte { 28 | return byte(C.getch()) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/nix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd 2 | 3 | package gopass 4 | 5 | import ( 6 | "syscall" 7 | 8 | "golang.org/x/crypto/ssh/terminal" 9 | ) 10 | 11 | func getch() byte { 12 | if oldState, err := terminal.MakeRaw(0); err != nil { 13 | panic(err) 14 | } else { 15 | defer terminal.Restore(0, oldState) 16 | } 17 | 18 | var buf [1]byte 19 | if n, err := syscall.Read(0, buf[:]); n == 0 || err != nil { 20 | panic(err) 21 | } 22 | return buf[0] 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/pass.go: -------------------------------------------------------------------------------- 1 | package gopass 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | // getPasswd returns the input read from terminal. 8 | // If masked is true, typing will be matched by asterisks on the screen. 9 | // Otherwise, typing will echo nothing. 10 | func getPasswd(masked bool) []byte { 11 | var pass, bs, mask []byte 12 | if masked { 13 | bs = []byte("\b \b") 14 | mask = []byte("*") 15 | } 16 | 17 | for { 18 | if v := getch(); v == 127 || v == 8 { 19 | if l := len(pass); l > 0 { 20 | pass = pass[:l-1] 21 | os.Stdout.Write(bs) 22 | } 23 | } else if v == 13 || v == 10 { 24 | break 25 | } else if v != 0 { 26 | pass = append(pass, v) 27 | os.Stdout.Write(mask) 28 | } 29 | } 30 | println() 31 | return pass 32 | } 33 | 34 | // GetPasswd returns the password read from the terminal without echoing input. 35 | // The returned byte array does not include end-of-line characters. 36 | func GetPasswd() []byte { 37 | return getPasswd(false) 38 | } 39 | 40 | // GetPasswdMasked returns the password read from the terminal, echoing asterisks. 41 | // The returned byte array does not include end-of-line characters. 42 | func GetPasswdMasked() []byte { 43 | return getPasswd(true) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/howeyc/gopass/win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package gopass 4 | 5 | import "syscall" 6 | import "unsafe" 7 | import "unicode/utf16" 8 | 9 | func getch() byte { 10 | modkernel32 := syscall.NewLazyDLL("kernel32.dll") 11 | procReadConsole := modkernel32.NewProc("ReadConsoleW") 12 | procGetConsoleMode := modkernel32.NewProc("GetConsoleMode") 13 | procSetConsoleMode := modkernel32.NewProc("SetConsoleMode") 14 | 15 | var mode uint32 16 | pMode := &mode 17 | procGetConsoleMode.Call(uintptr(syscall.Stdin), uintptr(unsafe.Pointer(pMode))) 18 | 19 | var echoMode, lineMode uint32 20 | echoMode = 4 21 | lineMode = 2 22 | var newMode uint32 23 | newMode = mode ^ (echoMode | lineMode) 24 | 25 | procSetConsoleMode.Call(uintptr(syscall.Stdin), uintptr(newMode)) 26 | 27 | line := make([]uint16, 1) 28 | pLine := &line[0] 29 | var n uint16 30 | procReadConsole.Call(uintptr(syscall.Stdin), uintptr(unsafe.Pointer(pLine)), uintptr(len(line)), uintptr(unsafe.Pointer(&n))) 31 | 32 | b := []byte(string(utf16.Decode(line))) 33 | 34 | procSetConsoleMode.Call(uintptr(syscall.Stdin), uintptr(mode)) 35 | 36 | // Not sure how this could happen, but it did for someone 37 | if len(b) > 0 { 38 | return b[0] 39 | } else { 40 | return 13 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/README.md: -------------------------------------------------------------------------------- 1 | # mousetrap 2 | 3 | mousetrap is a tiny library that answers a single question. 4 | 5 | On a Windows machine, was the process invoked by someone double clicking on 6 | the executable file while browsing in explorer? 7 | 8 | ### Motivation 9 | 10 | Windows developers unfamiliar with command line tools will often "double-click" 11 | the executable for a tool. Because most CLI tools print the help and then exit 12 | when invoked without arguments, this is often very frustrating for those users. 13 | 14 | mousetrap provides a way to detect these invocations so that you can provide 15 | more helpful behavior and instructions on how to run the CLI tool. To see what 16 | this looks like, both from an organizational and a technical perspective, see 17 | https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ 18 | 19 | ### The interface 20 | 21 | The library exposes a single interface: 22 | 23 | func StartedByExplorer() (bool) 24 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build go1.4 3 | 4 | package mousetrap 5 | 6 | import ( 7 | "os" 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { 13 | snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) 14 | if err != nil { 15 | return nil, err 16 | } 17 | defer syscall.CloseHandle(snapshot) 18 | var procEntry syscall.ProcessEntry32 19 | procEntry.Size = uint32(unsafe.Sizeof(procEntry)) 20 | if err = syscall.Process32First(snapshot, &procEntry); err != nil { 21 | return nil, err 22 | } 23 | for { 24 | if procEntry.ProcessID == uint32(pid) { 25 | return &procEntry, nil 26 | } 27 | err = syscall.Process32Next(snapshot, &procEntry) 28 | if err != nil { 29 | return nil, err 30 | } 31 | } 32 | } 33 | 34 | // StartedByExplorer returns true if the program was invoked by the user double-clicking 35 | // on the executable from explorer.exe 36 | // 37 | // It is conservative and returns false if any of the internal calls fail. 38 | // It does not guarantee that the program was run from a terminal. It only can tell you 39 | // whether it was launched from explorer.exe 40 | func StartedByExplorer() bool { 41 | pe, err := getProcessEntry(os.Getppid()) 42 | if err != nil { 43 | return false 44 | } 45 | return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/kr/pretty/License: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2012 Keith Rarick 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/kr/pretty/Readme: -------------------------------------------------------------------------------- 1 | package pretty 2 | 3 | import "github.com/kr/pretty" 4 | 5 | Package pretty provides pretty-printing for Go values. 6 | 7 | Documentation 8 | 9 | http://godoc.org/github.com/kr/pretty 10 | -------------------------------------------------------------------------------- /vendor/github.com/kr/pretty/zero.go: -------------------------------------------------------------------------------- 1 | package pretty 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | func nonzero(v reflect.Value) bool { 8 | switch v.Kind() { 9 | case reflect.Bool: 10 | return v.Bool() 11 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 12 | return v.Int() != 0 13 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 14 | return v.Uint() != 0 15 | case reflect.Float32, reflect.Float64: 16 | return v.Float() != 0 17 | case reflect.Complex64, reflect.Complex128: 18 | return v.Complex() != complex(0, 0) 19 | case reflect.String: 20 | return v.String() != "" 21 | case reflect.Struct: 22 | for i := 0; i < v.NumField(); i++ { 23 | if nonzero(getField(v, i)) { 24 | return true 25 | } 26 | } 27 | return false 28 | case reflect.Array: 29 | for i := 0; i < v.Len(); i++ { 30 | if nonzero(v.Index(i)) { 31 | return true 32 | } 33 | } 34 | return false 35 | case reflect.Map, reflect.Interface, reflect.Slice, reflect.Ptr, reflect.Chan, reflect.Func: 36 | return !v.IsNil() 37 | case reflect.UnsafePointer: 38 | return v.Pointer() != 0 39 | } 40 | return true 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/kr/text/License: -------------------------------------------------------------------------------- 1 | Copyright 2012 Keith Rarick 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/kr/text/Readme: -------------------------------------------------------------------------------- 1 | This is a Go package for manipulating paragraphs of text. 2 | 3 | See http://go.pkgdoc.org/github.com/kr/text for full documentation. 4 | -------------------------------------------------------------------------------- /vendor/github.com/kr/text/doc.go: -------------------------------------------------------------------------------- 1 | // Package text provides rudimentary functions for manipulating text in 2 | // paragraphs. 3 | package text 4 | -------------------------------------------------------------------------------- /vendor/github.com/looplab/fsm/wercker.yml: -------------------------------------------------------------------------------- 1 | box: wercker/golang 2 | 3 | build: 4 | steps: 5 | # Sets the go workspace and places you package 6 | # at the right place in the workspace tree 7 | - setup-go-workspace 8 | 9 | # Gets the dependencies 10 | - script: 11 | name: go get 12 | code: | 13 | cd $WERCKER_SOURCE_DIR 14 | go version 15 | go get -t ./... 16 | 17 | # Build the project 18 | - script: 19 | name: go build 20 | code: | 21 | go build ./... 22 | 23 | # Test the project 24 | - script: 25 | name: go test 26 | code: | 27 | go get golang.org/x/tools/cmd/cover 28 | go get github.com/axw/gocov/gocov 29 | go get github.com/mattn/goveralls 30 | git checkout master 31 | goveralls -service wercker.com -repotoken $COVERALLS_TOKEN 32 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/LICENSE: -------------------------------------------------------------------------------- 1 | goproperties - properties file decoder for Go 2 | 3 | Copyright (c) 2013-2014 - Frank Schroeder 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/rangecheck.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2014 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import ( 8 | "fmt" 9 | "math" 10 | ) 11 | 12 | // make this a var to overwrite it in a test 13 | var is32Bit = ^uint(0) == math.MaxUint32 14 | 15 | // intRangeCheck checks if the value fits into the int type and 16 | // panics if it does not. 17 | func intRangeCheck(key string, v int64) int { 18 | if is32Bit && (v < math.MinInt32 || v > math.MaxInt32) { 19 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 20 | } 21 | return int(v) 22 | } 23 | 24 | // uintRangeCheck checks if the value fits into the uint type and 25 | // panics if it does not. 26 | func uintRangeCheck(key string, v uint64) uint { 27 | if is32Bit && v > math.MaxUint32 { 28 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 29 | } 30 | return uint(v) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c: -------------------------------------------------------------------------------- 1 | #ifndef USE_LIBSQLITE3 2 | # include "code/sqlite3-binding.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h: -------------------------------------------------------------------------------- 1 | #ifndef USE_LIBSQLITE3 2 | #include "code/sqlite3-binding.h" 3 | #else 4 | #include 5 | #endif 6 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_icu.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build icu 6 | 7 | package sqlite3 8 | 9 | /* 10 | #cgo LDFLAGS: -licuuc -licui18n 11 | #cgo CFLAGS: -DSQLITE_ENABLE_ICU 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_libsqlite3.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build libsqlite3 6 | 7 | package sqlite3 8 | 9 | /* 10 | #cgo CFLAGS: -DUSE_LIBSQLITE3 11 | #cgo LDFLAGS: -lsqlite3 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_load_extension.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build !sqlite_omit_load_extension 6 | 7 | package sqlite3 8 | 9 | /* 10 | #include 11 | #include 12 | */ 13 | import "C" 14 | import ( 15 | "errors" 16 | "unsafe" 17 | ) 18 | 19 | func (c *SQLiteConn) loadExtensions(extensions []string) error { 20 | rv := C.sqlite3_enable_load_extension(c.db, 1) 21 | if rv != C.SQLITE_OK { 22 | return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) 23 | } 24 | 25 | for _, extension := range extensions { 26 | cext := C.CString(extension) 27 | defer C.free(unsafe.Pointer(cext)) 28 | rv = C.sqlite3_load_extension(c.db, cext, nil, nil) 29 | if rv != C.SQLITE_OK { 30 | return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) 31 | } 32 | } 33 | 34 | rv = C.sqlite3_enable_load_extension(c.db, 0) 35 | if rv != C.SQLITE_OK { 36 | return errors.New(C.GoString(C.sqlite3_errmsg(c.db))) 37 | } 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_omit_load_extension.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build sqlite_omit_load_extension 6 | 7 | package sqlite3 8 | 9 | /* 10 | #cgo CFLAGS: -DSQLITE_OMIT_LOAD_EXTENSION 11 | */ 12 | import "C" 13 | import ( 14 | "errors" 15 | ) 16 | 17 | func (c *SQLiteConn) loadExtensions(extensions []string) error { 18 | return errors.New("Extensions have been disabled for static builds") 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_other.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build !windows 6 | 7 | package sqlite3 8 | 9 | /* 10 | #cgo CFLAGS: -I. 11 | #cgo linux LDFLAGS: -ldl 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-sqlite3/sqlite3_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Yasuhiro Matsumoto . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | // +build windows 6 | 7 | package sqlite3 8 | 9 | /* 10 | #cgo CFLAGS: -I. -fno-stack-check -fno-stack-protector -mno-stack-arg-probe 11 | #cgo windows,386 CFLAGS: -D_localtime32=localtime 12 | #cgo LDFLAGS: -lmingwex -lmingw32 13 | */ 14 | import "C" 15 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/README.md: -------------------------------------------------------------------------------- 1 | # mapstructure 2 | 3 | mapstructure is a Go library for decoding generic map values to structures 4 | and vice versa, while providing helpful error handling. 5 | 6 | This library is most useful when decoding values from some data stream (JSON, 7 | Gob, etc.) where you don't _quite_ know the structure of the underlying data 8 | until you read a part of it. You can therefore read a `map[string]interface{}` 9 | and use this library to decode it into the proper underlying native Go 10 | structure. 11 | 12 | ## Installation 13 | 14 | Standard `go get`: 15 | 16 | ``` 17 | $ go get github.com/mitchellh/mapstructure 18 | ``` 19 | 20 | ## Usage & Example 21 | 22 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure). 23 | 24 | The `Decode` function has examples associated with it there. 25 | 26 | ## But Why?! 27 | 28 | Go offers fantastic standard libraries for decoding formats such as JSON. 29 | The standard method is to have a struct pre-created, and populate that struct 30 | from the bytes of the encoded format. This is great, but the problem is if 31 | you have configuration or an encoding that changes slightly depending on 32 | specific fields. For example, consider this JSON: 33 | 34 | ```json 35 | { 36 | "type": "person", 37 | "name": "Mitchell" 38 | } 39 | ``` 40 | 41 | Perhaps we can't populate a specific structure without first reading 42 | the "type" field from the JSON. We could always do two passes over the 43 | decoding of the JSON (reading the "type" first, and the rest later). 44 | However, it is much simpler to just decode this into a `map[string]interface{}` 45 | structure, read the "type" key, then use something like this library 46 | to decode it into the proper structure. 47 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alec Thomas 2 | Guilhem Lettron 3 | Ivan Daniluk 4 | Nimi Wariboko Jr 5 | Róbert Selvek 6 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Örjan Persson. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/backend.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package logging 6 | 7 | // defaultBackend is the backend used for all logging calls. 8 | var defaultBackend LeveledBackend 9 | 10 | // Backend is the interface which a log backend need to implement to be able to 11 | // be used as a logging backend. 12 | type Backend interface { 13 | Log(Level, int, *Record) error 14 | } 15 | 16 | // Set backend replaces the backend currently set with the given new logging 17 | // backend. 18 | func SetBackend(backends ...Backend) LeveledBackend { 19 | var backend Backend 20 | if len(backends) == 1 { 21 | backend = backends[0] 22 | } else { 23 | backend = MultiLogger(backends...) 24 | } 25 | 26 | defaultBackend = AddModuleLevel(backend) 27 | return defaultBackend 28 | } 29 | 30 | // SetLevel sets the logging level for the specified module. The module 31 | // corresponds to the string specified in GetLogger. 32 | func SetLevel(level Level, module string) { 33 | defaultBackend.SetLevel(level, module) 34 | } 35 | 36 | // GetLevel returns the logging level for the specified module. 37 | func GetLevel(module string) Level { 38 | return defaultBackend.GetLevel(module) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build !windows,!plan9 6 | 7 | package logging 8 | 9 | import "log/syslog" 10 | 11 | // SyslogBackend is a simple logger to syslog backend. It automatically maps 12 | // the internal log levels to appropriate syslog log levels. 13 | type SyslogBackend struct { 14 | Writer *syslog.Writer 15 | } 16 | 17 | // NewSyslogBackend connects to the syslog daemon using UNIX sockets with the 18 | // given prefix. If prefix is not given, the prefix will be derived from the 19 | // launched command. 20 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 21 | var w *syslog.Writer 22 | w, err = syslog.New(syslog.LOG_CRIT, prefix) 23 | return &SyslogBackend{w}, err 24 | } 25 | 26 | // NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom 27 | // syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc. 28 | func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) { 29 | var w *syslog.Writer 30 | w, err = syslog.New(priority, prefix) 31 | return &SyslogBackend{w}, err 32 | } 33 | 34 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 35 | line := rec.Formatted(calldepth + 1) 36 | switch level { 37 | case CRITICAL: 38 | return b.Writer.Crit(line) 39 | case ERROR: 40 | return b.Writer.Err(line) 41 | case WARNING: 42 | return b.Writer.Warning(line) 43 | case NOTICE: 44 | return b.Writer.Notice(line) 45 | case INFO: 46 | return b.Writer.Info(line) 47 | case DEBUG: 48 | return b.Writer.Debug(line) 49 | default: 50 | } 51 | panic("unhandled log level") 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog_fallback.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build windows plan9 6 | 7 | package logging 8 | 9 | import ( 10 | "fmt" 11 | ) 12 | 13 | type Priority int 14 | 15 | type SyslogBackend struct { 16 | } 17 | 18 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 19 | return nil, fmt.Errorf("Platform does not support syslog") 20 | } 21 | 22 | func NewSyslogBackendPriority(prefix string, priority Priority) (b *SyslogBackend, err error) { 23 | return nil, fmt.Errorf("Platform does not support syslog") 24 | } 25 | 26 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 27 | return fmt.Errorf("Platform does not support syslog") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/russross/blackfriday/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Blackfriday is distributed under the Simplified BSD License: 2 | 3 | > Copyright © 2011 Russ Ross 4 | > All rights reserved. 5 | > 6 | > Redistribution and use in source and binary forms, with or without 7 | > modification, are permitted provided that the following conditions 8 | > are met: 9 | > 10 | > 1. Redistributions of source code must retain the above copyright 11 | > notice, this list of conditions and the following disclaimer. 12 | > 13 | > 2. Redistributions in binary form must reproduce the above 14 | > copyright notice, this list of conditions and the following 15 | > disclaimer in the documentation and/or other materials provided with 16 | > the distribution. 17 | > 18 | > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | > "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | > LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | > FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | > COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | > INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | > BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | > LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | > CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | > LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | > ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | > POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /vendor/github.com/shurcooL/sanitized_anchor_name/README.md: -------------------------------------------------------------------------------- 1 | # sanitized_anchor_name [![Build Status](https://travis-ci.org/shurcooL/sanitized_anchor_name.svg?branch=master)](https://travis-ci.org/shurcooL/sanitized_anchor_name) [![GoDoc](https://godoc.org/github.com/shurcooL/sanitized_anchor_name?status.svg)](https://godoc.org/github.com/shurcooL/sanitized_anchor_name) 2 | 3 | Package sanitized_anchor_name provides a func to create sanitized anchor names. 4 | 5 | Its logic can be reused by multiple packages to create interoperable anchor names and links to those anchors. 6 | 7 | At this time, it does not try to ensure that generated anchor names are unique, that responsibility falls on the caller. 8 | 9 | Installation 10 | ------------ 11 | 12 | ```bash 13 | go get -u github.com/shurcooL/sanitized_anchor_name 14 | ``` 15 | 16 | Example 17 | ------- 18 | 19 | ```Go 20 | anchorName := sanitized_anchor_name.Create("This is a header") 21 | 22 | fmt.Println(anchorName) 23 | 24 | // Output: 25 | // this-is-a-header 26 | ``` 27 | 28 | License 29 | ------- 30 | 31 | - [MIT License](http://opensource.org/licenses/mit-license.php) 32 | -------------------------------------------------------------------------------- /vendor/github.com/shurcooL/sanitized_anchor_name/main.go: -------------------------------------------------------------------------------- 1 | // Package sanitized_anchor_name provides a func to create sanitized anchor names. 2 | // 3 | // Its logic can be reused by multiple packages to create interoperable anchor names 4 | // and links to those anchors. 5 | // 6 | // At this time, it does not try to ensure that generated anchor names 7 | // are unique, that responsibility falls on the caller. 8 | package sanitized_anchor_name // import "github.com/shurcooL/sanitized_anchor_name" 9 | 10 | import "unicode" 11 | 12 | // Create returns a sanitized anchor name for the given text. 13 | func Create(text string) string { 14 | var anchorName []rune 15 | var futureDash = false 16 | for _, r := range []rune(text) { 17 | switch { 18 | case unicode.IsLetter(r) || unicode.IsNumber(r): 19 | if futureDash && len(anchorName) > 0 { 20 | anchorName = append(anchorName, '-') 21 | } 22 | futureDash = false 23 | anchorName = append(anchorName, unicode.ToLower(r)) 24 | default: 25 | futureDash = true 26 | } 27 | } 28 | return string(anchorName) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/cast.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2014 Steve Francia . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package cast 7 | 8 | import "time" 9 | 10 | func ToBool(i interface{}) bool { 11 | v, _ := ToBoolE(i) 12 | return v 13 | } 14 | 15 | func ToTime(i interface{}) time.Time { 16 | v, _ := ToTimeE(i) 17 | return v 18 | } 19 | 20 | func ToDuration(i interface{}) time.Duration { 21 | v, _ := ToDurationE(i) 22 | return v 23 | } 24 | 25 | func ToFloat64(i interface{}) float64 { 26 | v, _ := ToFloat64E(i) 27 | return v 28 | } 29 | 30 | func ToInt(i interface{}) int { 31 | v, _ := ToIntE(i) 32 | return v 33 | } 34 | 35 | func ToString(i interface{}) string { 36 | v, _ := ToStringE(i) 37 | return v 38 | } 39 | 40 | func ToStringMapString(i interface{}) map[string]string { 41 | v, _ := ToStringMapStringE(i) 42 | return v 43 | } 44 | 45 | func ToStringMapStringSlice(i interface{}) map[string][]string { 46 | v, _ := ToStringMapStringSliceE(i) 47 | return v 48 | } 49 | 50 | func ToStringMapBool(i interface{}) map[string]bool { 51 | v, _ := ToStringMapBoolE(i) 52 | return v 53 | } 54 | 55 | func ToStringMap(i interface{}) map[string]interface{} { 56 | v, _ := ToStringMapE(i) 57 | return v 58 | } 59 | 60 | func ToSlice(i interface{}) []interface{} { 61 | v, _ := ToSliceE(i) 62 | return v 63 | } 64 | 65 | func ToStringSlice(i interface{}) []string { 66 | v, _ := ToStringSliceE(i) 67 | return v 68 | } 69 | 70 | func ToIntSlice(i interface{}) []int { 71 | v, _ := ToIntSliceE(i) 72 | return v 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/doc_util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Red Hat Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package cobra 15 | 16 | // Test to see if we have a reason to print See Also information in docs 17 | // Basically this is a test for a parent commend or a subcommand which is 18 | // both not deprecated and not the autogenerated help command. 19 | func (cmd *Command) hasSeeAlso() bool { 20 | if cmd.HasParent() { 21 | return true 22 | } 23 | children := cmd.Commands() 24 | if len(children) == 0 { 25 | return false 26 | } 27 | for _, c := range children { 28 | if !c.IsAvailableCommand() || c == cmd.helpCommand { 29 | continue 30 | } 31 | return true 32 | } 33 | return false 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/man_docs.md: -------------------------------------------------------------------------------- 1 | # Generating Man Pages For Your Own cobra.Command 2 | 3 | Generating bash completions from a cobra command is incredibly easy. An example is as follows: 4 | 5 | ```go 6 | package main 7 | 8 | import ( 9 | "github.com/spf13/cobra" 10 | ) 11 | 12 | func main() { 13 | cmd := &cobra.Command{ 14 | Use: "test", 15 | Short: "my test program", 16 | } 17 | header := &cobra.GenManHeader{ 18 | Title: "MINE", 19 | Section: "3", 20 | } 21 | cmd.GenManTree(header, "/tmp") 22 | } 23 | ``` 24 | 25 | That will get you a man page `/tmp/test.1` 26 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/jwalterweatherman/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Alex Ogier. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/viper/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Thomas Adam 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/README.md: -------------------------------------------------------------------------------- 1 | # gorocksdb, a Go wrapper for RocksDB 2 | 3 | [![Build Status](https://travis-ci.org/tecbot/gorocksdb.png)](https://travis-ci.org/tecbot/gorocksdb) [![GoDoc](https://godoc.org/github.com/tecbot/gorocksdb?status.png)](http://godoc.org/github.com/tecbot/gorocksdb) 4 | 5 | ## Building 6 | 7 | You'll need the shared library build of 8 | [RocksDB](https://github.com/facebook/rocksdb) installed on your machine, simply run: 9 | 10 | make shared_lib 11 | 12 | Now, if you build RocksDB you can install gorocksdb: 13 | 14 | CGO_CFLAGS="-I/path/to/rocksdb/include" \ 15 | CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy" \ 16 | go get github.com/tecbot/gorocksdb 17 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/cache.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // Cache is a cache used to store data read from data in memory. 7 | type Cache struct { 8 | c *C.rocksdb_cache_t 9 | } 10 | 11 | // NewLRUCache creates a new LRU Cache object with the capacity given. 12 | func NewLRUCache(capacity int) *Cache { 13 | return NewNativeCache(C.rocksdb_cache_create_lru(C.size_t(capacity))) 14 | } 15 | 16 | // NewNativeCache creates a Cache object. 17 | func NewNativeCache(c *C.rocksdb_cache_t) *Cache { 18 | return &Cache{c} 19 | } 20 | 21 | // Destroy deallocates the Cache object. 22 | func (self *Cache) Destroy() { 23 | C.rocksdb_cache_destroy(self.c) 24 | self.c = nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/cf_handle.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include 4 | // #include "rocksdb/c.h" 5 | import "C" 6 | 7 | type ColumnFamilyHandle struct { 8 | c *C.rocksdb_column_family_handle_t 9 | } 10 | 11 | // NewNativeColumnFamilyHandle creates a ColumnFamilyHandle object. 12 | func NewNativeColumnFamilyHandle(c *C.rocksdb_column_family_handle_t) *ColumnFamilyHandle { 13 | return &ColumnFamilyHandle{c} 14 | } 15 | 16 | func (h *ColumnFamilyHandle) Destroy() { 17 | C.rocksdb_column_family_handle_destroy(h.c) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/comparator.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // A Comparator object provides a total order across slices that are 7 | // used as keys in an sstable or a database. 8 | type Comparator interface { 9 | // Three-way comparison. Returns value: 10 | // < 0 iff "a" < "b", 11 | // == 0 iff "a" == "b", 12 | // > 0 iff "a" > "b" 13 | Compare(a, b []byte) int 14 | 15 | // The name of the comparator. 16 | Name() string 17 | } 18 | 19 | type nativeComparator struct { 20 | c *C.rocksdb_comparator_t 21 | } 22 | 23 | func (c nativeComparator) Compare(a, b []byte) int { return 0 } 24 | 25 | func (c nativeComparator) Name() string { return "" } 26 | 27 | // NewNativeComparator allocates a Comparator object. 28 | // The Comparator's methods are no-ops, but it is still used correctly by 29 | // RocksDB. 30 | func NewNativeComparator(c *C.rocksdb_comparator_t) Comparator { 31 | return nativeComparator{c} 32 | } 33 | 34 | //export gorocksdb_comparator_compare 35 | func gorocksdb_comparator_compare(handler *Comparator, cKeyA *C.char, cKeyALen C.size_t, cKeyB *C.char, cKeyBLen C.size_t) C.int { 36 | keyA := charToByte(cKeyA, cKeyALen) 37 | keyB := charToByte(cKeyB, cKeyBLen) 38 | 39 | compare := (*handler).Compare(keyA, keyB) 40 | 41 | return C.int(compare) 42 | } 43 | 44 | //export gorocksdb_comparator_name 45 | func gorocksdb_comparator_name(handler *Comparator) *C.char { 46 | return stringToChar((*handler).Name()) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/dynflag.go: -------------------------------------------------------------------------------- 1 | // +build dynamic 2 | 3 | package gorocksdb 4 | 5 | // #cgo LDFLAGS: -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy 6 | import "C" 7 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/embedflag.go: -------------------------------------------------------------------------------- 1 | // +build embed 2 | 3 | package gorocksdb 4 | 5 | // #cgo CXXFLAGS: -std=c++11 6 | // #cgo CPPFLAGS: -I${SRCDIR}/../../cockroachdb/c-lz4/internal/lib 7 | // #cgo CPPFLAGS: -I${SRCDIR}/../../cockroachdb/c-rocksdb/internal/include 8 | // #cgo CPPFLAGS: -I${SRCDIR}/../../cockroachdb/c-snappy/internal 9 | // #cgo LDFLAGS: -lstdc++ 10 | // #cgo darwin LDFLAGS: -Wl,-undefined -Wl,dynamic_lookup 11 | // #cgo !darwin LDFLAGS: -Wl,-unresolved-symbols=ignore-all -lrt 12 | import "C" 13 | 14 | import ( 15 | _ "github.com/cockroachdb/c-lz4" 16 | _ "github.com/cockroachdb/c-rocksdb" 17 | _ "github.com/cockroachdb/c-snappy" 18 | ) 19 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/env.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // Env is a system call environment used by a database. 7 | type Env struct { 8 | c *C.rocksdb_env_t 9 | } 10 | 11 | // NewDefaultEnv creates a default environment. 12 | func NewDefaultEnv() *Env { 13 | return NewNativeEnv(C.rocksdb_create_default_env()) 14 | } 15 | 16 | // NewNativeEnv creates a Environment object. 17 | func NewNativeEnv(c *C.rocksdb_env_t) *Env { 18 | return &Env{c} 19 | } 20 | 21 | // The number of background worker threads of a specific thread pool 22 | // for this environment. 'LOW' is the default pool. 23 | // Default: 1 24 | func (self *Env) SetBackgroundThreads(n int) { 25 | C.rocksdb_env_set_background_threads(self.c, C.int(n)) 26 | } 27 | 28 | // SetHighPriorityBackgroundThreads sets the size of the high priority 29 | // thread pool that can be used to prevent compactions from stalling 30 | // memtable flushes. 31 | func (self *Env) SetHighPriorityBackgroundThreads(n int) { 32 | C.rocksdb_env_set_high_priority_background_threads(self.c, C.int(n)) 33 | } 34 | 35 | // Destroy deallocates the Env object. 36 | func (self *Env) Destroy() { 37 | C.rocksdb_env_destroy(self.c) 38 | self.c = nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/gorocksdb.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "rocksdb/c.h" 3 | 4 | // This API provides convenient C wrapper functions for rocksdb client. 5 | 6 | /* Base */ 7 | 8 | extern void gorocksdb_destruct_handler(void* state); 9 | 10 | /* CompactionFilter */ 11 | 12 | extern rocksdb_compactionfilter_t* gorocksdb_compactionfilter_create(void* state); 13 | 14 | /* Comparator */ 15 | 16 | extern rocksdb_comparator_t* gorocksdb_comparator_create(void* state); 17 | 18 | /* Filter Policy */ 19 | 20 | extern rocksdb_filterpolicy_t* gorocksdb_filterpolicy_create(void* state); 21 | extern void gorocksdb_filterpolicy_delete_filter(void* state, const char* v, size_t s); 22 | 23 | /* Merge Operator */ 24 | 25 | extern rocksdb_mergeoperator_t* gorocksdb_mergeoperator_create(void* state); 26 | extern void gorocksdb_mergeoperator_delete_value(void* state, const char* v, size_t s); 27 | 28 | /* Slice Transform */ 29 | 30 | extern rocksdb_slicetransform_t* gorocksdb_slicetransform_create(void* state); 31 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/options_compression.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // Compression options for different compression algorithms like Zlib. 4 | type CompressionOptions struct { 5 | WindowBits int 6 | Level int 7 | Strategy int 8 | } 9 | 10 | // NewDefaultCompressionOptions creates a default CompressionOptions object. 11 | func NewDefaultCompressionOptions() *CompressionOptions { 12 | return NewCompressionOptions(-14, -1, 0) 13 | } 14 | 15 | // NewCompressionOptions creates a CompressionOptions object. 16 | func NewCompressionOptions(windowBits, level, strategy int) *CompressionOptions { 17 | return &CompressionOptions{ 18 | WindowBits: windowBits, 19 | Level: level, 20 | Strategy: strategy, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/options_flush.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // FlushOptions represent all of the available options when manual flushing the 7 | // database. 8 | type FlushOptions struct { 9 | c *C.rocksdb_flushoptions_t 10 | } 11 | 12 | // NewDefaultFlushOptions creates a default FlushOptions object. 13 | func NewDefaultFlushOptions() *FlushOptions { 14 | return NewNativeFlushOptions(C.rocksdb_flushoptions_create()) 15 | } 16 | 17 | // NewNativeFlushOptions creates a FlushOptions object. 18 | func NewNativeFlushOptions(c *C.rocksdb_flushoptions_t) *FlushOptions { 19 | return &FlushOptions{c} 20 | } 21 | 22 | // If true, the flush will wait until the flush is done. 23 | // Default: true 24 | func (self *FlushOptions) SetWait(value bool) { 25 | C.rocksdb_flushoptions_set_wait(self.c, boolToChar(value)) 26 | } 27 | 28 | // Destroy deallocates the FlushOptions object. 29 | func (self *FlushOptions) Destroy() { 30 | C.rocksdb_flushoptions_destroy(self.c) 31 | self.c = nil 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/options_write.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // WriteOptions represent all of the available options when writing to a 7 | // database. 8 | type WriteOptions struct { 9 | c *C.rocksdb_writeoptions_t 10 | } 11 | 12 | // NewDefaultWriteOptions creates a default WriteOptions object. 13 | func NewDefaultWriteOptions() *WriteOptions { 14 | return NewNativeWriteOptions(C.rocksdb_writeoptions_create()) 15 | } 16 | 17 | // NewNativeWriteOptions creates a WriteOptions object. 18 | func NewNativeWriteOptions(c *C.rocksdb_writeoptions_t) *WriteOptions { 19 | return &WriteOptions{c} 20 | } 21 | 22 | // If true, the write will be flushed from the operating system 23 | // buffer cache before the write is considered complete. 24 | // If this flag is true, writes will be slower. 25 | // Default: false 26 | func (self *WriteOptions) SetSync(value bool) { 27 | C.rocksdb_writeoptions_set_sync(self.c, boolToChar(value)) 28 | } 29 | 30 | // If true, writes will not first go to the write ahead log, 31 | // and the write may got lost after a crash. 32 | // Default: false 33 | func (self *WriteOptions) DisableWAL(value bool) { 34 | C.rocksdb_writeoptions_disable_WAL(self.c, C.int(btoi(value))) 35 | } 36 | 37 | // Destroy deallocates the WriteOptions object. 38 | func (self *WriteOptions) Destroy() { 39 | C.rocksdb_writeoptions_destroy(self.c) 40 | self.c = nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/slice.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include 4 | import "C" 5 | 6 | import "unsafe" 7 | 8 | // Slice is used as a wrapper for non-copy values 9 | type Slice struct { 10 | data *C.char 11 | size C.size_t 12 | freed bool 13 | } 14 | 15 | func NewSlice(data *C.char, size C.size_t) *Slice { 16 | return &Slice{data, size, false} 17 | } 18 | 19 | func (self *Slice) Data() []byte { 20 | return charToByte(self.data, self.size) 21 | } 22 | 23 | func (self *Slice) Size() int { 24 | return int(self.size) 25 | } 26 | 27 | func (self *Slice) Free() { 28 | if !self.freed { 29 | C.free(unsafe.Pointer(self.data)) 30 | self.freed = true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/snapshot.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | // #include "rocksdb/c.h" 4 | import "C" 5 | 6 | // Snapshot provides a consistent view of read operations in a DB. 7 | type Snapshot struct { 8 | c *C.rocksdb_snapshot_t 9 | cDb *C.rocksdb_t 10 | } 11 | 12 | // NewNativeSnapshot creates a Snapshot object. 13 | func NewNativeSnapshot(c *C.rocksdb_snapshot_t, cDb *C.rocksdb_t) *Snapshot { 14 | return &Snapshot{c, cDb} 15 | } 16 | 17 | // Release removes the snapshot from the database's list of snapshots. 18 | func (self *Snapshot) Release() { 19 | C.rocksdb_release_snapshot(self.cDb, self.c) 20 | self.c, self.cDb = nil, nil 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/tecbot/gorocksdb/util.go: -------------------------------------------------------------------------------- 1 | package gorocksdb 2 | 3 | import "C" 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | // btoi converts a bool value to int 11 | func btoi(b bool) int { 12 | if b { 13 | return 1 14 | } 15 | return 0 16 | } 17 | 18 | // boolToChar converts a bool value to C.uchar 19 | func boolToChar(b bool) C.uchar { 20 | if b { 21 | return 1 22 | } 23 | return 0 24 | } 25 | 26 | func charToByte(data *C.char, len C.size_t) []byte { 27 | var value []byte 28 | 29 | sH := (*reflect.SliceHeader)(unsafe.Pointer(&value)) 30 | sH.Cap, sH.Len, sH.Data = int(len), int(len), uintptr(unsafe.Pointer(data)) 31 | 32 | return value 33 | } 34 | 35 | // byteToChar returns *C.char from byte slice 36 | func byteToChar(b []byte) *C.char { 37 | var c *C.char 38 | if len(b) > 0 { 39 | c = (*C.char)(unsafe.Pointer(&b[0])) 40 | } 41 | 42 | return c 43 | } 44 | 45 | // stringToChar returns *C.char from string 46 | func stringToChar(s string) *C.char { 47 | ptrStr := (*reflect.StringHeader)(unsafe.Pointer(&s)) 48 | 49 | return (*C.char)(unsafe.Pointer(ptrStr.Data)) 50 | } 51 | 52 | // charSlice converts a C array of *char to a []*C.char. 53 | func charSlice(data **C.char, len C.int) []*C.char { 54 | var value []*C.char 55 | 56 | sH := (*reflect.SliceHeader)(unsafe.Pointer(&value)) 57 | sH.Cap, sH.Len, sH.Data = int(len), int(len), uintptr(unsafe.Pointer(data)) 58 | 59 | return value 60 | } 61 | 62 | // sizeSlice converts a C array of size_t to a []C.size_t. 63 | func sizeSlice(data *C.size_t, len C.int) []C.size_t { 64 | var value []C.size_t 65 | 66 | sH := (*reflect.SliceHeader)(unsafe.Pointer(&value)) 67 | sH.Cap, sH.Len, sH.Data = int(len), int(len), uintptr(unsafe.Pointer(data)) 68 | 69 | return value 70 | } 71 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package sha3 8 | 9 | import ( 10 | "crypto" 11 | ) 12 | 13 | func init() { 14 | crypto.RegisterHash(crypto.SHA3_224, New224) 15 | crypto.RegisterHash(crypto.SHA3_256, New256) 16 | crypto.RegisterHash(crypto.SHA3_384, New384) 17 | crypto.RegisterHash(crypto.SHA3_512, New512) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !amd64,!386 appengine 6 | 7 | package sha3 8 | 9 | var ( 10 | xorIn = xorInGeneric 11 | copyOut = copyOutGeneric 12 | xorInUnaligned = xorInGeneric 13 | copyOutUnaligned = copyOutGeneric 14 | ) 15 | 16 | const xorImplementationUnaligned = "generic" 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor_generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package sha3 6 | 7 | import "encoding/binary" 8 | 9 | // xorInGeneric xors the bytes in buf into the state; it 10 | // makes no non-portable assumptions about memory layout 11 | // or alignment. 12 | func xorInGeneric(d *state, buf []byte) { 13 | n := len(buf) / 8 14 | 15 | for i := 0; i < n; i++ { 16 | a := binary.LittleEndian.Uint64(buf) 17 | d.a[i] ^= a 18 | buf = buf[8:] 19 | } 20 | } 21 | 22 | // copyOutGeneric copies ulint64s to a byte buffer. 23 | func copyOutGeneric(d *state, b []byte) { 24 | for i := 0; len(b) >= 8; i++ { 25 | binary.LittleEndian.PutUint64(b, d.a[i]) 26 | b = b[8:] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/sha3/xor_unaligned.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 386 6 | // +build !appengine 7 | 8 | package sha3 9 | 10 | import "unsafe" 11 | 12 | func xorInUnaligned(d *state, buf []byte) { 13 | bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0])) 14 | n := len(buf) 15 | if n >= 72 { 16 | d.a[0] ^= bw[0] 17 | d.a[1] ^= bw[1] 18 | d.a[2] ^= bw[2] 19 | d.a[3] ^= bw[3] 20 | d.a[4] ^= bw[4] 21 | d.a[5] ^= bw[5] 22 | d.a[6] ^= bw[6] 23 | d.a[7] ^= bw[7] 24 | d.a[8] ^= bw[8] 25 | } 26 | if n >= 104 { 27 | d.a[9] ^= bw[9] 28 | d.a[10] ^= bw[10] 29 | d.a[11] ^= bw[11] 30 | d.a[12] ^= bw[12] 31 | } 32 | if n >= 136 { 33 | d.a[13] ^= bw[13] 34 | d.a[14] ^= bw[14] 35 | d.a[15] ^= bw[15] 36 | d.a[16] ^= bw[16] 37 | } 38 | if n >= 144 { 39 | d.a[17] ^= bw[17] 40 | } 41 | if n >= 168 { 42 | d.a[18] ^= bw[18] 43 | d.a[19] ^= bw[19] 44 | d.a[20] ^= bw[20] 45 | } 46 | } 47 | 48 | func copyOutUnaligned(d *state, buf []byte) { 49 | ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) 50 | copy(buf, ab[:]) 51 | } 52 | 53 | var ( 54 | xorIn = xorInUnaligned 55 | copyOut = copyOutUnaligned 56 | ) 57 | 58 | const xorImplementationUnaligned = "unaligned" 59 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package ssh implements an SSH client and server. 7 | 8 | SSH is a transport security protocol, an authentication protocol and a 9 | family of application protocols. The most typical application level 10 | protocol is a remote shell and this is specifically implemented. However, 11 | the multiplexed nature of SSH is exposed to users that wish to support 12 | others. 13 | 14 | References: 15 | [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD 16 | [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 17 | */ 18 | package ssh // import "golang.org/x/crypto/ssh" 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/mac.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | // Message authentication support 8 | 9 | import ( 10 | "crypto/hmac" 11 | "crypto/sha1" 12 | "crypto/sha256" 13 | "hash" 14 | ) 15 | 16 | type macMode struct { 17 | keySize int 18 | new func(key []byte) hash.Hash 19 | } 20 | 21 | // truncatingMAC wraps around a hash.Hash and truncates the output digest to 22 | // a given size. 23 | type truncatingMAC struct { 24 | length int 25 | hmac hash.Hash 26 | } 27 | 28 | func (t truncatingMAC) Write(data []byte) (int, error) { 29 | return t.hmac.Write(data) 30 | } 31 | 32 | func (t truncatingMAC) Sum(in []byte) []byte { 33 | out := t.hmac.Sum(in) 34 | return out[:len(in)+t.length] 35 | } 36 | 37 | func (t truncatingMAC) Reset() { 38 | t.hmac.Reset() 39 | } 40 | 41 | func (t truncatingMAC) Size() int { 42 | return t.length 43 | } 44 | 45 | func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() } 46 | 47 | var macModes = map[string]*macMode{ 48 | "hmac-sha2-256": {32, func(key []byte) hash.Hash { 49 | return hmac.New(sha256.New, key) 50 | }}, 51 | "hmac-sha1": {20, func(key []byte) hash.Hash { 52 | return hmac.New(sha1.New, key) 53 | }}, 54 | "hmac-sha1-96": {20, func(key []byte) hash.Hash { 55 | return truncatingMAC{12, hmac.New(sha1.New, key)} 56 | }}, 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "syscall" 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | const ioctlWriteTermios = syscall.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | // These constants are declared here, rather than importing 8 | // them from the syscall package as some syscall packages, even 9 | // on linux, for example gccgo, do not declare them. 10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # This Dockerfile builds a recent curl with HTTP/2 client support, using 3 | # a recent nghttp2 build. 4 | # 5 | # See the Makefile for how to tag it. If Docker and that image is found, the 6 | # Go tests use this curl binary for integration tests. 7 | # 8 | 9 | FROM ubuntu:trusty 10 | 11 | RUN apt-get update && \ 12 | apt-get upgrade -y && \ 13 | apt-get install -y git-core build-essential wget 14 | 15 | RUN apt-get install -y --no-install-recommends \ 16 | autotools-dev libtool pkg-config zlib1g-dev \ 17 | libcunit1-dev libssl-dev libxml2-dev libevent-dev \ 18 | automake autoconf 19 | 20 | # The list of packages nghttp2 recommends for h2load: 21 | RUN apt-get install -y --no-install-recommends make binutils \ 22 | autoconf automake autotools-dev \ 23 | libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \ 24 | libev-dev libevent-dev libjansson-dev libjemalloc-dev \ 25 | cython python3.4-dev python-setuptools 26 | 27 | # Note: setting NGHTTP2_VER before the git clone, so an old git clone isn't cached: 28 | ENV NGHTTP2_VER 895da9a 29 | RUN cd /root && git clone https://github.com/tatsuhiro-t/nghttp2.git 30 | 31 | WORKDIR /root/nghttp2 32 | RUN git reset --hard $NGHTTP2_VER 33 | RUN autoreconf -i 34 | RUN automake 35 | RUN autoconf 36 | RUN ./configure 37 | RUN make 38 | RUN make install 39 | 40 | WORKDIR /root 41 | RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz 42 | RUN tar -zxvf curl-7.45.0.tar.gz 43 | WORKDIR /root/curl-7.45.0 44 | RUN ./configure --with-ssl --with-nghttp2=/usr/local 45 | RUN make 46 | RUN make install 47 | RUN ldconfig 48 | 49 | CMD ["-h"] 50 | ENTRYPOINT ["/usr/local/bin/curl"] 51 | 52 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/Makefile: -------------------------------------------------------------------------------- 1 | curlimage: 2 | docker build -t gohttp2/curl . 3 | 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/README: -------------------------------------------------------------------------------- 1 | This is a work-in-progress HTTP/2 implementation for Go. 2 | 3 | It will eventually live in the Go standard library and won't require 4 | any changes to your code to use. It will just be automatic. 5 | 6 | Status: 7 | 8 | * The server support is pretty good. A few things are missing 9 | but are being worked on. 10 | * The client work has just started but shares a lot of code 11 | is coming along much quicker. 12 | 13 | Docs are at https://godoc.org/golang.org/x/net/http2 14 | 15 | Demo test server at https://http2.golang.org/ 16 | 17 | Help & bug reports welcome! 18 | 19 | Contributing: https://golang.org/doc/contribute.html 20 | Bugs: https://golang.org/issue/new?title=x/net/http2:+ 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/fixed_buffer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package http2 6 | 7 | import ( 8 | "errors" 9 | ) 10 | 11 | // fixedBuffer is an io.ReadWriter backed by a fixed size buffer. 12 | // It never allocates, but moves old data as new data is written. 13 | type fixedBuffer struct { 14 | buf []byte 15 | r, w int 16 | } 17 | 18 | var ( 19 | errReadEmpty = errors.New("read from empty fixedBuffer") 20 | errWriteFull = errors.New("write on full fixedBuffer") 21 | ) 22 | 23 | // Read copies bytes from the buffer into p. 24 | // It is an error to read when no data is available. 25 | func (b *fixedBuffer) Read(p []byte) (n int, err error) { 26 | if b.r == b.w { 27 | return 0, errReadEmpty 28 | } 29 | n = copy(p, b.buf[b.r:b.w]) 30 | b.r += n 31 | if b.r == b.w { 32 | b.r = 0 33 | b.w = 0 34 | } 35 | return n, nil 36 | } 37 | 38 | // Len returns the number of bytes of the unread portion of the buffer. 39 | func (b *fixedBuffer) Len() int { 40 | return b.w - b.r 41 | } 42 | 43 | // Write copies bytes from p into the buffer. 44 | // It is an error to write more data than the buffer can hold. 45 | func (b *fixedBuffer) Write(p []byte) (n int, err error) { 46 | // Slide existing data to beginning. 47 | if b.r > 0 && len(p) > len(b.buf)-b.w { 48 | copy(b.buf, b.buf[b.r:b.w]) 49 | b.w -= b.r 50 | b.r = 0 51 | } 52 | 53 | // Write new data. 54 | n = copy(b.buf[b.w:], p) 55 | b.w += n 56 | if n < len(p) { 57 | err = errWriteFull 58 | } 59 | return n, err 60 | } 61 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/flow.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Flow control 6 | 7 | package http2 8 | 9 | // flow is the flow control window's size. 10 | type flow struct { 11 | // n is the number of DATA bytes we're allowed to send. 12 | // A flow is kept both on a conn and a per-stream. 13 | n int32 14 | 15 | // conn points to the shared connection-level flow that is 16 | // shared by all streams on that conn. It is nil for the flow 17 | // that's on the conn directly. 18 | conn *flow 19 | } 20 | 21 | func (f *flow) setConnFlow(cf *flow) { f.conn = cf } 22 | 23 | func (f *flow) available() int32 { 24 | n := f.n 25 | if f.conn != nil && f.conn.n < n { 26 | n = f.conn.n 27 | } 28 | return n 29 | } 30 | 31 | func (f *flow) take(n int32) { 32 | if n > f.available() { 33 | panic("internal error: took too much") 34 | } 35 | f.n -= n 36 | if f.conn != nil { 37 | f.conn.n -= n 38 | } 39 | } 40 | 41 | // add adds n bytes (positive or negative) to the flow control window. 42 | // It returns false if the sum would exceed 2^31-1. 43 | func (f *flow) add(n int32) bool { 44 | remain := (1<<31 - 1) - f.n 45 | if n > remain { 46 | return false 47 | } 48 | f.n += n 49 | return true 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/cmd/cover/README: -------------------------------------------------------------------------------- 1 | NOTE: For Go releases 1.5 and later, this tool lives in the 2 | standard repository. The code here is not maintained. 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/cmd/cover/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Cover is a program for analyzing the coverage profiles generated by 7 | 'go test -coverprofile=cover.out'. 8 | 9 | Cover is also used by 'go test -cover' to rewrite the source code with 10 | annotations to track which parts of each function are executed. 11 | It operates on one Go source file at a time, computing approximate 12 | basic block information by studying the source. It is thus more portable 13 | than binary-rewriting coverage tools, but also a little less capable. 14 | For instance, it does not probe inside && and || expressions, and can 15 | be mildly confused by single statements with multiple function literals. 16 | 17 | For usage information, please see: 18 | go help testflag 19 | go tool cover -help 20 | 21 | No longer maintained: 22 | 23 | For Go releases 1.5 and later, this tool lives in the 24 | standard repository. The code here is not maintained. 25 | 26 | */ 27 | package main // import "golang.org/x/tools/cmd/cover" 28 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to grpc! Here is some guideline 4 | and information about how to do so. 5 | 6 | ## Getting started 7 | 8 | ### Legal requirements 9 | 10 | In order to protect both you and ourselves, you will need to sign the 11 | [Contributor License Agreement](https://cla.developers.google.com/clas). 12 | 13 | ### Filing Issues 14 | When filing an issue, make sure to answer these five questions: 15 | 16 | 1. What version of Go are you using (`go version`)? 17 | 2. What operating system and processor architecture are you using? 18 | 3. What did you do? 19 | 4. What did you expect to see? 20 | 5. What did you see instead? 21 | 22 | ### Contributing code 23 | Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file. 24 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: \ 2 | all \ 3 | deps \ 4 | updatedeps \ 5 | testdeps \ 6 | updatetestdeps \ 7 | build \ 8 | proto \ 9 | test \ 10 | testrace \ 11 | clean \ 12 | 13 | all: test testrace 14 | 15 | deps: 16 | go get -d -v google.golang.org/grpc/... 17 | 18 | updatedeps: 19 | go get -d -v -u -f google.golang.org/grpc/... 20 | 21 | testdeps: 22 | go get -d -v -t google.golang.org/grpc/... 23 | 24 | updatetestdeps: 25 | go get -d -v -t -u -f google.golang.org/grpc/... 26 | 27 | build: deps 28 | go build google.golang.org/grpc/... 29 | 30 | proto: 31 | @ if ! which protoc > /dev/null; then \ 32 | echo "error: protoc not installed" >&2; \ 33 | exit 1; \ 34 | fi 35 | go get -v github.com/golang/protobuf/protoc-gen-go 36 | for file in $$(git ls-files '*.proto'); do \ 37 | protoc -I $$(dirname $$file) --go_out=plugins=grpc:$$(dirname $$file) $$file; \ 38 | done 39 | 40 | test: testdeps 41 | go test -v -cpu 1,4 google.golang.org/grpc/... 42 | 43 | testrace: testdeps 44 | go test -v -race -cpu 1,4 google.golang.org/grpc/... 45 | 46 | clean: 47 | go clean google.golang.org/grpc/... 48 | 49 | coverage: testdeps 50 | goveralls -v google.golang.org/grpc/... 51 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the GRPC project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of GRPC, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of GRPC. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of GRPC or any code incorporated within this 19 | implementation of GRPC constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of GRPC 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/README.md: -------------------------------------------------------------------------------- 1 | #gRPC-Go 2 | 3 | [![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) 4 | 5 | The Go implementation of [gRPC](http://www.grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the [gRPC Quick Start](http://www.grpc.io/docs/) guide. 6 | 7 | Installation 8 | ------------ 9 | 10 | To install this package, you need to install Go 1.4 or above and setup your Go workspace on your computer. The simplest way to install the library is to run: 11 | 12 | ``` 13 | $ go get google.golang.org/grpc 14 | ``` 15 | 16 | Prerequisites 17 | ------------- 18 | 19 | This requires Go 1.4 or above. 20 | 21 | Constraints 22 | ----------- 23 | The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the [list](http://godoc.org/google.golang.org/grpc?imports), you need a discussion with gRPC-Go authors and consultants. 24 | 25 | Documentation 26 | ------------- 27 | See [API documentation](https://godoc.org/google.golang.org/grpc) for package and API descriptions and find examples in the [examples directory](examples/). 28 | 29 | Status 30 | ------ 31 | Beta release 32 | 33 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codegen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script serves as an example to demonstrate how to generate the gRPC-Go 4 | # interface and the related messages from .proto file. 5 | # 6 | # It assumes the installation of i) Google proto buffer compiler at 7 | # https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen 8 | # plugin at https://github.com/golang/protobuf (after 2015-02-20). If you have 9 | # not, please install them first. 10 | # 11 | # We recommend running this script at $GOPATH/src. 12 | # 13 | # If this is not what you need, feel free to make your own scripts. Again, this 14 | # script is for demonstration purpose. 15 | # 16 | proto=$1 17 | protoc --go_out=plugins=grpc:. $proto 18 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codes/code_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=Code; DO NOT EDIT 2 | 3 | package codes 4 | 5 | import "fmt" 6 | 7 | const _Code_name = "OKCanceledUnknownInvalidArgumentDeadlineExceededNotFoundAlreadyExistsPermissionDeniedResourceExhaustedFailedPreconditionAbortedOutOfRangeUnimplementedInternalUnavailableDataLossUnauthenticated" 8 | 9 | var _Code_index = [...]uint8{0, 2, 10, 17, 32, 48, 56, 69, 85, 102, 120, 127, 137, 150, 158, 169, 177, 192} 10 | 11 | func (i Code) String() string { 12 | if i+1 >= Code(len(_Code_index)) { 13 | return fmt.Sprintf("Code(%d)", i) 14 | } 15 | return _Code_name[_Code_index[i]:_Code_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package grpc implements an RPC system called gRPC. 3 | 4 | See https://github.com/grpc/grpc for more information about gRPC. 5 | */ 6 | package grpc // import "google.golang.org/grpc" 7 | -------------------------------------------------------------------------------- /vendor/google/protobuf/empty.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. 2 | // source: google/protobuf/empty.proto 3 | // DO NOT EDIT! 4 | 5 | /* 6 | Package google_protobuf is a generated protocol buffer package. 7 | 8 | It is generated from these files: 9 | google/protobuf/empty.proto 10 | 11 | It has these top-level messages: 12 | Empty 13 | */ 14 | package google_protobuf 15 | 16 | import proto "github.com/golang/protobuf/proto" 17 | import fmt "fmt" 18 | import math "math" 19 | 20 | // Reference imports to suppress errors if they are not otherwise used. 21 | var _ = proto.Marshal 22 | var _ = fmt.Errorf 23 | var _ = math.Inf 24 | 25 | // A generic empty message that you can re-use to avoid defining duplicated 26 | // empty messages in your APIs. A typical example is to use it as the request 27 | // or the response type of an API method. For instance: 28 | // 29 | // service Foo { 30 | // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 31 | // } 32 | // 33 | // The JSON representation for `Empty` is empty JSON object `{}`. 34 | type Empty struct { 35 | } 36 | 37 | func (m *Empty) Reset() { *m = Empty{} } 38 | func (m *Empty) String() string { return proto.CompactTextString(m) } 39 | func (*Empty) ProtoMessage() {} 40 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | --------------------------------------------------------------------------------