├── .gitignore
├── Godeps
├── Godeps.json
└── Readme
├── LICENSE
├── LICENSE_OF_DEPENDENCIES.md
├── README.md
├── api_tests
├── admin_auth_test.go
├── admin_channels_test.go
├── admin_config_test.go
├── admin_dashboards_test.go
├── admin_device_test.go
├── api_device_test.go
├── api_tests.go
├── device_http_test.go
└── device_ws_test.go
├── assets
├── .keep
└── index.html
├── auto_test.sh
├── benchmark
└── benchmark.go
├── configs
├── config.go
├── config_test.go
├── defaults.go
├── eywa.example.yml
├── eywa_development.yml
└── eywa_test.yml
├── connections
├── bench_cm_test.go
├── connection.go
├── connection_manager.go
├── connection_manager_test.go
├── connections.go
├── http_connection.go
├── http_connection_test.go
├── http_message.go
├── http_message_test.go
├── message.go
├── middleware.go
├── middleware_test.go
├── race_test.go
├── websocket_connection.go
├── websocket_connection_test.go
├── websocket_message.go
└── websocket_message_test.go
├── db
└── .keep
├── handlers
├── auth_handlers.go
├── channel_handlers.go
├── config_handlers.go
├── connection_handlers.go
├── dashboard_handlers.go
├── device_http_handlers.go
├── device_ws_handlers.go
├── greeting_handler.go
├── handlers.go
├── heartbeat_handlers.go
├── query_handlers.go
├── summary_handlers.go
└── tail_handler.go
├── loggers
└── loggers.go
├── logs
├── .keep
├── development
│ └── .keep
└── test
│ └── .keep
├── message_handlers
├── indexer.go
├── logger.go
└── message_handlers.go
├── middlewares
├── access_logging.go
├── admin_authenticater.go
└── api_authenticator.go
├── migrate.go
├── models
├── auth_token.go
├── auth_token_test.go
├── channel.go
├── channel_test.go
├── connection_status.go
├── dashboard.go
├── dashboard_test.go
├── db.go
├── db_test.go
├── index_client.go
├── point.go
├── raw_query.go
├── series_query.go
├── stats_query.go
├── string.go
└── value_query.go
├── presenters
├── channel.go
└── dashboard.go
├── pubsub
├── cowsay.go
├── publisher.go
├── pubsub.go
└── subscriber.go
├── routes.go
├── serve.go
├── server.go
├── setup_es.go
├── templates
└── request.tmpl
├── tmp
└── pids
│ └── .keep
├── tools
├── eywa_tools.rb
├── eywa_tools_new.rb
├── profile
│ └── profile.json
└── templates
│ └── template.json
├── utils
├── assign.go
├── assign_test.go
├── atomic_bool.go
├── cache.go
├── error_handlers.go
├── map.go
├── marshal_error.go
├── query.go
├── render.go
├── slices.go
├── strings.go
├── template_parser.go
└── time.go
└── vendor
├── github.com
├── BurntSushi
│ └── toml
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── 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
├── bitly
│ └── go-simplejson
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── simplejson.go
│ │ ├── simplejson_go10.go
│ │ └── simplejson_go11.go
├── elithrar
│ └── simple-scrypt
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── scrypt.go
├── emitter
│ ├── .codeclimate.yml
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── emitter.go
│ ├── event.go
│ ├── group.go
│ ├── pattern.go
│ └── wercker.yml
├── google
│ └── btree
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── btree.go
│ │ └── btree_mem.go
├── gorilla
│ └── websocket
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── AUTHORS
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── client.go
│ │ ├── compression.go
│ │ ├── conn.go
│ │ ├── conn_read.go
│ │ ├── conn_read_legacy.go
│ │ ├── doc.go
│ │ ├── json.go
│ │ ├── mask.go
│ │ ├── server.go
│ │ └── util.go
├── jinzhu
│ ├── gorm
│ │ ├── .codeclimate.yml
│ │ ├── CONTRIBUTING.md
│ │ ├── License
│ │ ├── README.md
│ │ ├── association.go
│ │ ├── callback.go
│ │ ├── callback_create.go
│ │ ├── callback_delete.go
│ │ ├── callback_query.go
│ │ ├── callback_shared.go
│ │ ├── callback_update.go
│ │ ├── common_dialect.go
│ │ ├── dialect.go
│ │ ├── errors.go
│ │ ├── field.go
│ │ ├── foundation.go
│ │ ├── interface.go
│ │ ├── join_table_handler.go
│ │ ├── logger.go
│ │ ├── main.go
│ │ ├── main_private.go
│ │ ├── model.go
│ │ ├── model_struct.go
│ │ ├── mssql.go
│ │ ├── mysql.go
│ │ ├── postgres.go
│ │ ├── preload.go
│ │ ├── scope.go
│ │ ├── scope_private.go
│ │ ├── search.go
│ │ ├── sqlite3.go
│ │ ├── test_all.sh
│ │ ├── utils.go
│ │ └── utils_private.go
│ └── inflection
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── inflections.go
├── jtolds
│ └── gls
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── context.go
│ │ ├── gen_sym.go
│ │ ├── id_pool.go
│ │ └── stack_tags.go
├── kr
│ ├── pretty
│ │ ├── .gitignore
│ │ ├── License
│ │ ├── Readme
│ │ ├── diff.go
│ │ ├── formatter.go
│ │ ├── pretty.go
│ │ └── zero.go
│ └── text
│ │ ├── License
│ │ ├── Readme
│ │ ├── doc.go
│ │ ├── indent.go
│ │ └── wrap.go
├── lib
│ └── pq
│ │ ├── LICENSE.md
│ │ └── hstore
│ │ └── hstore.go
├── magiconair
│ └── properties
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── doc.go
│ │ ├── lex.go
│ │ ├── load.go
│ │ ├── parser.go
│ │ ├── properties.go
│ │ └── rangecheck.go
├── mattn
│ └── go-sqlite3
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── backup.go
│ │ ├── callback.go
│ │ ├── doc.go
│ │ ├── error.go
│ │ ├── sqlite3-binding.c
│ │ ├── sqlite3-binding.h
│ │ ├── sqlite3.go
│ │ ├── sqlite3_fts5.go
│ │ ├── sqlite3_go18.go
│ │ ├── sqlite3_icu.go
│ │ ├── sqlite3_json1.go
│ │ ├── sqlite3_libsqlite3.go
│ │ ├── sqlite3_load_extension.go
│ │ ├── sqlite3_omit_load_extension.go
│ │ ├── sqlite3_other.go
│ │ ├── sqlite3_type.go
│ │ ├── sqlite3_windows.go
│ │ ├── sqlite3ext.h
│ │ ├── tracecallback.go
│ │ └── tracecallback_noimpl.go
├── mitchellh
│ └── mapstructure
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── decode_hooks.go
│ │ ├── error.go
│ │ └── mapstructure.go
├── moul
│ └── http2curl
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── README.md
│ │ └── http2curl.go
├── mozillazg
│ └── request
│ │ ├── .editorconfig
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cookies.go
│ │ ├── doc.go
│ │ ├── form.go
│ │ ├── headers.go
│ │ ├── proxy.go
│ │ ├── proxy_go12.go
│ │ ├── redirect.go
│ │ ├── request.go
│ │ └── response.go
├── olivere
│ └── elastic
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ └── uritemplates
│ │ ├── LICENSE
│ │ ├── uritemplates.go
│ │ └── utils.go
├── parnurzeal
│ └── gorequest
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── CHANGELOG
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── main.go
├── rs
│ ├── cors
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cors.go
│ │ └── utils.go
│ └── xhandler
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── chain.go
│ │ ├── middleware.go
│ │ └── xhandler.go
├── satori
│ └── go.uuid
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── uuid.go
├── smartystreets
│ ├── assertions
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── assertions.goconvey
│ │ ├── collections.go
│ │ ├── doc.go
│ │ ├── equality.go
│ │ ├── filter.go
│ │ ├── internal
│ │ │ └── oglematchers
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .travis.yml
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── all_of.go
│ │ │ │ ├── any.go
│ │ │ │ ├── any_of.go
│ │ │ │ ├── contains.go
│ │ │ │ ├── deep_equals.go
│ │ │ │ ├── elements_are.go
│ │ │ │ ├── equals.go
│ │ │ │ ├── error.go
│ │ │ │ ├── greater_or_equal.go
│ │ │ │ ├── greater_than.go
│ │ │ │ ├── has_same_type_as.go
│ │ │ │ ├── has_substr.go
│ │ │ │ ├── identical_to.go
│ │ │ │ ├── less_or_equal.go
│ │ │ │ ├── less_than.go
│ │ │ │ ├── matcher.go
│ │ │ │ ├── matches_regexp.go
│ │ │ │ ├── new_matcher.go
│ │ │ │ ├── not.go
│ │ │ │ ├── panics.go
│ │ │ │ ├── pointee.go
│ │ │ │ └── transform_description.go
│ │ ├── messages.go
│ │ ├── panic.go
│ │ ├── quantity.go
│ │ ├── serializer.go
│ │ ├── strings.go
│ │ ├── time.go
│ │ └── type.go
│ └── goconvey
│ │ ├── LICENSE.md
│ │ └── convey
│ │ ├── assertions.go
│ │ ├── context.go
│ │ ├── convey.goconvey
│ │ ├── discovery.go
│ │ ├── doc.go
│ │ ├── gotest
│ │ └── utils.go
│ │ ├── init.go
│ │ ├── nilReporter.go
│ │ └── reporting
│ │ ├── console.go
│ │ ├── doc.go
│ │ ├── dot.go
│ │ ├── gotest.go
│ │ ├── init.go
│ │ ├── json.go
│ │ ├── printer.go
│ │ ├── problems.go
│ │ ├── reporter.go
│ │ ├── reporting.goconvey
│ │ ├── reports.go
│ │ ├── statistics.go
│ │ └── story.go
├── speps
│ └── go-hashids
│ │ ├── .editorconfig
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── hashids.go
├── spf13
│ ├── cast
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── cast.go
│ │ └── caste.go
│ ├── jwalterweatherman
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── thatswhyyoualwaysleaveanote.go
│ ├── pflag
│ │ ├── .travis.yml
│ │ ├── 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
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── util.go
│ │ └── viper.go
├── unrolled
│ └── render
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── buffer.go
│ │ ├── doc.go
│ │ ├── engine.go
│ │ └── render.go
├── verdverm
│ └── frisby
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── doc.go
│ │ ├── expect.go
│ │ ├── frisby.gif
│ │ ├── frisby.go
│ │ └── global.go
├── waterwheel
│ ├── .travis.yml
│ ├── LICENSE
│ ├── README.md
│ ├── async_logger.go
│ ├── buffered_writer.go
│ ├── formatters.go
│ ├── record.go
│ └── sync_logger.go
└── zenazn
│ └── goji
│ ├── LICENSE
│ ├── graceful
│ ├── einhorn.go
│ ├── graceful.go
│ ├── listener
│ │ ├── conn.go
│ │ ├── listener.go
│ │ └── shard.go
│ ├── middleware.go
│ ├── serve.go
│ ├── serve13.go
│ ├── server.go
│ └── signal.go
│ └── web
│ ├── atomic.go
│ ├── atomic_appengine.go
│ ├── bytecode_compiler.go
│ ├── bytecode_runner.go
│ ├── chanpool.go
│ ├── cpool.go
│ ├── func_equal.go
│ ├── handler.go
│ ├── match.go
│ ├── middleware.go
│ ├── middleware
│ ├── envinit.go
│ ├── logger.go
│ ├── middleware.go
│ ├── nocache.go
│ ├── options.go
│ ├── realip.go
│ ├── recoverer.go
│ ├── request_id.go
│ ├── subrouter.go
│ └── terminal.go
│ ├── mutil
│ ├── mutil.go
│ └── writer_proxy.go
│ ├── mux.go
│ ├── pattern.go
│ ├── regexp_pattern.go
│ ├── router.go
│ ├── string_pattern.go
│ └── web.go
├── golang.org
└── x
│ ├── crypto
│ ├── AUTHORS
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── PATENTS
│ ├── pbkdf2
│ │ └── pbkdf2.go
│ └── scrypt
│ │ └── scrypt.go
│ └── net
│ ├── AUTHORS
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── PATENTS
│ ├── context
│ └── context.go
│ ├── proxy
│ ├── direct.go
│ ├── per_host.go
│ ├── proxy.go
│ └── socks5.go
│ └── publicsuffix
│ ├── gen.go
│ ├── list.go
│ └── table.go
└── gopkg.in
├── natefinch
└── lumberjack.v2
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── chown.go
│ ├── chown_linux.go
│ └── lumberjack.go
├── olivere
└── elastic.v3
│ ├── .gitignore
│ ├── .travis.yml
│ ├── CHANGELOG-3.0.md
│ ├── CONTRIBUTING.md
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── README.md
│ ├── bulk.go
│ ├── bulk_delete_request.go
│ ├── bulk_index_request.go
│ ├── bulk_request.go
│ ├── bulk_update_request.go
│ ├── canonicalize.go
│ ├── clear_scroll.go
│ ├── client.go
│ ├── cluster_health.go
│ ├── cluster_state.go
│ ├── cluster_stats.go
│ ├── connection.go
│ ├── count.go
│ ├── decoder.go
│ ├── delete.go
│ ├── delete_by_query.go
│ ├── delete_template.go
│ ├── doc.go
│ ├── errors.go
│ ├── exists.go
│ ├── explain.go
│ ├── fetch_source_context.go
│ ├── geo_point.go
│ ├── get.go
│ ├── get_template.go
│ ├── highlight.go
│ ├── index.go
│ ├── indices_close.go
│ ├── indices_create.go
│ ├── indices_delete.go
│ ├── indices_delete_template.go
│ ├── indices_delete_warmer.go
│ ├── indices_exists.go
│ ├── indices_exists_template.go
│ ├── indices_exists_type.go
│ ├── indices_flush.go
│ ├── indices_forcemerge.go
│ ├── indices_get.go
│ ├── indices_get_aliases.go
│ ├── indices_get_mapping.go
│ ├── indices_get_settings.go
│ ├── indices_get_template.go
│ ├── indices_get_warmer.go
│ ├── indices_open.go
│ ├── indices_put_alias.go
│ ├── indices_put_mapping.go
│ ├── indices_put_template.go
│ ├── indices_put_warmer.go
│ ├── indices_refresh.go
│ ├── indices_stats.go
│ ├── inner_hit.go
│ ├── mget.go
│ ├── msearch.go
│ ├── nodes_info.go
│ ├── optimize.go
│ ├── percolate.go
│ ├── ping.go
│ ├── plugins.go
│ ├── query.go
│ ├── reindexer.go
│ ├── request.go
│ ├── rescore.go
│ ├── rescorer.go
│ ├── response.go
│ ├── scan.go
│ ├── script.go
│ ├── scroll.go
│ ├── search.go
│ ├── search_aggs.go
│ ├── search_aggs_bucket_children.go
│ ├── search_aggs_bucket_date_histogram.go
│ ├── search_aggs_bucket_date_range.go
│ ├── search_aggs_bucket_filter.go
│ ├── search_aggs_bucket_filters.go
│ ├── search_aggs_bucket_geo_distance.go
│ ├── search_aggs_bucket_global.go
│ ├── search_aggs_bucket_histogram.go
│ ├── search_aggs_bucket_missing.go
│ ├── search_aggs_bucket_nested.go
│ ├── search_aggs_bucket_range.go
│ ├── search_aggs_bucket_significant_terms.go
│ ├── search_aggs_bucket_terms.go
│ ├── search_aggs_metrics_avg.go
│ ├── search_aggs_metrics_cardinality.go
│ ├── search_aggs_metrics_extended_stats.go
│ ├── search_aggs_metrics_geo_bounds.go
│ ├── search_aggs_metrics_max.go
│ ├── search_aggs_metrics_min.go
│ ├── search_aggs_metrics_percentile_ranks.go
│ ├── search_aggs_metrics_percentiles.go
│ ├── search_aggs_metrics_stats.go
│ ├── search_aggs_metrics_sum.go
│ ├── search_aggs_metrics_top_hits.go
│ ├── search_aggs_metrics_value_count.go
│ ├── search_aggs_pipeline_avg_bucket.go
│ ├── search_aggs_pipeline_bucket_script.go
│ ├── search_aggs_pipeline_bucket_selector.go
│ ├── search_aggs_pipeline_cumulative_sum.go
│ ├── search_aggs_pipeline_derivative.go
│ ├── search_aggs_pipeline_max_bucket.go
│ ├── search_aggs_pipeline_min_bucket.go
│ ├── search_aggs_pipeline_mov_avg.go
│ ├── search_aggs_pipeline_serial_diff.go
│ ├── search_aggs_pipeline_sum_bucket.go
│ ├── search_queries_bool.go
│ ├── search_queries_boosting.go
│ ├── search_queries_common_terms.go
│ ├── search_queries_constant_score.go
│ ├── search_queries_dis_max.go
│ ├── search_queries_exists.go
│ ├── search_queries_fsq.go
│ ├── search_queries_fsq_score_funcs.go
│ ├── search_queries_fuzzy.go
│ ├── search_queries_geo_bounding_box.go
│ ├── search_queries_geo_distance.go
│ ├── search_queries_geo_polygon.go
│ ├── search_queries_has_child.go
│ ├── search_queries_has_parent.go
│ ├── search_queries_ids.go
│ ├── search_queries_indices.go
│ ├── search_queries_match.go
│ ├── search_queries_match_all.go
│ ├── search_queries_missing.go
│ ├── search_queries_more_like_this.go
│ ├── search_queries_multi_match.go
│ ├── search_queries_nested.go
│ ├── search_queries_not.go
│ ├── search_queries_prefix.go
│ ├── search_queries_query_string.go
│ ├── search_queries_range.go
│ ├── search_queries_regexp.go
│ ├── search_queries_script.go
│ ├── search_queries_simple_query_string.go
│ ├── search_queries_template_query.go
│ ├── search_queries_term.go
│ ├── search_queries_terms.go
│ ├── search_queries_type.go
│ ├── search_queries_wildcard.go
│ ├── search_request.go
│ ├── search_source.go
│ ├── search_template.go
│ ├── sort.go
│ ├── suggest.go
│ ├── suggest_field.go
│ ├── suggester.go
│ ├── suggester_completion.go
│ ├── suggester_completion_fuzzy.go
│ ├── suggester_context.go
│ ├── suggester_context_category.go
│ ├── suggester_context_geo.go
│ ├── suggester_phrase.go
│ ├── suggester_term.go
│ ├── termvectors.go
│ ├── update.go
│ └── uritemplates
│ ├── LICENSE
│ ├── uritemplates.go
│ └── utils.go
└── 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
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | eywa
3 | dump.rdb
4 | *.log
5 | tests/tests
6 | *.db
7 | *.pid
8 | benchmark
9 |
--------------------------------------------------------------------------------
/Godeps/Readme:
--------------------------------------------------------------------------------
1 | This directory tree is generated automatically by godep.
2 |
3 | Please do not edit.
4 |
5 | See https://github.com/tools/godep for more information.
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-NOW Vivowares Inc.
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 |
--------------------------------------------------------------------------------
/api_tests/admin_auth_test.go:
--------------------------------------------------------------------------------
1 | // +build integration
2 |
3 | package api_tests
4 |
5 | import (
6 | "encoding/json"
7 | "fmt"
8 | "github.com/bitly/go-simplejson"
9 | . "github.com/smartystreets/goconvey/convey"
10 | "github.com/verdverm/frisby"
11 | . "github.com/eywa/configs"
12 | . "github.com/eywa/utils"
13 | "net/http"
14 | "testing"
15 | "time"
16 | )
17 |
18 | func UserLoginPath() string {
19 | return fmt.Sprintf("%s/%s", ApiServer, "admin/login")
20 | }
21 |
22 | func TestAdminAuthLogin(t *testing.T) {
23 |
24 | frisby.Global.SetHeader("Content-Type", "application/json").
25 | SetHeader("Accept", "application/json")
26 |
27 | Convey("successfully login the user and get the auth token", t, func() {
28 | f := frisby.Create("user login").
29 | BasicAuth(Config().Security.Dashboard.Username, Config().Security.Dashboard.Password).
30 | Get(UserLoginPath()).Send()
31 |
32 | f.ExpectStatus(http.StatusOK).
33 | AfterJson(func(F *frisby.Frisby, js *simplejson.Json, err error) {
34 | So(len(js.MustMap()["auth_token"].(string)), ShouldBeGreaterThan, 0)
35 | ts, _ := js.MustMap()["expires_at"].(json.Number).Int64()
36 | exp := time.Unix(MilliSecToSec(ts), MilliSecToNano(ts))
37 | So(exp.After(time.Now().Add(-1*time.Minute).Add(Config().Security.Dashboard.TokenExpiry.Duration)), ShouldBeTrue)
38 | })
39 | })
40 |
41 | Convey("refused access without auth token", t, func() {
42 | f := frisby.Create("list channels").Get(ListChannelPath()).Send()
43 |
44 | f.ExpectStatus(http.StatusUnauthorized)
45 | })
46 |
47 | frisby.Global.PrintReport()
48 | }
49 |
--------------------------------------------------------------------------------
/api_tests/api_tests.go:
--------------------------------------------------------------------------------
1 | package api_tests
2 |
--------------------------------------------------------------------------------
/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/assets/.keep
--------------------------------------------------------------------------------
/assets/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Eywa
4 |
5 |
6 | Eywa
7 |
8 | I See You ...
9 |
10 |
--------------------------------------------------------------------------------
/configs/defaults.go:
--------------------------------------------------------------------------------
1 | package configs
2 |
3 | var DefaultConfigs = `
4 | service:
5 | host: localhost
6 | api_port: 8080
7 | device_port: 8081
8 | pid_file: /var/eywa/eywa.pid
9 | assets: {{ .eywa_home }}/assets
10 | security:
11 | dashboard:
12 | username: root
13 | password: waterISwide
14 | token_expiry: 24h
15 | aes:
16 | key: abcdefg123456789
17 | iv: 123456789abcdefg
18 | ssl:
19 | cert_file:
20 | key_file:
21 | api_key: dRiftingcLouds
22 | connections:
23 | http:
24 | timeouts:
25 | long_polling: 600s
26 | websocket:
27 | request_queue_size: 8
28 | timeouts:
29 | write: 4s
30 | read: 300s
31 | request: 4s
32 | response: 16s
33 | buffer_sizes:
34 | read: 1024
35 | write: 1024
36 | indices:
37 | disable: false
38 | host: localhost
39 | port: 9200
40 | number_of_shards: 8
41 | number_of_replicas: 0
42 | ttl_enabled: false
43 | ttl: 0s
44 | database:
45 | db_type: sqlite3
46 | db_file: /var/eywa/eywa.db
47 | logging:
48 | eywa:
49 | filename: /var/eywa/eywa.log
50 | maxsize: 1024
51 | maxage: 7
52 | maxbackups: 5
53 | level: info
54 | buffer_size: 512
55 | indices:
56 | filename: /var/eywa/indices.log
57 | maxsize: 1024
58 | maxage: 7
59 | maxbackups: 5
60 | level: warn
61 | buffer_size: 512
62 | database:
63 | filename: /var/eywa/db.log
64 | maxsize: 1024
65 | maxage: 7
66 | maxbackups: 5
67 | level: warn
68 | buffer_size: 512
69 | `
70 |
--------------------------------------------------------------------------------
/configs/eywa.example.yml:
--------------------------------------------------------------------------------
1 | service:
2 | host: localhost
3 | api_port: 8080
4 | device_port: 8081
5 | pid_file: /var/eywa/eywa.pid
6 | assets: {{ .eywa_home }}/assets
7 | security:
8 | dashboard:
9 | username: root
10 | password: waterISwide
11 | token_expiry: 24h
12 | aes:
13 | key: abcdefg123456789
14 | iv: 123456789abcdefg
15 | ssl:
16 | cert_file:
17 | key_file:
18 | api_key: dRiftingcLouds
19 | connections:
20 | http:
21 | timeouts:
22 | long_polling: 600s
23 | websocket:
24 | request_queue_size: 8
25 | timeouts:
26 | write: 4s
27 | read: 300s
28 | request: 4s
29 | response: 16s
30 | buffer_sizes:
31 | read: 1024
32 | write: 1024
33 | indices:
34 | disable: false
35 | host: localhost
36 | port: 9200
37 | number_of_shards: 8
38 | number_of_replicas: 0
39 | ttl_enabled: false
40 | ttl: 0s
41 | database:
42 | db_type: sqlite3
43 | db_file: /var/eywa/eywa.db
44 | logging:
45 | eywa:
46 | filename: /var/eywa/eywa.log
47 | maxsize: 1024
48 | maxage: 7
49 | maxbackups: 5
50 | level: info
51 | buffer_size: 512
52 | indices:
53 | filename: /var/eywa/indices.log
54 | maxsize: 1024
55 | maxage: 7
56 | maxbackups: 5
57 | level: warn
58 | buffer_size: 512
59 | database:
60 | filename: /var/eywa/db.log
61 | maxsize: 1024
62 | maxage: 7
63 | maxbackups: 5
64 | level: warn
65 | buffer_size: 512
66 |
--------------------------------------------------------------------------------
/configs/eywa_development.yml:
--------------------------------------------------------------------------------
1 | service:
2 | host: localhost
3 | api_port: 8080
4 | device_port: 8081
5 | pid_file: {{ .eywa_home }}/tmp/pids/eywa_development.pid
6 | assets: {{ .eywa_home }}/assets
7 | templates: {{ .eywa_home }}/templates
8 | security:
9 | dashboard:
10 | username: root
11 | password: waterISwide
12 | token_expiry: 24h
13 | aes:
14 | key: abcdefg123456789
15 | iv: abcdefg123456789
16 | ssl:
17 | cert_file:
18 | key_file:
19 | api_key: dRiftingcLouds
20 | connections:
21 | http:
22 | timeouts:
23 | long_polling: 600s
24 | websocket:
25 | request_queue_size: 8
26 | timeouts:
27 | write: 2s
28 | read: 300s
29 | request: 2s
30 | response: 8s
31 | buffer_sizes:
32 | read: 1024
33 | write: 1024
34 | indices:
35 | disable: false
36 | host: localhost
37 | port: 9200
38 | number_of_shards: 8
39 | number_of_replicas: 0
40 | ttl_enabled: false
41 | ttl: 336h
42 | database:
43 | db_type: sqlite3
44 | db_file: {{ .eywa_home }}/db/eywa_development.db
45 | logging:
46 | eywa:
47 | filename: {{ .eywa_home }}/logs/development/eywa.log
48 | maxsize: 1024
49 | maxage: 7
50 | maxbackups: 5
51 | level: debug
52 | buffer_size: 0
53 | indices:
54 | filename: {{ .eywa_home }}/logs/development/indices.log
55 | maxsize: 1024
56 | maxage: 7
57 | maxbackups: 5
58 | level: debug
59 | buffer_size: 0
60 | database:
61 | filename: {{ .eywa_home }}/logs/development/db.log
62 | maxsize: 1024
63 | maxage: 7
64 | maxbackups: 5
65 | level: debug
66 | buffer_size: 0
67 |
--------------------------------------------------------------------------------
/configs/eywa_test.yml:
--------------------------------------------------------------------------------
1 | service:
2 | host: localhost
3 | api_port: 9090
4 | device_port: 9091
5 | pid_file: {{ .eywa_home }}/tmp/pids/eywa_test.pid
6 | assets: {{ .eywa_home }}/assets
7 | security:
8 | dashboard:
9 | username: root
10 | password: waterISwide
11 | token_expiry: 24h
12 | aes:
13 | key: abcdefg123456789
14 | iv: abcdefg123456789
15 | ssl:
16 | cert_file:
17 | key_file:
18 | api_key: dRiftingcLouds
19 | connections:
20 | http:
21 | timeouts:
22 | long_polling: 600s
23 | websocket:
24 | request_queue_size: 8
25 | timeouts:
26 | write: 2s
27 | read: 300s
28 | request: 2s
29 | response: 8s
30 | buffer_sizes:
31 | read: 1024
32 | write: 1024
33 | indices:
34 | disable: false
35 | host: localhost
36 | port: 9200
37 | number_of_shards: 8
38 | number_of_replicas: 0
39 | ttl_enabled: false
40 | ttl: 336h
41 | database:
42 | db_type: sqlite3
43 | db_file: {{ .eywa_home }}/db/eywa_test.db
44 | logging:
45 | eywa:
46 | filename: {{ .eywa_home }}/logs/test/eywa.log
47 | maxsize: 1024
48 | maxage: 7
49 | maxbackups: 5
50 | level: debug
51 | buffer_size: 0
52 | indices:
53 | filename: {{ .eywa_home }}/logs/test/indices.log
54 | maxsize: 1024
55 | maxage: 7
56 | maxbackups: 5
57 | level: debug
58 | buffer_size: 0
59 | database:
60 | filename: {{ .eywa_home }}/logs/test/db.log
61 | maxsize: 1024
62 | maxage: 7
63 | maxbackups: 5
64 | level: debug
65 | buffer_size: 0
66 |
--------------------------------------------------------------------------------
/connections/bench_cm_test.go:
--------------------------------------------------------------------------------
1 | package connections
2 |
3 | import (
4 | . "github.com/eywa/configs"
5 | . "github.com/eywa/utils"
6 | "strconv"
7 | "testing"
8 | "time"
9 | )
10 |
11 | func BenchmarkNewHttpConnection(b *testing.B) {
12 | cm, _ := NewConnectionManager("default")
13 | defer CloseConnectionManager("default")
14 |
15 | for n := 0; n < b.N; n++ {
16 | poll := &httpConn{
17 | _type: HttpPoll,
18 | ch: make(chan []byte, 1),
19 | body: []byte("poll message"),
20 | }
21 | cm.NewHttpConnection(strconv.Itoa(n), poll, func(Connection, Message, error) {}, nil)
22 | }
23 | }
24 |
25 | func BenchmarkNewWsConnection(b *testing.B) {
26 | SetConfig(&Conf{
27 | Connections: &ConnectionsConf{
28 | Websocket: &WsConnectionConf{
29 | RequestQueueSize: 8,
30 | Timeouts: &WsConnectionTimeoutConf{
31 | Write: &JSONDuration{2 * time.Second},
32 | Read: &JSONDuration{300 * time.Second},
33 | Request: &JSONDuration{1 * time.Second},
34 | Response: &JSONDuration{2 * time.Second},
35 | },
36 | BufferSizes: &WsConnectionBufferSizeConf{
37 | Write: 1024,
38 | Read: 1024,
39 | },
40 | },
41 | },
42 | })
43 |
44 | cm, _ := NewConnectionManager("default")
45 | defer CloseConnectionManager("default")
46 |
47 | for n := 0; n < b.N; n++ {
48 | cm.NewWebsocketConnection(strconv.Itoa(n), &fakeWsConn{}, func(Connection, Message, error) {}, nil)
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/connections/message.go:
--------------------------------------------------------------------------------
1 | package connections
2 |
3 | type MessageType uint8
4 |
5 | const (
6 | TypeUploadMessage MessageType = 1 // upstream
7 | TypeRequestMessage MessageType = 2 // downstream
8 | TypeSendMessage MessageType = 3 // downstream
9 | TypeResponseMessage MessageType = 4 // upstream
10 |
11 | // these two messages are only used for connection states internally
12 | TypeConnectMessage MessageType = 8
13 | TypeDisconnectMessage MessageType = 9
14 | )
15 |
16 | var SupportedMessageTypes = map[MessageType]string{
17 | TypeUploadMessage: "upload",
18 | TypeResponseMessage: "response",
19 | TypeSendMessage: "send",
20 | TypeRequestMessage: "request",
21 | TypeConnectMessage: "connect",
22 | TypeDisconnectMessage: "disconnect",
23 | }
24 |
25 | type Message interface {
26 | Type() MessageType
27 | TypeString() string
28 | Id() string
29 | Payload() []byte
30 | Raw() []byte
31 | Marshal() ([]byte, error)
32 | Unmarshal() error
33 | }
34 |
--------------------------------------------------------------------------------
/db/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/db/.keep
--------------------------------------------------------------------------------
/handlers/auth_handlers.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "github.com/zenazn/goji/web"
5 | . "github.com/eywa/configs"
6 | "github.com/eywa/models"
7 | . "github.com/eywa/utils"
8 | "net/http"
9 | )
10 |
11 | func Login(c web.C, w http.ResponseWriter, r *http.Request) {
12 | u, p, ok := r.BasicAuth()
13 | if ok {
14 | if validateUserPassword(u, p) {
15 | auth, err := models.NewAuthToken(u, p)
16 | if err != nil {
17 | Render.JSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
18 | } else {
19 | h, err := auth.Encrypt()
20 | if err != nil {
21 | Render.JSON(w, http.StatusUnauthorized, map[string]string{"error": err.Error()})
22 | } else {
23 | Render.JSON(w, http.StatusOK, map[string]interface{}{"auth_token": h, "expires_at": NanoToMilli(auth.ExpiresAt.UTC().UnixNano())})
24 | }
25 | }
26 | } else {
27 | w.WriteHeader(http.StatusUnauthorized)
28 | }
29 | } else {
30 | Render.JSON(w, http.StatusUnauthorized, map[string]string{"error": "invalid BasicAuth header"})
31 | }
32 | }
33 |
34 | func validateUserPassword(u, p string) bool {
35 | return u == Config().Security.Dashboard.Username && p == Config().Security.Dashboard.Password
36 | }
37 |
--------------------------------------------------------------------------------
/handlers/config_handlers.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/zenazn/goji/web"
6 | "github.com/eywa/configs"
7 | . "github.com/eywa/utils"
8 | "net/http"
9 | )
10 |
11 | func GetConfig(c web.C, w http.ResponseWriter, r *http.Request) {
12 | Render.JSON(w, http.StatusOK, configs.Config())
13 | }
14 |
15 | func UpdateConfig(c web.C, w http.ResponseWriter, r *http.Request) {
16 | settings := map[string]interface{}{}
17 | decoder := json.NewDecoder(r.Body)
18 | err := decoder.Decode(&settings)
19 | if err != nil {
20 | Render.JSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
21 | return
22 | }
23 |
24 | if err = configs.Update(settings); err != nil {
25 | Render.JSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
26 | } else {
27 | Render.JSON(w, http.StatusOK, configs.Config())
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/handlers/greeting_handler.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "github.com/zenazn/goji/web"
5 | . "github.com/eywa/utils"
6 | "net/http"
7 | )
8 |
9 | func Greeting(c web.C, w http.ResponseWriter, r *http.Request) {
10 | Render.JSON(w, http.StatusOK, map[string]string{"greeting": "I See You..."})
11 | }
12 |
--------------------------------------------------------------------------------
/handlers/heartbeat_handlers.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "fmt"
5 | "github.com/zenazn/goji/web"
6 | "net/http"
7 | )
8 |
9 | func HeartBeatHttp(c web.C, w http.ResponseWriter, r *http.Request) {
10 | fmt.Fprint(w, "OK")
11 | }
12 |
13 | func HeartBeatWs(c web.C, w http.ResponseWriter, r *http.Request) {
14 | fmt.Fprint(w, "OK")
15 | }
16 |
--------------------------------------------------------------------------------
/handlers/summary_handlers.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "github.com/zenazn/goji/web"
5 | "github.com/eywa/models"
6 | . "github.com/eywa/utils"
7 | "github.com/eywa/connections"
8 | "net/http"
9 | )
10 |
11 | func GetSummary(c web.C, w http.ResponseWriter, r *http.Request) {
12 | resp := make(map[string]int);
13 |
14 | params := r.URL.Query()
15 | if len(params) == 0 {
16 | chs := models.Channels()
17 | das := models.Dashboards()
18 | _, total := connections.Counts()
19 | resp["channels"] = len(chs)
20 | resp["dashboards"] = len(das)
21 | resp["devices"] = total
22 | } else {
23 | if _, found := params["channels"]; found {
24 | chs := models.Channels()
25 | resp["channels"] = len(chs)
26 | } else if _, found = params["dashboards"]; found {
27 | das := models.Dashboards()
28 | resp["dashboards"] = len(das)
29 | } else if _, found = params["devices"]; found {
30 | _, total := connections.Counts()
31 | resp["devices"] = total
32 | } else {
33 | Render.JSON(w, http.StatusBadRequest, map[string]string{"error": "invalid request"})
34 | }
35 | }
36 |
37 | Render.JSON(w, http.StatusOK, resp)
38 | }
39 |
--------------------------------------------------------------------------------
/handlers/tail_handler.go:
--------------------------------------------------------------------------------
1 | package handlers
2 |
3 | import (
4 | "github.com/zenazn/goji/web"
5 | "github.com/eywa/pubsub"
6 | . "github.com/eywa/utils"
7 | "net/http"
8 | )
9 |
10 | func TailLog(c web.C, w http.ResponseWriter, r *http.Request) {
11 | ws, err := upgrader.Upgrade(w, r, nil)
12 | if err != nil {
13 | Render.JSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
14 | return
15 | }
16 |
17 | pubsub.NewWebsocketSubscriber(
18 | pubsub.EywaLogPublisher,
19 | ws,
20 | ).Subscribe("You are now attached to Eywa access log...")
21 | }
22 |
--------------------------------------------------------------------------------
/logs/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/logs/.keep
--------------------------------------------------------------------------------
/logs/development/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/logs/development/.keep
--------------------------------------------------------------------------------
/logs/test/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/logs/test/.keep
--------------------------------------------------------------------------------
/message_handlers/indexer.go:
--------------------------------------------------------------------------------
1 | package message_handlers
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/satori/go.uuid"
6 | "gopkg.in/olivere/elastic.v3"
7 | . "github.com/eywa/configs"
8 | . "github.com/eywa/connections"
9 | . "github.com/eywa/models"
10 | "github.com/eywa/pubsub"
11 | )
12 |
13 | var Indexer = NewMiddleware("indexer", func(h MessageHandler) MessageHandler {
14 | fn := func(c Connection, m Message, e error) {
15 | if !Config().Indices.Disable && e == nil && m != nil && (m.Type() == TypeUploadMessage || m.Type() == TypeDisconnectMessage || m.Type() == TypeConnectMessage) {
16 | if ch, found := findCachedChannel(c.ConnectionManager().Id()); found {
17 | id := uuid.NewV1().String()
18 | var p *Point
19 | p, e = NewPoint(id, ch, c, m)
20 | if e == nil {
21 | var js []byte
22 | js, e = json.Marshal(p)
23 | if e == nil {
24 | var resp *elastic.IndexResponse
25 | resp, e = IndexClient.Index().
26 | Index(TimedIndexName(ch, p.Timestamp)).
27 | Type(p.IndexType()).
28 | Id(id).
29 | BodyString(string(js)).
30 | Do()
31 |
32 | if resp != nil && resp.Created {
33 | c.(pubsub.Publisher).Publish(func() string {
34 | return format("index", js)
35 | })
36 | }
37 | }
38 | }
39 | } else {
40 | e = channelNotFound
41 | }
42 | }
43 |
44 | h(c, m, e)
45 | }
46 | return MessageHandler(fn)
47 | })
48 |
--------------------------------------------------------------------------------
/message_handlers/logger.go:
--------------------------------------------------------------------------------
1 | package message_handlers
2 |
3 | import (
4 | . "github.com/eywa/connections"
5 | "github.com/eywa/pubsub"
6 | )
7 |
8 | var Logger = NewMiddleware("logger", func(h MessageHandler) MessageHandler {
9 | fn := func(c Connection, m Message, e error) {
10 | pub := c.(pubsub.Publisher)
11 |
12 | if e != nil {
13 | pub.Publish(func() string {
14 | return format("error", []byte(e.Error()))
15 | })
16 | }
17 |
18 | if m != nil {
19 | pub.Publish(func() string {
20 | t := m.TypeString()
21 | if len(t) == 0 {
22 | t = "wrong type"
23 | }
24 |
25 | raw := []byte{}
26 | if m.Raw() != nil {
27 | raw = m.Raw()
28 | }
29 |
30 | return format(t, raw)
31 | })
32 | }
33 |
34 | h(c, m, e)
35 | }
36 | return MessageHandler(fn)
37 | })
38 |
--------------------------------------------------------------------------------
/middlewares/api_authenticator.go:
--------------------------------------------------------------------------------
1 | package middlewares
2 |
3 | import (
4 | "github.com/zenazn/goji/web"
5 | . "github.com/eywa/configs"
6 | . "github.com/eywa/utils"
7 | "net/http"
8 | )
9 |
10 | func ApiAuthenticator(c *web.C, h http.Handler) http.Handler {
11 | fn := func(w http.ResponseWriter, r *http.Request) {
12 | if len(r.Header.Get("Api-Key")) != 0 {
13 | apiKey := r.Header.Get("Api-Key")
14 | if apiKey == Config().Security.ApiKey {
15 | c.Env["api_key"] = apiKey
16 | h.ServeHTTP(w, r)
17 | } else {
18 | Render.JSON(w, http.StatusUnauthorized, map[string]string{"error": "invalid api key"})
19 | }
20 | } else {
21 | Render.JSON(w, http.StatusUnauthorized, map[string]string{"error": "empty Api-Key header"})
22 | }
23 | }
24 |
25 | return http.HandlerFunc(fn)
26 | }
27 |
--------------------------------------------------------------------------------
/migrate.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | . "github.com/eywa/models"
5 | . "github.com/eywa/utils"
6 | )
7 |
8 | func migrate() {
9 | FatalIfErr(DB.AutoMigrate(
10 | &Channel{},
11 | &Dashboard{},
12 | ).Error)
13 | }
14 |
--------------------------------------------------------------------------------
/models/auth_token_test.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | . "github.com/smartystreets/goconvey/convey"
5 | . "github.com/eywa/configs"
6 | . "github.com/eywa/utils"
7 | "reflect"
8 | "testing"
9 | "time"
10 | )
11 |
12 | func TestAuthToken(t *testing.T) {
13 | SetConfig(&Conf{
14 | Security: &SecurityConf{
15 | Dashboard: &DashboardSecurityConf{
16 | Username: "test_user",
17 | Password: "test_password",
18 | TokenExpiry: &JSONDuration{24 * time.Hour},
19 | AES: &AESConf{
20 | KEY: "abcdefg123456789",
21 | IV: "abcdefg123456789",
22 | },
23 | },
24 | },
25 | })
26 |
27 | Convey("encrypts/decrypts auth token", t, func() {
28 | t, e := NewAuthToken("test_user", "test_password")
29 | So(e, ShouldBeNil)
30 | h, e := t.Encrypt()
31 | So(e, ShouldBeNil)
32 | _t, e := DecryptAuthToken(h)
33 | So(e, ShouldBeNil)
34 | So(reflect.DeepEqual(t, _t), ShouldBeTrue)
35 | })
36 | }
37 |
--------------------------------------------------------------------------------
/models/dashboard.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | "errors"
5 | )
6 |
7 | type Dashboard struct {
8 | Id int `sql:"type:integer" json:"id"`
9 | Name string `sql:"type:varchar(255)" json:"name"`
10 | Description string `sql:"type:text" json:"description"`
11 | Definition string `sql:"type:text" json:"definition"`
12 | }
13 |
14 | func (d *Dashboard) BeforeSave() error {
15 | if len(d.Name) == 0 {
16 | return errors.New("name is empty")
17 | }
18 |
19 | if len(d.Description) == 0 {
20 | return errors.New("description is empty")
21 | }
22 |
23 | return nil
24 | }
25 |
26 | func (d *Dashboard) Create() error {
27 | return DB.Create(d).Error
28 | }
29 |
30 | func (d *Dashboard) Delete() error {
31 | return DB.Delete(d).Error
32 | }
33 |
34 | func (d *Dashboard) Update() error {
35 | return DB.Save(d).Error
36 | }
37 |
38 | func (d *Dashboard) FindById(id int) bool {
39 | DB.First(d, id)
40 | return !DB.NewRecord(d)
41 | }
42 |
43 | func Dashboards() []*Dashboard {
44 | dashs := []*Dashboard{}
45 | DB.Find(&dashs)
46 | return dashs
47 | }
48 |
--------------------------------------------------------------------------------
/models/dashboard_test.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | . "github.com/smartystreets/goconvey/convey"
5 | . "github.com/eywa/configs"
6 | "log"
7 | "os"
8 | "path"
9 | "testing"
10 | )
11 |
12 | func TestDashboard(t *testing.T) {
13 | pwd, _ := os.Getwd()
14 | dbFile := path.Join(pwd, "eywa_test.db")
15 |
16 | SetConfig(&Conf{
17 | Database: &DbConf{
18 | DbType: "sqlite3",
19 | DbFile: dbFile,
20 | },
21 | Logging: &LogsConf{
22 | Database: &LogConf{
23 | Level: "debug",
24 | },
25 | },
26 | })
27 |
28 | InitializeDB()
29 | DB.LogMode(true)
30 | DB.SetLogger(log.New(os.Stdout, "", log.LstdFlags))
31 | DB.AutoMigrate(&Dashboard{})
32 |
33 | Convey("creates/updates/deletes dashboard", t, func() {
34 | d := &Dashboard{
35 | Name: "test",
36 | Description: "desc",
37 | Definition: "definition",
38 | }
39 |
40 | d.Create()
41 | var count int
42 | DB.Model(&Dashboard{}).Count(&count)
43 | So(count, ShouldEqual, 1)
44 |
45 | d.Name = "updated test"
46 | d.Update()
47 |
48 | _d := &Dashboard{}
49 | DB.Model(&Dashboard{}).First(_d)
50 | So(_d.Name, ShouldEqual, "updated test")
51 |
52 | d.Delete()
53 | DB.Model(&Dashboard{}).Count(&count)
54 | So(count, ShouldEqual, 0)
55 | })
56 |
57 | Convey("validates dashboard before saving", t, func() {
58 | d := &Dashboard{
59 | Name: "",
60 | Description: "desc",
61 | Definition: "def",
62 | }
63 | err := d.Create()
64 | So(err.Error(), ShouldContainSubstring, "name is empty")
65 |
66 | d.Name = "test"
67 | d.Description = ""
68 | err = d.Create()
69 | So(err.Error(), ShouldContainSubstring, "description is empty")
70 | })
71 |
72 | CloseDB()
73 | os.Remove(dbFile)
74 | }
75 |
--------------------------------------------------------------------------------
/models/db.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | "github.com/jinzhu/gorm"
5 | _ "github.com/mattn/go-sqlite3"
6 | "github.com/waterwheel"
7 | . "github.com/eywa/configs"
8 | . "github.com/eywa/loggers"
9 | )
10 |
11 | var DB *gorm.DB
12 |
13 | // Initialize database helper
14 | func InitializeDB() error {
15 | db, err := gorm.Open(Config().Database.DbType, Config().Database.DbFile)
16 | if err != nil {
17 | return err
18 | }
19 | db.LogMode(waterwheel.MapLevel(Config().Logging.Database.Level) == waterwheel.Debug)
20 | db.SetLogger(DBLogger)
21 | DB = &db
22 |
23 | return nil
24 | }
25 |
26 | func CloseDB() error {
27 | return DB.Close()
28 | }
29 |
--------------------------------------------------------------------------------
/models/db_test.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | . "github.com/smartystreets/goconvey/convey"
5 | . "github.com/eywa/configs"
6 | "os"
7 | "path"
8 | "testing"
9 | )
10 |
11 | func TestDb(t *testing.T) {
12 | pwd, _ := os.Getwd()
13 | dbFile := path.Join(pwd, "eywa_test.db")
14 |
15 | Convey("initialize database with no error", t, func() {
16 | SetConfig(&Conf{
17 | Database: &DbConf{
18 | DbType: "sqlite3",
19 | DbFile: dbFile,
20 | },
21 | Logging: &LogsConf{
22 | Database: &LogConf{
23 | Level: "debug",
24 | },
25 | },
26 | })
27 | err := InitializeDB()
28 | So(err, ShouldEqual, nil)
29 | CloseDB()
30 | })
31 |
32 | Convey("initialize database with invalid database type", t, func() {
33 | SetConfig(&Conf{
34 | Database: &DbConf{
35 | DbType: "sql",
36 | DbFile: "",
37 | },
38 | Logging: &LogsConf{
39 | Database: &LogConf{
40 | Level: "debug",
41 | },
42 | },
43 | })
44 | err := InitializeDB()
45 | So(err, ShouldNotEqual, nil)
46 | CloseDB()
47 | })
48 |
49 | os.Remove(dbFile)
50 | }
51 |
--------------------------------------------------------------------------------
/models/index_client.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | "fmt"
5 | . "gopkg.in/olivere/elastic.v3"
6 | . "github.com/eywa/configs"
7 | . "github.com/eywa/loggers"
8 | "log"
9 | "strings"
10 | )
11 |
12 | var IndexClient *Client
13 |
14 | func CloseIndexClient() error {
15 | return nil
16 | }
17 |
18 | func InitializeIndexClient() error {
19 | url := fmt.Sprintf("http://%s:%d", Config().Indices.Host, Config().Indices.Port)
20 | client, err := NewClient(
21 | SetURL(url),
22 | setLogger(ESLogger),
23 | )
24 | if err != nil {
25 | return err
26 | }
27 | _, _, err = client.Ping(url).Do()
28 | if err != nil {
29 | return err
30 | }
31 | IndexClient = client
32 | return nil
33 | }
34 |
35 | func setLogger(logger *log.Logger) func(*Client) error {
36 | switch strings.ToUpper(Config().Logging.Indices.Level) {
37 | case "INFO":
38 | return func(c *Client) error {
39 | SetInfoLog(logger)
40 | SetErrorLog(logger)
41 | return nil
42 | }
43 | case "DEBUG":
44 | return func(c *Client) error {
45 | SetInfoLog(logger)
46 | SetErrorLog(logger)
47 | SetTraceLog(logger)
48 | return nil
49 | }
50 | default:
51 | return func(c *Client) error {
52 | SetErrorLog(logger)
53 | return nil
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/models/string.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | "database/sql/driver"
5 | "encoding/json"
6 | "errors"
7 | _ "github.com/mattn/go-sqlite3"
8 | "strings"
9 | )
10 |
11 | type StringMap map[string]string
12 |
13 | func (m *StringMap) Scan(value interface{}) error {
14 | return json.Unmarshal(value.([]byte), m)
15 | }
16 |
17 | func (m StringMap) Value() (driver.Value, error) {
18 | b, err := json.Marshal(m)
19 | if err != nil {
20 | return nil, err
21 | }
22 | return string(b), nil
23 | }
24 |
25 | type StringSlice []string
26 |
27 | func (s *StringSlice) Scan(src interface{}) error {
28 | asBytes, ok := src.([]byte)
29 | if !ok {
30 | return errors.New("scan source was not []bytes")
31 | }
32 |
33 | asString := string(asBytes)
34 | if len(asString) == 0 {
35 | (*s) = StringSlice([]string{})
36 | } else {
37 | parsed := strings.Split(asString, ",")
38 | (*s) = StringSlice(parsed)
39 | }
40 |
41 | return nil
42 | }
43 |
44 | func (s StringSlice) Value() (driver.Value, error) {
45 | return strings.Join(s, ","), nil
46 | }
--------------------------------------------------------------------------------
/presenters/dashboard.go:
--------------------------------------------------------------------------------
1 | package presenters
2 |
3 | import (
4 | . "github.com/eywa/models"
5 | )
6 |
7 | type DashboardBrief struct {
8 | ID int `json:"id"`
9 | Name string `json:"name"`
10 | Description string `json:"description"`
11 | }
12 |
13 | func NewDashboardBrief(d *Dashboard) *DashboardBrief {
14 | return &DashboardBrief{
15 | ID: d.Id,
16 | Name: d.Name,
17 | Description: d.Description,
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/pubsub/cowsay.go:
--------------------------------------------------------------------------------
1 | package pubsub
2 |
3 | var cowsay = `
4 | ==============================
5 | ________ ___ _____
6 | / ____/\ \/ / | / / |
7 | / __/ \ /| | /| / / /| |
8 | / /___ / / | |/ |/ / ___ |
9 | /_____/ /_/ |__/|__/_/ |_|
10 | ==============================
11 |
12 | Welcome to Eywa!
13 | `
14 |
--------------------------------------------------------------------------------
/pubsub/publisher.go:
--------------------------------------------------------------------------------
1 | package pubsub
2 |
3 | import (
4 | "sync/atomic"
5 | )
6 |
7 | type BasicPublisher struct {
8 | attachers int32
9 |
10 | topic string
11 | }
12 |
13 | func NewBasicPublisher(topic string) *BasicPublisher {
14 | return &BasicPublisher{
15 | attachers: 0,
16 | topic: topic,
17 | }
18 | }
19 |
20 | func (p *BasicPublisher) Attach() { atomic.AddInt32(&p.attachers, 1) }
21 |
22 | func (p *BasicPublisher) Detach() { atomic.AddInt32(&p.attachers, -1) }
23 |
24 | func (p *BasicPublisher) Attached() bool { return atomic.LoadInt32(&p.attachers) > 0 }
25 |
26 | func (p *BasicPublisher) Topic() string { return p.topic }
27 |
28 | func (p *BasicPublisher) Publish(c Callback) {
29 | if p.Attached() {
30 | EM.Emit(p.Topic(), c())
31 | }
32 | }
33 |
34 | func (p *BasicPublisher) Unpublish() {
35 | EM.Off(p.Topic())
36 | }
37 |
--------------------------------------------------------------------------------
/pubsub/pubsub.go:
--------------------------------------------------------------------------------
1 | package pubsub
2 |
3 | import (
4 | "github.com/emitter"
5 | )
6 |
7 | var capacity uint = 512
8 | var EM = emitter.New(capacity)
9 | var EywaLogPublisher = NewBasicPublisher("log/eywa")
10 |
11 | func Close() {
12 | EM.Off("*")
13 | }
14 |
15 | type Publisher interface {
16 | Topic() string
17 | Attached() bool
18 | Attach()
19 | Detach()
20 | Publish(Callback)
21 | Unpublish()
22 | }
23 |
24 | type Callback func() string
25 |
--------------------------------------------------------------------------------
/templates/request.tmpl:
--------------------------------------------------------------------------------
1 | # block wrapped by "#defkey" and "#end" is a golang text/template.
2 | # "\\n" is an escape for carrior return
3 |
4 | #defkey HTTP_POST_HEADER
5 | POST /channels/devices//upload?
6 | {{ range $i, $e := .Tags }}
7 | {{ if $i }}&{{ end }}{{ $e }}=
8 | {{ end }} HTTP/1.1\n
9 | Host: :\n
10 | Content-Type: application/json\n
11 | AccessToken: \n
12 | Content-Length: \n
13 | \n
14 | #end
15 |
16 | #defkey HTTP_POST_BODY
17 | {{"{"}}{{ range $key, $value := .Fields }}{{ $key }}=,{{ end }}{{"}"}}\n
18 | #end
19 |
--------------------------------------------------------------------------------
/tmp/pids/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/tmp/pids/.keep
--------------------------------------------------------------------------------
/tools/profile/profile.json:
--------------------------------------------------------------------------------
1 | {
2 | "host": "localhost",
3 | "port": "8080",
4 | "protocol": "http",
5 | "username": "root",
6 | "password": "waterISwide"
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/tools/templates/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Room Monitor",
3 | "description": "This is an example channel created for monitoring room.",
4 | "fields": {
5 | "humidity": "int",
6 | "temperature": "float"
7 | },
8 | "tags": ["room", "floor"],
9 | "access_tokens": ["1234abcd"],
10 | "connection_limit": 5,
11 | "message_rate": 1000
12 | }
13 |
--------------------------------------------------------------------------------
/utils/atomic_bool.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "sync/atomic"
4 |
5 | type AtomBool struct{ flag int32 }
6 |
7 | func (b *AtomBool) Set(value bool) {
8 | var i int32 = 0
9 | if value {
10 | i = 1
11 | }
12 | atomic.StoreInt32(&(b.flag), int32(i))
13 | }
14 |
15 | func (b *AtomBool) Get() bool {
16 | if atomic.LoadInt32(&(b.flag)) != 0 {
17 | return true
18 | }
19 | return false
20 | }
21 |
--------------------------------------------------------------------------------
/utils/cache.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "sync"
5 | "time"
6 | )
7 |
8 | var Cache = &cache{caches: make(map[string]*expirableContent)}
9 |
10 | type cache struct {
11 | sync.Mutex
12 | caches map[string]*expirableContent
13 | }
14 |
15 | type expirableContent struct {
16 | content interface{}
17 | expiresAt time.Time
18 | }
19 |
20 | func (self *cache) Fetch(key string, dur time.Duration, f func() (interface{}, error)) (interface{}, error) {
21 | self.Lock()
22 | defer self.Unlock()
23 |
24 | if res, found := self.caches[key]; found {
25 | if res.expiresAt.After(time.Now().UTC()) {
26 | return res.content, nil
27 | } else {
28 | delete(self.caches, key)
29 | }
30 | }
31 |
32 | content, err := f()
33 | if err != nil {
34 | return nil, err
35 | }
36 |
37 | newContent := &expirableContent{content: content}
38 | newContent.expiresAt = time.Now().Add(dur)
39 |
40 | self.caches[key] = newContent
41 | return newContent.content, nil
42 | }
43 |
--------------------------------------------------------------------------------
/utils/error_handlers.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "log"
4 |
5 | func FatalIfErr(err error) {
6 | if err != nil {
7 | log.Fatalln(err.Error())
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/utils/map.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "errors"
4 |
5 | func ToStringMap(m map[interface{}]interface{}) (map[string]interface{}, error) {
6 | res := map[string]interface{}{}
7 | for k, v := range m {
8 | if kStr, ok := k.(string); ok {
9 | if vMap, ok := v.(map[interface{}]interface{}); ok {
10 | vCon, err := ToStringMap(vMap)
11 | if err != nil {
12 | return nil, err
13 | } else {
14 | res[kStr] = vCon
15 | }
16 | } else {
17 | res[kStr] = v
18 | }
19 | } else {
20 | return nil, errors.New("key in the map is not a string")
21 | }
22 | }
23 |
24 | return res, nil
25 | }
26 |
--------------------------------------------------------------------------------
/utils/marshal_error.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "encoding/json"
4 |
5 | type MarshallableErrors map[string]error
6 |
7 | func (m MarshallableErrors) MarshalJSON() ([]byte, error) {
8 | es := make(map[string]string)
9 | for key, e := range map[string]error(m) {
10 | es[key] = e.Error()
11 | }
12 |
13 | return json.Marshal(es)
14 | }
15 |
--------------------------------------------------------------------------------
/utils/query.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "net/url"
4 |
5 | func QueryToMap(values url.Values) map[string]string {
6 | q := map[string][]string(values)
7 | r := make(map[string]string)
8 | for k, v := range q {
9 | if len(v) > 0 {
10 | r[k] = v[0]
11 | }
12 | }
13 | return r
14 | }
15 |
--------------------------------------------------------------------------------
/utils/render.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "github.com/unrolled/render"
5 | )
6 |
7 | var Render *render.Render
8 |
9 | func init() {
10 | Render = render.New(render.Options{})
11 | }
12 |
--------------------------------------------------------------------------------
/utils/slices.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | func StringSliceContains(s []string, v string) bool {
4 | for _, ss := range s {
5 | if ss == v {
6 | return true
7 | }
8 | }
9 | return false
10 | }
11 |
--------------------------------------------------------------------------------
/utils/strings.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "regexp"
5 | )
6 |
7 | func AlphaNumeric(s string) bool {
8 | match, _ := regexp.MatchString("^[a-z0-9_A-Z]+$", s)
9 | return match
10 | }
11 |
--------------------------------------------------------------------------------
/utils/template_parser.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "strings"
5 | "errors"
6 | "os"
7 | "bufio"
8 | )
9 |
10 | func RequestTemplateParse(hwTmplPath string, key string, delimStart string, delimEnd string) (string, error) {
11 | template := ""
12 | openDelim := true
13 |
14 | hwTmplFile, err := os.Open(hwTmplPath)
15 | if err != nil {
16 | return "", err
17 | }
18 | defer hwTmplFile.Close()
19 |
20 | scanner := bufio.NewScanner(hwTmplFile)
21 | for scanner.Scan() {
22 | line := scanner.Text()
23 | if strings.HasPrefix(line, delimStart) && strings.Contains(line, key) {
24 | for scanner.Scan() {
25 | line = scanner.Text()
26 | if strings.HasPrefix(line, delimEnd) {
27 | openDelim = false
28 | break
29 | }
30 | if strings.HasSuffix(line, "\\n") {
31 | line = strings.Replace(line, "\\n", "\n", 1)
32 | }
33 | template += line
34 | }
35 | break
36 | }
37 | }
38 |
39 | if openDelim {
40 | return "", errors.New("Open delimiter")
41 | }
42 |
43 | return template, err;
44 | }
45 |
--------------------------------------------------------------------------------
/utils/time.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "errors"
5 | "reflect"
6 | "strconv"
7 | "time"
8 | )
9 |
10 | func MilliSecToSec(milli int64) int64 {
11 | return milli * 1000000 / int64(time.Second)
12 | }
13 |
14 | func MilliSecToNano(milli int64) int64 {
15 | return milli * 1000000 % int64(time.Second)
16 | }
17 |
18 | func NanoToMilli(nano int64) int64 {
19 | return nano / int64(time.Millisecond)
20 | }
21 |
22 | type JSONDuration struct {
23 | time.Duration
24 | }
25 |
26 | func (d *JSONDuration) MarshalJSON() ([]byte, error) {
27 | return []byte(strconv.Quote(d.String())), nil
28 | }
29 |
30 | func (d *JSONDuration) UnmarshalJSON(data []byte) error {
31 | str, err := strconv.Unquote(string(data))
32 | if err != nil {
33 | return err
34 | }
35 | _d, err := time.ParseDuration(str)
36 | if err != nil {
37 | return err
38 | }
39 |
40 | d.Duration = _d
41 | return nil
42 | }
43 |
44 | var JSONDurationAssignReader = func(v interface{}, isPtr bool) (reflect.Value, error) {
45 | var _d time.Duration
46 | var err error
47 | if f, ok := v.(float64); ok {
48 | _d = time.Duration(int64(f))
49 | } else if i, ok := v.(int64); ok {
50 | _d = time.Duration(i)
51 | } else if s, ok := v.(string); ok {
52 | _d, err = time.ParseDuration(s)
53 | if err != nil {
54 | return reflect.Value{}, err
55 | }
56 | } else {
57 | return reflect.Value{}, errors.New("interface is not a duration")
58 | }
59 |
60 | d := JSONDuration{Duration: _d}
61 | if isPtr {
62 | return reflect.ValueOf(&d), nil
63 | } else {
64 | return reflect.ValueOf(d), nil
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/vendor/github.com/BurntSushi/toml/.gitignore:
--------------------------------------------------------------------------------
1 | TAGS
2 | tags
3 | .*.swp
4 | tomlcheck/tomlcheck
5 | toml.test
6 |
--------------------------------------------------------------------------------
/vendor/github.com/BurntSushi/toml/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.1
4 | - 1.2
5 | - tip
6 | install:
7 | - go install ./...
8 | - go get github.com/BurntSushi/toml-test
9 | script:
10 | - export PATH="$PATH:$HOME/gopath/bin"
11 | - make test
12 |
13 |
--------------------------------------------------------------------------------
/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/bitly/go-simplejson/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.0.3
4 | - 1.1.2
5 | - 1.2
6 | - tip
7 | install:
8 | - go get github.com/bmizerany/assert
9 | notifications:
10 | email: false
11 |
--------------------------------------------------------------------------------
/vendor/github.com/bitly/go-simplejson/LICENSE:
--------------------------------------------------------------------------------
1 | Permission is hereby granted, free of charge, to any person obtaining a copy
2 | of this software and associated documentation files (the "Software"), to deal
3 | in the Software without restriction, including without limitation the rights
4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5 | copies of the Software, and to permit persons to whom the Software is
6 | furnished to do so, subject to the following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in
9 | all copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 | THE SOFTWARE.
18 |
--------------------------------------------------------------------------------
/vendor/github.com/bitly/go-simplejson/README.md:
--------------------------------------------------------------------------------
1 | ### go-simplejson
2 |
3 | a Go package to interact with arbitrary JSON
4 |
5 | [](http://travis-ci.org/bitly/go-simplejson)
6 |
7 | ### Importing
8 |
9 | import github.com/bitly/go-simplejson
10 |
11 | ### Documentation
12 |
13 | Visit the docs on [gopkgdoc](http://godoc.org/github.com/bitly/go-simplejson)
14 |
--------------------------------------------------------------------------------
/vendor/github.com/elithrar/simple-scrypt/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 |
26 | *.DS_Store
27 |
--------------------------------------------------------------------------------
/vendor/github.com/elithrar/simple-scrypt/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: false
3 | go:
4 | - 1.2
5 | - 1.3
6 | - 1.4
7 | - 1.5
8 | - tip
9 | install:
10 | - go get golang.org/x/tools/cmd/vet
11 | script:
12 | - go get -t -v ./...
13 | - diff -u <(echo -n) <(gofmt -d -s .)
14 | - go tool vet .
15 | - go test -v ./...
16 |
--------------------------------------------------------------------------------
/vendor/github.com/elithrar/simple-scrypt/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Matthew Silverlock (matt@eatsleeprepeat.net)
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 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/emitter/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | engines:
2 | fixme:
3 | enabled: true
4 | golint:
5 | enabled: true
6 | gofmt:
7 | enabled: true
8 | govet:
9 | enabled: true
10 | ratings:
11 | paths:
12 | - "*.go"
13 |
--------------------------------------------------------------------------------
/vendor/github.com/emitter/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | src/
3 | pkg/
4 | coverage.html
5 | Makefile
6 |
--------------------------------------------------------------------------------
/vendor/github.com/emitter/LICENSE:
--------------------------------------------------------------------------------
1 | Channel based event emitter for Golang
2 | Copyright (C) 2015 Oleg Lebedev
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the "Software"),
6 | to deal in the Software without restriction, including without limitation
7 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | and/or sell copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/emitter/pattern.go:
--------------------------------------------------------------------------------
1 | package emitter
2 |
3 | import "path"
4 |
5 | // Test returns boolean value to indicate that given pattern is valid.
6 | //
7 | // What is it for?
8 | // Internally `emitter` uses `path.Match` function to find matching. But
9 | // as this functionality is optional `Emitter` don't indicate that the
10 | // pattern is invalid. You should check it separately explicitly via
11 | // `Test` function.
12 | func Test(pattern string) bool {
13 | _, err := path.Match(pattern, "---")
14 | return err == nil
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/emitter/wercker.yml:
--------------------------------------------------------------------------------
1 | box: golang
2 | build:
3 | steps:
4 | - setup-go-workspace
5 | - wercker/golint
6 | - script:
7 | name: go get
8 | code: |
9 | cd $WERCKER_SOURCE_DIR
10 | go version
11 | go get golang.org/x/tools/cmd/cover
12 | go get github.com/mattn/goveralls
13 | - script:
14 | name: go test
15 | code: |
16 | go test . -v -race
17 | go test . -v -covermode=count -coverprofile=profile.cov
18 | goveralls -coverprofile=profile.cov -service=wercker -repotoken=$COVERALLS_TOKEN
19 |
--------------------------------------------------------------------------------
/vendor/github.com/google/btree/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
--------------------------------------------------------------------------------
/vendor/github.com/google/btree/README.md:
--------------------------------------------------------------------------------
1 | # BTree implementation for Go
2 |
3 | 
4 |
5 | This package provides an in-memory B-Tree implementation for Go, useful as a
6 | an ordered, mutable data structure.
7 |
8 | The API is based off of the wonderful
9 | http://godoc.org/github.com/petar/GoLLRB/llrb, and is meant to allow btree to
10 | act as a drop-in replacement for gollrb trees.
11 |
12 | See http://godoc.org/github.com/google/btree for documentation.
13 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
24 | .idea/
25 | *.iml
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: false
3 |
4 | matrix:
5 | include:
6 | - go: 1.4
7 | - go: 1.5
8 | - go: 1.6
9 | - go: 1.7
10 | - go: tip
11 | allow_failures:
12 | - go: tip
13 |
14 | script:
15 | - go get -t -v ./...
16 | - diff -u <(echo -n) <(gofmt -d .)
17 | - go vet $(go list ./... | grep -v /vendor/)
18 | - go test -v -race ./...
19 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the official list of Gorilla WebSocket authors for copyright
2 | # purposes.
3 | #
4 | # Please keep the list sorted.
5 |
6 | Gary Burd
7 | Joachim Bauch
8 |
9 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 The Gorilla WebSocket 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 met:
5 |
6 | Redistributions of source code must retain the above copyright notice, this
7 | list of conditions and the following disclaimer.
8 |
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/gorilla/websocket/conn_read.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket 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.5
6 |
7 | package websocket
8 |
9 | import "io"
10 |
11 | func (c *Conn) read(n int) ([]byte, error) {
12 | p, err := c.br.Peek(n)
13 | if err == io.EOF {
14 | err = errUnexpectedEOF
15 | }
16 | c.br.Discard(len(p))
17 | return p, err
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/conn_read_legacy.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket 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.5
6 |
7 | package websocket
8 |
9 | import "io"
10 |
11 | func (c *Conn) read(n int) ([]byte, error) {
12 | p, err := c.br.Peek(n)
13 | if err == io.EOF {
14 | err = errUnexpectedEOF
15 | }
16 | if len(p) > 0 {
17 | // advance over the bytes just read
18 | io.ReadFull(c.br, p)
19 | }
20 | return p, err
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Gorilla WebSocket 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 websocket
6 |
7 | import (
8 | "encoding/json"
9 | "io"
10 | )
11 |
12 | // WriteJSON is deprecated, use c.WriteJSON instead.
13 | func WriteJSON(c *Conn, v interface{}) error {
14 | return c.WriteJSON(v)
15 | }
16 |
17 | // WriteJSON writes the JSON encoding of v to the connection.
18 | //
19 | // See the documentation for encoding/json Marshal for details about the
20 | // conversion of Go values to JSON.
21 | func (c *Conn) WriteJSON(v interface{}) error {
22 | w, err := c.NextWriter(TextMessage)
23 | if err != nil {
24 | return err
25 | }
26 | err1 := json.NewEncoder(w).Encode(v)
27 | err2 := w.Close()
28 | if err1 != nil {
29 | return err1
30 | }
31 | return err2
32 | }
33 |
34 | // ReadJSON is deprecated, use c.ReadJSON instead.
35 | func ReadJSON(c *Conn, v interface{}) error {
36 | return c.ReadJSON(v)
37 | }
38 |
39 | // ReadJSON reads the next JSON-encoded message from the connection and stores
40 | // it in the value pointed to by v.
41 | //
42 | // See the documentation for the encoding/json Unmarshal function for details
43 | // about the conversion of JSON to a Go value.
44 | func (c *Conn) ReadJSON(v interface{}) error {
45 | _, r, err := c.NextReader()
46 | if err != nil {
47 | return err
48 | }
49 | err = json.NewDecoder(r).Decode(v)
50 | if err == io.EOF {
51 | // One value is expected in the message.
52 | err = io.ErrUnexpectedEOF
53 | }
54 | return err
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/mask.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
2 | // this source code is governed by a BSD-style license that can be found in the
3 | // LICENSE file.
4 |
5 | package websocket
6 |
7 | import (
8 | "math/rand"
9 | "unsafe"
10 | )
11 |
12 | const wordSize = int(unsafe.Sizeof(uintptr(0)))
13 |
14 | func newMaskKey() [4]byte {
15 | n := rand.Uint32()
16 | return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}
17 | }
18 |
19 | func maskBytes(key [4]byte, pos int, b []byte) int {
20 |
21 | // Mask one byte at a time for small buffers.
22 | if len(b) < 2*wordSize {
23 | for i := range b {
24 | b[i] ^= key[pos&3]
25 | pos++
26 | }
27 | return pos & 3
28 | }
29 |
30 | // Mask one byte at a time to word boundary.
31 | if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {
32 | n = wordSize - n
33 | for i := range b[:n] {
34 | b[i] ^= key[pos&3]
35 | pos++
36 | }
37 | b = b[n:]
38 | }
39 |
40 | // Create aligned word size key.
41 | var k [wordSize]byte
42 | for i := range k {
43 | k[i] = key[(pos+i)&3]
44 | }
45 | kw := *(*uintptr)(unsafe.Pointer(&k))
46 |
47 | // Mask one word at a time.
48 | n := (len(b) / wordSize) * wordSize
49 | for i := 0; i < n; i += wordSize {
50 | *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw
51 | }
52 |
53 | // Mask one byte at a time for remaining bytes.
54 | b = b[n:]
55 | for i := range b {
56 | b[i] ^= key[pos&3]
57 | pos++
58 | }
59 |
60 | return pos & 3
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | ---
2 | engines:
3 | gofmt:
4 | enabled: true
5 | govet:
6 | enabled: true
7 | golint:
8 | enabled: true
9 | ratings:
10 | paths:
11 | - "**.go"
12 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/License:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-NOW Jinzhu
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/jinzhu/gorm/callback_delete.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import "fmt"
4 |
5 | func BeforeDelete(scope *Scope) {
6 | scope.CallMethodWithErrorCheck("BeforeDelete")
7 | }
8 |
9 | func Delete(scope *Scope) {
10 | if !scope.HasError() {
11 | if !scope.Search.Unscoped && scope.HasColumn("DeletedAt") {
12 | scope.Raw(
13 | fmt.Sprintf("UPDATE %v SET deleted_at=%v %v",
14 | scope.QuotedTableName(),
15 | scope.AddToVars(NowFunc()),
16 | scope.CombinedConditionSql(),
17 | ))
18 | } else {
19 | scope.Raw(fmt.Sprintf("DELETE FROM %v %v", scope.QuotedTableName(), scope.CombinedConditionSql()))
20 | }
21 |
22 | scope.Exec()
23 | }
24 | }
25 |
26 | func AfterDelete(scope *Scope) {
27 | scope.CallMethodWithErrorCheck("AfterDelete")
28 | }
29 |
30 | func init() {
31 | DefaultCallback.Delete().Register("gorm:begin_transaction", BeginTransaction)
32 | DefaultCallback.Delete().Register("gorm:before_delete", BeforeDelete)
33 | DefaultCallback.Delete().Register("gorm:delete", Delete)
34 | DefaultCallback.Delete().Register("gorm:after_delete", AfterDelete)
35 | DefaultCallback.Delete().Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/dialect.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import (
4 | "fmt"
5 | "reflect"
6 | )
7 |
8 | type Dialect interface {
9 | BinVar(i int) string
10 | SupportLastInsertId() bool
11 | HasTop() bool
12 | SqlTag(value reflect.Value, size int, autoIncrease bool) string
13 | ReturningStr(tableName, key string) string
14 | SelectFromDummyTable() string
15 | Quote(key string) string
16 | HasTable(scope *Scope, tableName string) bool
17 | HasColumn(scope *Scope, tableName string, columnName string) bool
18 | HasIndex(scope *Scope, tableName string, indexName string) bool
19 | RemoveIndex(scope *Scope, indexName string)
20 | CurrentDatabase(scope *Scope) string
21 | }
22 |
23 | func NewDialect(driver string) Dialect {
24 | var d Dialect
25 | switch driver {
26 | case "postgres":
27 | d = &postgres{}
28 | case "foundation":
29 | d = &foundation{}
30 | case "mysql":
31 | d = &mysql{}
32 | case "sqlite3":
33 | d = &sqlite3{}
34 | case "mssql":
35 | d = &mssql{}
36 | default:
37 | fmt.Printf("`%v` is not officially supported, running under compatibility mode.\n", driver)
38 | d = &commonDialect{}
39 | }
40 | return d
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/errors.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import (
4 | "errors"
5 | "strings"
6 | )
7 |
8 | var (
9 | RecordNotFound = errors.New("record not found")
10 | InvalidSql = errors.New("invalid sql")
11 | NoNewAttrs = errors.New("no new attributes")
12 | NoValidTransaction = errors.New("no valid transaction")
13 | CantStartTransaction = errors.New("can't start transaction")
14 | )
15 |
16 | type errorsInterface interface {
17 | GetErrors() []error
18 | }
19 |
20 | type Errors struct {
21 | errors []error
22 | }
23 |
24 | func (errs Errors) GetErrors() []error {
25 | return errs.errors
26 | }
27 |
28 | func (errs *Errors) Add(err error) {
29 | if errors, ok := err.(errorsInterface); ok {
30 | for _, err := range errors.GetErrors() {
31 | errs.Add(err)
32 | }
33 | } else {
34 | for _, e := range errs.errors {
35 | if err == e {
36 | return
37 | }
38 | }
39 | errs.errors = append(errs.errors, err)
40 | }
41 | }
42 |
43 | func (errs Errors) Error() string {
44 | var errors = []string{}
45 | for _, e := range errs.errors {
46 | errors = append(errors, e.Error())
47 | }
48 | return strings.Join(errors, "; ")
49 | }
50 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/interface.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import "database/sql"
4 |
5 | type sqlCommon interface {
6 | Exec(query string, args ...interface{}) (sql.Result, error)
7 | Prepare(query string) (*sql.Stmt, error)
8 | Query(query string, args ...interface{}) (*sql.Rows, error)
9 | QueryRow(query string, args ...interface{}) *sql.Row
10 | }
11 |
12 | type sqlDb interface {
13 | Begin() (*sql.Tx, error)
14 | }
15 |
16 | type sqlTx interface {
17 | Commit() error
18 | Rollback() error
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/main_private.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import "time"
4 |
5 | func (s *DB) clone() *DB {
6 | db := DB{db: s.db, parent: s.parent, logger: s.logger, logMode: s.logMode, values: map[string]interface{}{}, Value: s.Value, Error: s.Error}
7 |
8 | for key, value := range s.values {
9 | db.values[key] = value
10 | }
11 |
12 | if s.search == nil {
13 | db.search = &search{}
14 | } else {
15 | db.search = s.search.clone()
16 | }
17 |
18 | db.search.db = &db
19 | return &db
20 | }
21 |
22 | func (s *DB) print(v ...interface{}) {
23 | s.logger.(logger).Print(v...)
24 | }
25 |
26 | func (s *DB) log(v ...interface{}) {
27 | if s != nil && s.logMode == 2 {
28 | s.print(append([]interface{}{"log", fileWithLineNum()}, v...)...)
29 | }
30 | }
31 |
32 | func (s *DB) slog(sql string, t time.Time, vars ...interface{}) {
33 | if s.logMode == 2 {
34 | s.print("sql", fileWithLineNum(), NowFunc().Sub(t), sql, vars)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/model.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import "time"
4 |
5 | type Model struct {
6 | ID uint `gorm:"primary_key"`
7 | CreatedAt time.Time
8 | UpdatedAt time.Time
9 | DeletedAt *time.Time `sql:"index"`
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/gorm/test_all.sh:
--------------------------------------------------------------------------------
1 | dialects=("postgres" "mysql" "sqlite")
2 |
3 | for dialect in "${dialects[@]}" ; do
4 | GORM_DIALECT=${dialect} go test
5 | done
6 |
--------------------------------------------------------------------------------
/vendor/github.com/jinzhu/inflection/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 - Jinzhu
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/jinzhu/inflection/README.md:
--------------------------------------------------------------------------------
1 | Inflection
2 | =========
3 |
4 | Inflection pluralizes and singularizes English nouns
5 |
6 | ## Basic Usage
7 |
8 | ```go
9 | inflection.Plural("person") => "people"
10 | inflection.Plural("Person") => "People"
11 | inflection.Plural("PERSON") => "PEOPLE"
12 | inflection.Plural("bus") => "buses"
13 | inflection.Plural("BUS") => "BUSES"
14 | inflection.Plural("Bus") => "Buses"
15 |
16 | inflection.Singularize("people") => "person"
17 | inflection.Singularize("People") => "Person"
18 | inflection.Singularize("PEOPLE") => "PERSON"
19 | inflection.Singularize("buses") => "bus"
20 | inflection.Singularize("BUSES") => "BUS"
21 | inflection.Singularize("Buses") => "Bus"
22 |
23 | inflection.Plural("FancyPerson") => "FancyPeople"
24 | inflection.Singularize("FancyPeople") => "FancyPerson"
25 | ```
26 |
27 | ## Register Rules
28 |
29 | Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb)
30 |
31 | If you want to register more rules, follow:
32 |
33 | ```
34 | inflection.AddUncountable("fish")
35 | inflection.AddIrregular("person", "people")
36 | inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses"
37 | inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS"
38 | ```
39 |
40 |
--------------------------------------------------------------------------------
/vendor/github.com/jtolds/gls/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013, Space Monkey, Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | 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, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/vendor/github.com/jtolds/gls/gen_sym.go:
--------------------------------------------------------------------------------
1 | package gls
2 |
3 | var (
4 | symPool = &idPool{}
5 | )
6 |
7 | // ContextKey is a throwaway value you can use as a key to a ContextManager
8 | type ContextKey struct{ id uint }
9 |
10 | // GenSym will return a brand new, never-before-used ContextKey
11 | func GenSym() ContextKey {
12 | return ContextKey{id: symPool.Acquire()}
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/github.com/jtolds/gls/id_pool.go:
--------------------------------------------------------------------------------
1 | package gls
2 |
3 | // though this could probably be better at keeping ids smaller, the goal of
4 | // this class is to keep a registry of the smallest unique integer ids
5 | // per-process possible
6 |
7 | import (
8 | "sync"
9 | )
10 |
11 | type idPool struct {
12 | mtx sync.Mutex
13 | released []uint
14 | max_id uint
15 | }
16 |
17 | func (p *idPool) Acquire() (id uint) {
18 | p.mtx.Lock()
19 | defer p.mtx.Unlock()
20 | if len(p.released) > 0 {
21 | id = p.released[len(p.released)-1]
22 | p.released = p.released[:len(p.released)-1]
23 | return id
24 | }
25 | id = p.max_id
26 | p.max_id++
27 | return id
28 | }
29 |
30 | func (p *idPool) Release(id uint) {
31 | p.mtx.Lock()
32 | defer p.mtx.Unlock()
33 | p.released = append(p.released, id)
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/github.com/kr/pretty/.gitignore:
--------------------------------------------------------------------------------
1 | [568].out
2 | _go*
3 | _test*
4 | _obj
5 |
--------------------------------------------------------------------------------
/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/lib/pq/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-2013, 'pq' Contributors
2 | Portions Copyright (C) 2011 Blake Mizerany
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/vendor/github.com/magiconair/properties/.gitignore:
--------------------------------------------------------------------------------
1 | *.sublime-project
2 | *.sublime-workspace
3 |
--------------------------------------------------------------------------------
/vendor/github.com/magiconair/properties/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: go
3 | go:
4 | - auto
5 |
6 |
--------------------------------------------------------------------------------
/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/.gitignore:
--------------------------------------------------------------------------------
1 | *.db
2 | *.exe
3 | *.dll
4 | *.o
5 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-sqlite3/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: required
3 | dist: trusty
4 | env:
5 | - GOTAGS=
6 | - GOTAGS=libsqlite3
7 | - GOTAGS=trace
8 | #- GOTAGS="libsqlite3 trace" # trusty is too old for this
9 | go:
10 | - 1.5
11 | - 1.6
12 | - tip
13 | before_install:
14 | - go get github.com/mattn/goveralls
15 | - go get golang.org/x/tools/cmd/cover
16 | script:
17 | - $HOME/gopath/bin/goveralls -repotoken 3qJVUE0iQwqnCbmNcDsjYu1nh4J4KIFXx
18 | - go test -race -v . -tags "$GOTAGS"
19 |
--------------------------------------------------------------------------------
/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_fts5.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 fts5
6 |
7 | package sqlite3
8 |
9 | /*
10 | #cgo CFLAGS: -DSQLITE_ENABLE_FTS5
11 | #cgo LDFLAGS: -lm
12 | */
13 | import "C"
14 |
--------------------------------------------------------------------------------
/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_json1.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 json1
6 |
7 | package sqlite3
8 |
9 | /*
10 | #cgo CFLAGS: -DSQLITE_ENABLE_JSON1
11 | */
12 | import "C"
13 |
--------------------------------------------------------------------------------
/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 linux LDFLAGS: -lsqlite3
12 | #cgo darwin LDFLAGS: -L/usr/local/opt/sqlite/lib -lsqlite3
13 | */
14 | import "C"
15 |
--------------------------------------------------------------------------------
/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 |
21 | func (c *SQLiteConn) LoadExtension(lib string, entry string) error {
22 | return errors.New("Extensions have been disabled for static builds")
23 | }
24 |
--------------------------------------------------------------------------------
/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_type.go:
--------------------------------------------------------------------------------
1 | package sqlite3
2 |
3 | /*
4 | #ifndef USE_LIBSQLITE3
5 | #include
6 | #else
7 | #include
8 | #endif
9 | */
10 | import "C"
11 | import (
12 | "reflect"
13 | "time"
14 | )
15 |
16 | // ColumnTypeDatabaseTypeName implement RowsColumnTypeDatabaseTypeName.
17 | func (rc *SQLiteRows) ColumnTypeDatabaseTypeName(i int) string {
18 | return C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i)))
19 | }
20 |
21 | /*
22 | func (rc *SQLiteRows) ColumnTypeLength(index int) (length int64, ok bool) {
23 | return 0, false
24 | }
25 |
26 | func (rc *SQLiteRows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool) {
27 | return 0, 0, false
28 | }
29 | */
30 |
31 | // ColumnTypeNullable implement RowsColumnTypeNullable.
32 | func (rc *SQLiteRows) ColumnTypeNullable(i int) (nullable, ok bool) {
33 | return true, true
34 | }
35 |
36 | // ColumnTypeScanType implement RowsColumnTypeScanType.
37 | func (rc *SQLiteRows) ColumnTypeScanType(i int) reflect.Type {
38 | switch C.sqlite3_column_type(rc.s.s, C.int(i)) {
39 | case C.SQLITE_INTEGER:
40 | switch C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i))) {
41 | case "timestamp", "datetime", "date":
42 | return reflect.TypeOf(time.Time{})
43 | case "boolean":
44 | return reflect.TypeOf(false)
45 | }
46 | return reflect.TypeOf(int64(0))
47 | case C.SQLITE_FLOAT:
48 | return reflect.TypeOf(float64(0))
49 | case C.SQLITE_BLOB:
50 | return reflect.SliceOf(reflect.TypeOf(byte(0)))
51 | case C.SQLITE_NULL:
52 | return reflect.TypeOf(nil)
53 | case C.SQLITE_TEXT:
54 | return reflect.TypeOf("")
55 | }
56 | return reflect.SliceOf(reflect.TypeOf(byte(0)))
57 | }
58 |
--------------------------------------------------------------------------------
/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_USE_32BIT_TIME_T
12 | #cgo LDFLAGS: -lmingwex -lmingw32
13 | */
14 | import "C"
15 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-sqlite3/tracecallback_noimpl.go:
--------------------------------------------------------------------------------
1 | // +build !trace
2 |
3 | package sqlite3
4 |
5 | import "errors"
6 |
7 | // RegisterAggregator register the aggregator.
8 | func (c *SQLiteConn) RegisterAggregator(name string, impl interface{}, pure bool) error {
9 | return errors.New("This feature is not implemented")
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/mitchellh/mapstructure/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.4
5 |
6 | script:
7 | - go test
8 |
--------------------------------------------------------------------------------
/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/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/moul/http2curl/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 |
--------------------------------------------------------------------------------
/vendor/github.com/moul/http2curl/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Manfred Touron
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 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/moul/http2curl/Makefile:
--------------------------------------------------------------------------------
1 | convey:
2 | go get github.com/smartystreets/goconvey
3 | goconvey -cover -port=9393 -workDir="$(realpath .)" -depth=0
4 |
--------------------------------------------------------------------------------
/vendor/github.com/moul/http2curl/README.md:
--------------------------------------------------------------------------------
1 | # http2curl
2 | :triangular_ruler: Convert Golang's http.Request to CURL command line
3 |
4 | [](https://godoc.org/github.com/moul/http2curl)
5 |
6 | ## Example
7 |
8 | ```go
9 | import "github.com/moul/http2curl"
10 |
11 | req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", bytes.NewBufferString(`{"hello":"world","answer":42}`))
12 | req.Header.Set("Content-Type", "application/json")
13 |
14 | command, _ := GetCurlCommand(req)
15 | fmt.Println(command)
16 | // Output: curl -X PUT -d "{\"hello\":\"world\",\"answer\":42}" -H "Content-Type: application/json" http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu
17 | ```
18 |
19 | ## Install
20 |
21 | ```php
22 | $ go get github.com/moul/http2curl
23 | ```
24 |
25 | ## License
26 |
27 | MIT
28 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Unix-style newlines with a newline ending every file
7 | [*]
8 | charset = utf-8
9 | end_of_line = lf
10 | insert_final_newline = true
11 | trim_trailing_whitespace = true
12 |
13 | # Indentiation
14 | [*.{py,rst}]
15 | indent_style = space
16 | indent_size = 4
17 | [{Makefile,*.go}]
18 | indent_style = tab
19 | indent_size = 4
20 | [*.{ini,yml}]
21 | indent_style = space
22 | indent_size = 2
23 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 | test.txt
26 |
27 | *~
28 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.1
4 | - 1.2
5 | - 1.3
6 | - 1.4
7 | - 1.5
8 | - tip
9 |
10 | sudo: false
11 |
12 | before_install:
13 | - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
14 | - go get github.com/axw/gocov/gocov
15 | - go get github.com/mattn/goveralls
16 | - go get github.com/bitly/go-simplejson
17 | - go get golang.org/x/net/publicsuffix
18 | - go get golang.org/x/net/proxy
19 | - go get github.com/bmizerany/assert
20 |
21 | install:
22 | - go build
23 |
24 | script:
25 | - echo "test.txtabc" > test.txt
26 | - go test -v
27 | - if [[ $TRAVIS_GO_VERSION != 'tip' ]]; then $HOME/gopath/bin/goveralls -service=travis-ci; fi
28 |
29 | matrix:
30 | allow_failures:
31 | - go: 1.1
32 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 mozillazg
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 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/cookies.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import "net/http"
4 |
5 | func applyCookies(a *Args, req *http.Request) {
6 | if a.Cookies == nil {
7 | return
8 | }
9 | cookies := a.Client.Jar.Cookies(req.URL)
10 | for k, v := range a.Cookies {
11 | cookies = append(cookies, &http.Cookie{Name: k, Value: v})
12 | }
13 | a.Client.Jar.SetCookies(req.URL, cookies)
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/headers.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import "net/http"
4 |
5 | var DefaultUserAgent = "go-request/" + Version
6 | var DefaultHeaders = map[string]string{
7 | "Connection": "keep-alive",
8 | "Accept-Encoding": "gzip, deflate",
9 | "Accept": "*/*",
10 | "User-Agent": DefaultUserAgent,
11 | }
12 |
13 | // Default Content-Type Header for form body
14 | var DefaultContentType = "application/x-www-form-urlencoded; charset=utf-8"
15 |
16 | // Default Content-Type Header for json body
17 | var DefaultJsonType = "application/json; charset=utf-8"
18 |
19 | func applyHeaders(a *Args, req *http.Request, contentType string) {
20 | // apply defaultHeaders
21 | for k, v := range DefaultHeaders {
22 | _, ok := a.Headers[k]
23 | if !ok {
24 | req.Header.Set(k, v)
25 | }
26 | }
27 | // apply custom Headers
28 | for k, v := range a.Headers {
29 | req.Header.Set(k, v)
30 | }
31 | // apply "Content-Type" Headers
32 | _, ok := a.Headers["Content-Type"]
33 | if !ok {
34 | if contentType != "" {
35 | req.Header.Set("Content-Type", contentType)
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/proxy.go:
--------------------------------------------------------------------------------
1 | // +build !go1.1 !go1.2
2 |
3 | package request
4 |
5 | import (
6 | "net"
7 | "net/http"
8 | "net/url"
9 | "time"
10 |
11 | "golang.org/x/net/proxy"
12 | )
13 |
14 | func applyProxy(a *Args) (err error) {
15 | if a.Proxy == "" {
16 | return nil
17 | }
18 |
19 | u, err := url.Parse(a.Proxy)
20 | if err != nil {
21 | return err
22 | }
23 | switch u.Scheme {
24 | case "http", "https":
25 | a.Client.Transport = &http.Transport{
26 | Proxy: http.ProxyURL(u),
27 | Dial: (&net.Dialer{
28 | Timeout: 30 * time.Second,
29 | KeepAlive: 30 * time.Second,
30 | }).Dial,
31 | TLSHandshakeTimeout: 10 * time.Second,
32 | }
33 | case "socks5":
34 | dialer, err := proxy.FromURL(u, proxy.Direct)
35 | if err != nil {
36 | return err
37 | }
38 | a.Client.Transport = &http.Transport{
39 | Proxy: http.ProxyFromEnvironment,
40 | Dial: dialer.Dial,
41 | TLSHandshakeTimeout: 10 * time.Second,
42 | }
43 | }
44 | return
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/proxy_go12.go:
--------------------------------------------------------------------------------
1 | // +build go1.1 go1.2
2 |
3 | package request
4 |
5 | import (
6 | "net"
7 | "net/http"
8 | "net/url"
9 | "time"
10 |
11 | "golang.org/x/net/proxy"
12 | )
13 |
14 | func applyProxy(a *Args) (err error) {
15 | if a.Proxy == "" {
16 | return nil
17 | }
18 |
19 | u, err := url.Parse(a.Proxy)
20 | if err != nil {
21 | return err
22 | }
23 | switch u.Scheme {
24 | case "http", "https":
25 | a.Client.Transport = &http.Transport{
26 | Proxy: http.ProxyURL(u),
27 | Dial: (&net.Dialer{
28 | Timeout: 30 * time.Second,
29 | // KeepAlive: 30 * time.Second,
30 | }).Dial,
31 | // TLSHandshakeTimeout: 10 * time.Second,
32 | }
33 | case "socks5":
34 | dialer, err := proxy.FromURL(u, proxy.Direct)
35 | if err != nil {
36 | return err
37 | }
38 | a.Client.Transport = &http.Transport{
39 | Proxy: http.ProxyFromEnvironment,
40 | Dial: dialer.Dial,
41 | // TLSHandshakeTimeout: 10 * time.Second,
42 | }
43 | }
44 | return
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/github.com/mozillazg/request/redirect.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import (
4 | "fmt"
5 | "net/http"
6 | )
7 |
8 | var DefaultRedirectLimit = 10
9 |
10 | func defaultCheckRedirect(req *http.Request, via []*http.Request) error {
11 | if len(via) > DefaultRedirectLimit {
12 | return fmt.Errorf("stopped after %d redirects", len(via))
13 | }
14 | if len(via) == 0 {
15 | return nil
16 | }
17 | // Redirect requests with the first Header
18 | for key, val := range via[0].Header {
19 | // Don't copy Referer Header
20 | if key != "Referer" {
21 | req.Header[key] = val
22 | }
23 | }
24 | return nil
25 | }
26 |
27 | func applyCheckRdirect(a *Args) {
28 | if a.Client.CheckRedirect == nil {
29 | a.Client.CheckRedirect = defaultCheckRedirect
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/olivere/elastic/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This is a list of people who have contributed code
2 | # to the Elastic repository.
3 | #
4 | # It is just my small "thank you" to all those that helped
5 | # making Elastic what it is.
6 | #
7 | # Please keep this list sorted.
8 |
9 | Adam Weiner [@adamweiner](https://github.com/adamweiner)
10 | Alexey Sharov [@nizsheanez](https://github.com/nizsheanez)
11 | Braden Bassingthwaite [@bbassingthwaite-va](https://github.com/bbassingthwaite-va)
12 | Conrad Pankoff [@deoxxa](https://github.com/deoxxa)
13 | Corey Scott [@corsc](https://github.com/corsc)
14 | Daniel Heckrath [@DanielHeckrath](https://github.com/DanielHeckrath)
15 | Gerhard Häring [@ghaering](https://github.com/ghaering)
16 | Guilherme Silveira [@guilherme-santos](https://github.com/guilherme-santos)
17 | Guillaume J. Charmes [@creack](https://github.com/creack)
18 | Isaac Saldana [@isaldana](https://github.com/isaldana)
19 | Jack Lindamood [@cep21](https://github.com/cep21)
20 | Junpei Tsuji [@jun06t](https://github.com/jun06t)
21 | Maciej Lisiewski [@c2h5oh](https://github.com/c2h5oh)
22 | Mara Kim [@autochthe](https://github.com/autochthe)
23 | Medhi Bechina [@mdzor](https://github.com/mdzor)
24 | Nicholas Wolff [@nwolff](https://github.com/nwolff)
25 | Orne Brocaar [@brocaar](https://github.com/brocaar)
26 | Sacheendra talluri [@sacheendra](https://github.com/sacheendra)
27 | Sean DuBois [@Sean-Der](https://github.com/Sean-Der)
28 | Tetsuya Morimoto [@t2y](https://github.com/t2y)
29 | zakthomas [@zakthomas](https://github.com/zakthomas)
30 |
--------------------------------------------------------------------------------
/vendor/github.com/olivere/elastic/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright © 2012-2015 Oliver Eilhard
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the “Software”), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/olivere/elastic/uritemplates/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 Joshua Tacoma
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | 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, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/vendor/github.com/olivere/elastic/uritemplates/utils.go:
--------------------------------------------------------------------------------
1 | package uritemplates
2 |
3 | func Expand(path string, expansions map[string]string) (string, error) {
4 | template, err := Parse(path)
5 | if err != nil {
6 | return "", err
7 | }
8 | values := make(map[string]interface{})
9 | for k, v := range expansions {
10 | values[k] = v
11 | }
12 | return template.Expand(values)
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/github.com/parnurzeal/gorequest/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | tags
24 |
--------------------------------------------------------------------------------
/vendor/github.com/parnurzeal/gorequest/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.4
4 | - 1.3
5 | - 1.2
6 | install:
7 | - go get github.com/elazarl/goproxy
8 | - go get github.com/moul/http2curl
9 | - go get golang.org/x/net/publicsuffix
10 | notifications:
11 | email:
12 | recipients: parnurzeal@gmail.com
13 | on_success: change
14 | on_failure: always
15 |
--------------------------------------------------------------------------------
/vendor/github.com/parnurzeal/gorequest/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Theeraphol Wattanavekin
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/rs/cors/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.3
4 | - 1.4
5 |
--------------------------------------------------------------------------------
/vendor/github.com/rs/cors/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Olivier Poitrey
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.
20 |
--------------------------------------------------------------------------------
/vendor/github.com/rs/xhandler/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.5
4 | - tip
5 | matrix:
6 | allow_failures:
7 | - go: tip
8 |
--------------------------------------------------------------------------------
/vendor/github.com/rs/xhandler/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 Olivier Poitrey
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.
20 |
--------------------------------------------------------------------------------
/vendor/github.com/rs/xhandler/xhandler.go:
--------------------------------------------------------------------------------
1 | // Package xhandler provides a bridge between http.Handler and net/context.
2 | //
3 | // xhandler enforces net/context in your handlers without sacrificing
4 | // compatibility with existing http.Handlers nor imposing a specific router.
5 | //
6 | // Thanks to net/context deadline management, xhandler is able to enforce
7 | // a per request deadline and will cancel the context in when the client close
8 | // the connection unexpectedly.
9 | //
10 | // You may create net/context aware middlewares pretty much the same way as
11 | // you would do with http.Handler.
12 | package xhandler
13 |
14 | import (
15 | "net/http"
16 |
17 | "golang.org/x/net/context"
18 | )
19 |
20 | // HandlerC is a net/context aware http.Handler
21 | type HandlerC interface {
22 | ServeHTTPC(context.Context, http.ResponseWriter, *http.Request)
23 | }
24 |
25 | // HandlerFuncC type is an adapter to allow the use of ordinary functions
26 | // as a xhandler.Handler. If f is a function with the appropriate signature,
27 | // xhandler.HandlerFuncC(f) is a xhandler.Handler object that calls f.
28 | type HandlerFuncC func(context.Context, http.ResponseWriter, *http.Request)
29 |
30 | // ServeHTTPC calls f(ctx, w, r).
31 | func (f HandlerFuncC) ServeHTTPC(ctx context.Context, w http.ResponseWriter, r *http.Request) {
32 | f(ctx, w, r)
33 | }
34 |
35 | // New creates a conventional http.Handler injecting the provided root
36 | // context to sub handlers. This handler is used as a bridge between conventional
37 | // http.Handler and context aware handlers.
38 | func New(ctx context.Context, h HandlerC) http.Handler {
39 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
40 | h.ServeHTTPC(ctx, w, r)
41 | })
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/satori/go.uuid/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.0
4 | - 1.1
5 | - 1.2
6 | - 1.3
7 | - 1.4
8 | - 1.5
9 | sudo: false
10 | notifications:
11 | email: false
12 |
--------------------------------------------------------------------------------
/vendor/github.com/satori/go.uuid/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2013-2015 by Maxim Bublis
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | Thumbs.db
3 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.2
5 | - 1.3
6 | - 1.4
7 | - 1.5
8 |
9 | install:
10 | - go get -t ./...
11 |
12 | script: go test -v
13 |
14 | sudo: false
15 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 SmartyStreets, LLC
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 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 THE
19 | SOFTWARE.
20 |
21 | NOTE: Various optional and subordinate components carry their own licensing
22 | requirements and restrictions. Use of those components is subject to the terms
23 | and conditions outlined the respective license of each component.
24 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/assertions.goconvey:
--------------------------------------------------------------------------------
1 | #ignore
2 | -timeout=1s
3 | -coverpkg=github.com/smartystreets/assertions,github.com/smartystreets/assertions/internal/oglematchers
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/filter.go:
--------------------------------------------------------------------------------
1 | package assertions
2 |
3 | import "fmt"
4 |
5 | const (
6 | success = ""
7 | needExactValues = "This assertion requires exactly %d comparison values (you provided %d)."
8 | needNonEmptyCollection = "This assertion requires at least 1 comparison value (you provided 0)."
9 | )
10 |
11 | func need(needed int, expected []interface{}) string {
12 | if len(expected) != needed {
13 | return fmt.Sprintf(needExactValues, needed, len(expected))
14 | }
15 | return success
16 | }
17 |
18 | func atLeast(minimum int, expected []interface{}) string {
19 | if len(expected) < 1 {
20 | return needNonEmptyCollection
21 | }
22 | return success
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/.gitignore:
--------------------------------------------------------------------------------
1 | *.6
2 | 6.out
3 | _obj/
4 | _test/
5 | _testmain.go
6 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/.travis.yml:
--------------------------------------------------------------------------------
1 | # Cf. http://docs.travis-ci.com/user/getting-started/
2 | # Cf. http://docs.travis-ci.com/user/languages/go/
3 |
4 | language: go
5 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/any.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | // Any returns a matcher that matches any value.
19 | func Any() Matcher {
20 | return &anyMatcher{}
21 | }
22 |
23 | type anyMatcher struct {
24 | }
25 |
26 | func (m *anyMatcher) Description() string {
27 | return "is anything"
28 | }
29 |
30 | func (m *anyMatcher) Matches(c interface{}) error {
31 | return nil
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "fmt"
20 | "reflect"
21 | )
22 |
23 | // GreaterOrEqual returns a matcher that matches integer, floating point, or
24 | // strings values v such that v >= x. Comparison is not defined between numeric
25 | // and string types, but is defined between all integer and floating point
26 | // types.
27 | //
28 | // x must itself be an integer, floating point, or string type; otherwise,
29 | // GreaterOrEqual will panic.
30 | func GreaterOrEqual(x interface{}) Matcher {
31 | desc := fmt.Sprintf("greater than or equal to %v", x)
32 |
33 | // Special case: make it clear that strings are strings.
34 | if reflect.TypeOf(x).Kind() == reflect.String {
35 | desc = fmt.Sprintf("greater than or equal to \"%s\"", x)
36 | }
37 |
38 | return transformDescription(Not(LessThan(x)), desc)
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "fmt"
20 | "reflect"
21 | )
22 |
23 | // GreaterThan returns a matcher that matches integer, floating point, or
24 | // strings values v such that v > x. Comparison is not defined between numeric
25 | // and string types, but is defined between all integer and floating point
26 | // types.
27 | //
28 | // x must itself be an integer, floating point, or string type; otherwise,
29 | // GreaterThan will panic.
30 | func GreaterThan(x interface{}) Matcher {
31 | desc := fmt.Sprintf("greater than %v", x)
32 |
33 | // Special case: make it clear that strings are strings.
34 | if reflect.TypeOf(x).Kind() == reflect.String {
35 | desc = fmt.Sprintf("greater than \"%s\"", x)
36 | }
37 |
38 | return transformDescription(Not(LessOrEqual(x)), desc)
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "fmt"
20 | "reflect"
21 | )
22 |
23 | // HasSameTypeAs returns a matcher that matches values with exactly the same
24 | // type as the supplied prototype.
25 | func HasSameTypeAs(p interface{}) Matcher {
26 | expected := reflect.TypeOf(p)
27 | pred := func(c interface{}) error {
28 | actual := reflect.TypeOf(c)
29 | if actual != expected {
30 | return fmt.Errorf("which has type %v", actual)
31 | }
32 |
33 | return nil
34 | }
35 |
36 | return NewMatcher(pred, fmt.Sprintf("has type %v", expected))
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "errors"
20 | "fmt"
21 | "reflect"
22 | "strings"
23 | )
24 |
25 | // HasSubstr returns a matcher that matches strings containing s as a
26 | // substring.
27 | func HasSubstr(s string) Matcher {
28 | return NewMatcher(
29 | func(c interface{}) error { return hasSubstr(s, c) },
30 | fmt.Sprintf("has substring \"%s\"", s))
31 | }
32 |
33 | func hasSubstr(needle string, c interface{}) error {
34 | v := reflect.ValueOf(c)
35 | if v.Kind() != reflect.String {
36 | return NewFatalError("which is not a string")
37 | }
38 |
39 | // Perform the substring search.
40 | haystack := v.String()
41 | if strings.Contains(haystack, needle) {
42 | return nil
43 | }
44 |
45 | return errors.New("")
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "fmt"
20 | "reflect"
21 | )
22 |
23 | // LessOrEqual returns a matcher that matches integer, floating point, or
24 | // strings values v such that v <= x. Comparison is not defined between numeric
25 | // and string types, but is defined between all integer and floating point
26 | // types.
27 | //
28 | // x must itself be an integer, floating point, or string type; otherwise,
29 | // LessOrEqual will panic.
30 | func LessOrEqual(x interface{}) Matcher {
31 | desc := fmt.Sprintf("less than or equal to %v", x)
32 |
33 | // Special case: make it clear that strings are strings.
34 | if reflect.TypeOf(x).Kind() == reflect.String {
35 | desc = fmt.Sprintf("less than or equal to \"%s\"", x)
36 | }
37 |
38 | // Put LessThan last so that its error messages will be used in the event of
39 | // failure.
40 | return transformDescription(AnyOf(Equals(x), LessThan(x)), desc)
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/new_matcher.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | // Create a matcher with the given description and predicate function, which
19 | // will be invoked to handle calls to Matchers.
20 | //
21 | // Using this constructor may be a convenience over defining your own type that
22 | // implements Matcher if you do not need any logic in your Description method.
23 | func NewMatcher(
24 | predicate func(interface{}) error,
25 | description string) Matcher {
26 | return &predicateMatcher{
27 | predicate: predicate,
28 | description: description,
29 | }
30 | }
31 |
32 | type predicateMatcher struct {
33 | predicate func(interface{}) error
34 | description string
35 | }
36 |
37 | func (pm *predicateMatcher) Matches(c interface{}) error {
38 | return pm.predicate(c)
39 | }
40 |
41 | func (pm *predicateMatcher) Description() string {
42 | return pm.description
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | import (
19 | "errors"
20 | "fmt"
21 | )
22 |
23 | // Not returns a matcher that inverts the set of values matched by the wrapped
24 | // matcher. It does not transform the result for values for which the wrapped
25 | // matcher returns a fatal error.
26 | func Not(m Matcher) Matcher {
27 | return ¬Matcher{m}
28 | }
29 |
30 | type notMatcher struct {
31 | wrapped Matcher
32 | }
33 |
34 | func (m *notMatcher) Matches(c interface{}) (err error) {
35 | err = m.wrapped.Matches(c)
36 |
37 | // Did the wrapped matcher say yes?
38 | if err == nil {
39 | return errors.New("")
40 | }
41 |
42 | // Did the wrapped matcher return a fatal error?
43 | if _, isFatal := err.(*FatalError); isFatal {
44 | return err
45 | }
46 |
47 | // The wrapped matcher returned a non-fatal error.
48 | return nil
49 | }
50 |
51 | func (m *notMatcher) Description() string {
52 | return fmt.Sprintf("not(%s)", m.wrapped.Description())
53 | }
54 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
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 | package oglematchers
17 |
18 | // transformDescription returns a matcher that is equivalent to the supplied
19 | // one, except that it has the supplied description instead of the one attached
20 | // to the existing matcher.
21 | func transformDescription(m Matcher, newDesc string) Matcher {
22 | return &transformDescriptionMatcher{newDesc, m}
23 | }
24 |
25 | type transformDescriptionMatcher struct {
26 | desc string
27 | wrappedMatcher Matcher
28 | }
29 |
30 | func (m *transformDescriptionMatcher) Description() string {
31 | return m.desc
32 | }
33 |
34 | func (m *transformDescriptionMatcher) Matches(c interface{}) error {
35 | return m.wrappedMatcher.Matches(c)
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 SmartyStreets, LLC
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 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 THE
19 | SOFTWARE.
20 |
21 | NOTE: Various optional and subordinate components carry their own licensing
22 | requirements and restrictions. Use of those components is subject to the terms
23 | and conditions outlined the respective license of each component.
24 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/convey.goconvey:
--------------------------------------------------------------------------------
1 | #ignore
2 | -timeout=1s
3 | #-covermode=count
4 | #-coverpkg=github.com/smartystreets/goconvey/convey,github.com/smartystreets/goconvey/convey/gotest,github.com/smartystreets/goconvey/convey/reporting
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/gotest/utils.go:
--------------------------------------------------------------------------------
1 | // Package gotest contains internal functionality. Although this package
2 | // contains one or more exported names it is not intended for public
3 | // consumption. See the examples package for how to use this project.
4 | package gotest
5 |
6 | import (
7 | "fmt"
8 | "runtime"
9 | "strings"
10 | )
11 |
12 | func FormatExternalFileAndLine() string {
13 | file, line, _ := ResolveExternalCaller()
14 | if line == -1 {
15 | return "" // panic?
16 | }
17 | return fmt.Sprintf("%s:%d", file, line)
18 | }
19 |
20 | func ResolveExternalCaller() (file string, line int, name string) {
21 | var caller_id uintptr
22 | callers := runtime.Callers(0, callStack)
23 |
24 | for x := 0; x < callers; x++ {
25 | caller_id, file, line, _ = runtime.Caller(x)
26 | if strings.HasSuffix(file, "_test.go") || strings.HasSuffix(file, "_tests.go") {
27 | name = runtime.FuncForPC(caller_id).Name()
28 | return
29 | }
30 | }
31 | file, line, name = "", -1, ""
32 | return // panic?
33 | }
34 |
35 | const maxStackDepth = 100 // This had better be enough...
36 |
37 | var callStack []uintptr = make([]uintptr, maxStackDepth, maxStackDepth)
38 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/nilReporter.go:
--------------------------------------------------------------------------------
1 | package convey
2 |
3 | import (
4 | "github.com/smartystreets/goconvey/convey/reporting"
5 | )
6 |
7 | type nilReporter struct{}
8 |
9 | func (self *nilReporter) BeginStory(story *reporting.StoryReport) {}
10 | func (self *nilReporter) Enter(scope *reporting.ScopeReport) {}
11 | func (self *nilReporter) Report(report *reporting.AssertionResult) {}
12 | func (self *nilReporter) Exit() {}
13 | func (self *nilReporter) EndStory() {}
14 | func (self *nilReporter) Write(p []byte) (int, error) { return len(p), nil }
15 | func newNilReporter() *nilReporter { return &nilReporter{} }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/console.go:
--------------------------------------------------------------------------------
1 | package reporting
2 |
3 | import (
4 | "fmt"
5 | "io"
6 | )
7 |
8 | type console struct{}
9 |
10 | func (self *console) Write(p []byte) (n int, err error) {
11 | return fmt.Print(string(p))
12 | }
13 |
14 | func NewConsole() io.Writer {
15 | return new(console)
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/doc.go:
--------------------------------------------------------------------------------
1 | // Package reporting contains internal functionality related
2 | // to console reporting and output. Although this package has
3 | // exported names is not intended for public consumption. See the
4 | // examples package for how to use this project.
5 | package reporting
6 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/dot.go:
--------------------------------------------------------------------------------
1 | package reporting
2 |
3 | import "fmt"
4 |
5 | type dot struct{ out *Printer }
6 |
7 | func (self *dot) BeginStory(story *StoryReport) {}
8 |
9 | func (self *dot) Enter(scope *ScopeReport) {}
10 |
11 | func (self *dot) Report(report *AssertionResult) {
12 | if report.Error != nil {
13 | fmt.Print(redColor)
14 | self.out.Insert(dotError)
15 | } else if report.Failure != "" {
16 | fmt.Print(yellowColor)
17 | self.out.Insert(dotFailure)
18 | } else if report.Skipped {
19 | fmt.Print(yellowColor)
20 | self.out.Insert(dotSkip)
21 | } else {
22 | fmt.Print(greenColor)
23 | self.out.Insert(dotSuccess)
24 | }
25 | fmt.Print(resetColor)
26 | }
27 |
28 | func (self *dot) Exit() {}
29 |
30 | func (self *dot) EndStory() {}
31 |
32 | func (self *dot) Write(content []byte) (written int, err error) {
33 | return len(content), nil // no-op
34 | }
35 |
36 | func NewDotReporter(out *Printer) *dot {
37 | self := new(dot)
38 | self.out = out
39 | return self
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest.go:
--------------------------------------------------------------------------------
1 | package reporting
2 |
3 | type gotestReporter struct{ test T }
4 |
5 | func (self *gotestReporter) BeginStory(story *StoryReport) {
6 | self.test = story.Test
7 | }
8 |
9 | func (self *gotestReporter) Enter(scope *ScopeReport) {}
10 |
11 | func (self *gotestReporter) Report(r *AssertionResult) {
12 | if !passed(r) {
13 | self.test.Fail()
14 | }
15 | }
16 |
17 | func (self *gotestReporter) Exit() {}
18 |
19 | func (self *gotestReporter) EndStory() {
20 | self.test = nil
21 | }
22 |
23 | func (self *gotestReporter) Write(content []byte) (written int, err error) {
24 | return len(content), nil // no-op
25 | }
26 |
27 | func NewGoTestReporter() *gotestReporter {
28 | return new(gotestReporter)
29 | }
30 |
31 | func passed(r *AssertionResult) bool {
32 | return r.Error == nil && r.Failure == ""
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/printer.go:
--------------------------------------------------------------------------------
1 | package reporting
2 |
3 | import (
4 | "fmt"
5 | "io"
6 | "strings"
7 | )
8 |
9 | type Printer struct {
10 | out io.Writer
11 | prefix string
12 | }
13 |
14 | func (self *Printer) Println(message string, values ...interface{}) {
15 | formatted := self.format(message, values...) + newline
16 | self.out.Write([]byte(formatted))
17 | }
18 |
19 | func (self *Printer) Print(message string, values ...interface{}) {
20 | formatted := self.format(message, values...)
21 | self.out.Write([]byte(formatted))
22 | }
23 |
24 | func (self *Printer) Insert(text string) {
25 | self.out.Write([]byte(text))
26 | }
27 |
28 | func (self *Printer) format(message string, values ...interface{}) string {
29 | var formatted string
30 | if len(values) == 0 {
31 | formatted = self.prefix + message
32 | } else {
33 | formatted = self.prefix + fmt.Sprintf(message, values...)
34 | }
35 | indented := strings.Replace(formatted, newline, newline+self.prefix, -1)
36 | return strings.TrimRight(indented, space)
37 | }
38 |
39 | func (self *Printer) Indent() {
40 | self.prefix += pad
41 | }
42 |
43 | func (self *Printer) Dedent() {
44 | if len(self.prefix) >= padLength {
45 | self.prefix = self.prefix[:len(self.prefix)-padLength]
46 | }
47 | }
48 |
49 | func NewPrinter(out io.Writer) *Printer {
50 | self := new(Printer)
51 | self.out = out
52 | return self
53 | }
54 |
55 | const space = " "
56 | const pad = space + space
57 | const padLength = len(pad)
58 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter.go:
--------------------------------------------------------------------------------
1 | package reporting
2 |
3 | import "io"
4 |
5 | type Reporter interface {
6 | BeginStory(story *StoryReport)
7 | Enter(scope *ScopeReport)
8 | Report(r *AssertionResult)
9 | Exit()
10 | EndStory()
11 | io.Writer
12 | }
13 |
14 | type reporters struct{ collection []Reporter }
15 |
16 | func (self *reporters) BeginStory(s *StoryReport) { self.foreach(func(r Reporter) { r.BeginStory(s) }) }
17 | func (self *reporters) Enter(s *ScopeReport) { self.foreach(func(r Reporter) { r.Enter(s) }) }
18 | func (self *reporters) Report(a *AssertionResult) { self.foreach(func(r Reporter) { r.Report(a) }) }
19 | func (self *reporters) Exit() { self.foreach(func(r Reporter) { r.Exit() }) }
20 | func (self *reporters) EndStory() { self.foreach(func(r Reporter) { r.EndStory() }) }
21 |
22 | func (self *reporters) Write(contents []byte) (written int, err error) {
23 | self.foreach(func(r Reporter) {
24 | written, err = r.Write(contents)
25 | })
26 | return written, err
27 | }
28 |
29 | func (self *reporters) foreach(action func(Reporter)) {
30 | for _, r := range self.collection {
31 | action(r)
32 | }
33 | }
34 |
35 | func NewReporters(collection ...Reporter) *reporters {
36 | self := new(reporters)
37 | self.collection = collection
38 | return self
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey:
--------------------------------------------------------------------------------
1 | #ignore
2 | -timeout=1s
3 |
--------------------------------------------------------------------------------
/vendor/github.com/speps/go-hashids/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | indent_size = 4
--------------------------------------------------------------------------------
/vendor/github.com/speps/go-hashids/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
--------------------------------------------------------------------------------
/vendor/github.com/speps/go-hashids/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Remi Gillig
2 |
3 | Permission is hereby granted, free of charge, to any person
4 | obtaining a copy of this software and associated documentation
5 | files (the "Software"), to deal in the Software without
6 | restriction, including without limitation the rights to use,
7 | copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following
10 | conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/vendor/github.com/spf13/cast/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 |
--------------------------------------------------------------------------------
/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/jwalterweatherman/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
--------------------------------------------------------------------------------
/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/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | language: go
4 |
5 | go:
6 | - 1.3
7 | - 1.4
8 | - 1.5
9 | - tip
10 |
11 | install:
12 | - go get github.com/golang/lint/golint
13 | - export PATH=$GOPATH/bin:$PATH
14 | - go install ./...
15 |
16 | script:
17 | - verify/all.sh
18 | - go test ./...
19 |
--------------------------------------------------------------------------------
/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/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 |
--------------------------------------------------------------------------------
/vendor/github.com/spf13/viper/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.3
4 | - release
5 | - tip
6 |
7 | script:
8 | - go test -v ./...
9 |
--------------------------------------------------------------------------------
/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/unrolled/render/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 |
25 |
26 | *.pem
27 | .DS_Store
28 |
--------------------------------------------------------------------------------
/vendor/github.com/unrolled/render/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.3
5 | - 1.4
6 | - 1.5
7 |
8 | install:
9 | - go get github.com/eknkc/amber
10 |
11 | script:
12 | - go test -v -race -tags=integration
13 |
14 |
--------------------------------------------------------------------------------
/vendor/github.com/unrolled/render/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Cory Jacobsen
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/unrolled/render/buffer.go:
--------------------------------------------------------------------------------
1 | package render
2 |
3 | import "bytes"
4 |
5 | // bufPool represents a reusable buffer pool for executing templates into.
6 | var bufPool *BufferPool
7 |
8 | // BufferPool implements a pool of bytes.Buffers in the form of a bounded channel.
9 | // Pulled from the github.com/oxtoacart/bpool package (Apache licensed).
10 | type BufferPool struct {
11 | c chan *bytes.Buffer
12 | }
13 |
14 | // NewBufferPool creates a new BufferPool bounded to the given size.
15 | func NewBufferPool(size int) (bp *BufferPool) {
16 | return &BufferPool{
17 | c: make(chan *bytes.Buffer, size),
18 | }
19 | }
20 |
21 | // Get gets a Buffer from the BufferPool, or creates a new one if none are
22 | // available in the pool.
23 | func (bp *BufferPool) Get() (b *bytes.Buffer) {
24 | select {
25 | case b = <-bp.c:
26 | // reuse existing buffer
27 | default:
28 | // create new buffer
29 | b = bytes.NewBuffer([]byte{})
30 | }
31 | return
32 | }
33 |
34 | // Put returns the given Buffer to the BufferPool.
35 | func (bp *BufferPool) Put(b *bytes.Buffer) {
36 | b.Reset()
37 | select {
38 | case bp.c <- b:
39 | default: // Discard the buffer if the pool is full.
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/github.com/verdverm/frisby/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 |
--------------------------------------------------------------------------------
/vendor/github.com/verdverm/frisby/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | notifications:
4 | email: false
5 |
6 | branches:
7 | only:
8 | - master
9 | - develop
10 |
11 | install:
12 | - go get -u github.com/bitly/go-simplejson
13 | - go get -u github.com/mozillazg/request
14 |
--------------------------------------------------------------------------------
/vendor/github.com/verdverm/frisby/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Tony Worm
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 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/verdverm/frisby/doc.go:
--------------------------------------------------------------------------------
1 | // frisby is an API testing framework, written in Go, inspired by frisby-js
2 |
3 | package frisby
4 |
--------------------------------------------------------------------------------
/vendor/github.com/verdverm/frisby/frisby.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xcodersun/eywa/92eb8d4c4681544c779fdef1f29d7deeb68b316d/vendor/github.com/verdverm/frisby/frisby.gif
--------------------------------------------------------------------------------
/vendor/github.com/waterwheel/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.3
5 | - 1.4
6 | - 1.5
7 | - tip
8 |
9 | go_import_path: github.com/vivowares/waterwheel
10 |
11 | script: go test -v -bench=.
12 |
--------------------------------------------------------------------------------
/vendor/github.com/waterwheel/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-NOW Vivowares Inc.
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/waterwheel/buffered_writer.go:
--------------------------------------------------------------------------------
1 | package waterwheel
2 |
3 | import (
4 | "bufio"
5 | "io"
6 | )
7 |
8 | type BufferedWriteCloser struct {
9 | size int
10 | cur int
11 | wc io.WriteCloser
12 | bw *bufio.Writer
13 | }
14 |
15 | func NewBufferedWriteCloser(size int, w io.WriteCloser) *BufferedWriteCloser {
16 | return &BufferedWriteCloser{
17 | size: size,
18 | wc: w,
19 | bw: bufio.NewWriter(w),
20 | }
21 | }
22 |
23 | func (w *BufferedWriteCloser) Write(p []byte) (int, error) {
24 | n, err := w.bw.Write(p)
25 | w.cur += 1
26 | if w.cur >= w.size {
27 | w.bw.Flush()
28 | w.cur = 0
29 | }
30 | return n, err
31 | }
32 |
33 | func (w *BufferedWriteCloser) Close() error {
34 | w.bw.Flush()
35 | return w.wc.Close()
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/waterwheel/record.go:
--------------------------------------------------------------------------------
1 | package waterwheel
2 |
3 | import (
4 | "strings"
5 | "time"
6 | )
7 |
8 | type Level int
9 |
10 | const (
11 | Critical Level = iota
12 | Error
13 | Warn
14 | Info
15 | Debug
16 | )
17 |
18 | func (l Level) String() string {
19 | switch l {
20 | case Debug:
21 | return "DEBUG"
22 | case Info:
23 | return "INFO"
24 | case Warn:
25 | return "WARN"
26 | case Error:
27 | return "ERROR"
28 | case Critical:
29 | return "CRITICAL"
30 | default:
31 | panic("bad level")
32 | }
33 | }
34 |
35 | func MapLevel(lvl string) Level {
36 | switch strings.ToUpper(lvl) {
37 | case "CRITICAL":
38 | return Critical
39 | case "ERROR":
40 | return Error
41 | case "WARN":
42 | return Warn
43 | case "INFO":
44 | return Info
45 | case "DEBUG":
46 | return Debug
47 | default:
48 | return Debug
49 | }
50 | }
51 |
52 | type Record struct {
53 | Level Level
54 | Time time.Time
55 | Message string
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/github.com/waterwheel/sync_logger.go:
--------------------------------------------------------------------------------
1 | package waterwheel
2 |
3 | import (
4 | "io"
5 | "sync"
6 | "time"
7 | )
8 |
9 | type SyncLogger struct {
10 | wc io.WriteCloser
11 | sync.Mutex
12 | level Level
13 | f Formatter
14 | buf []byte
15 | closed bool
16 | }
17 |
18 | func (l *SyncLogger) Level() Level {
19 | return l.level
20 | }
21 |
22 | func NewSyncLogger(w io.WriteCloser, f Formatter, lvl string) *SyncLogger {
23 | return &SyncLogger{
24 | wc: w,
25 | level: MapLevel(lvl),
26 | f: f,
27 | buf: []byte{},
28 | }
29 | }
30 |
31 | func (l *SyncLogger) Close() error {
32 | l.Lock()
33 | defer l.Unlock()
34 |
35 | if l.closed {
36 | return nil
37 | }
38 |
39 | l.closed = true
40 | return l.wc.Close()
41 | }
42 |
43 | func (l *SyncLogger) Log(lvl Level, msg string) (err error) {
44 | if lvl <= l.level {
45 | l.Lock()
46 | defer l.Unlock()
47 |
48 | if l.closed {
49 | return CloseErr
50 | }
51 |
52 | l.buf = l.buf[:0]
53 | l.f(&Record{
54 | Level: lvl,
55 | Time: time.Now(),
56 | Message: msg,
57 | }, &l.buf)
58 |
59 | _, err := l.wc.Write(l.buf)
60 | return err
61 | }
62 |
63 | return nil
64 | }
65 |
66 | func (l *SyncLogger) Critical(msg string) error {
67 | return l.Log(Critical, msg)
68 | }
69 |
70 | func (l *SyncLogger) Error(msg string) error {
71 | return l.Log(Error, msg)
72 | }
73 |
74 | func (l *SyncLogger) Warn(msg string) error {
75 | return l.Log(Warn, msg)
76 | }
77 |
78 | func (l *SyncLogger) Info(msg string) error {
79 | return l.Log(Info, msg)
80 | }
81 |
82 | func (l *SyncLogger) Debug(msg string) error {
83 | return l.Log(Debug, msg)
84 | }
85 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, 2015 Carl Jackson (carl@avtok.com)
2 |
3 | MIT License
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/zenazn/goji/graceful/einhorn.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 |
3 | package graceful
4 |
5 | import (
6 | "os"
7 | "strconv"
8 | "syscall"
9 | )
10 |
11 | func init() {
12 | // This is a little unfortunate: goji/bind already knows whether we're
13 | // running under einhorn, but we don't want to introduce a dependency
14 | // between the two packages. Since the check is short enough, inlining
15 | // it here seems "fine."
16 | mpid, err := strconv.Atoi(os.Getenv("EINHORN_MASTER_PID"))
17 | if err != nil || mpid != os.Getppid() {
18 | return
19 | }
20 | stdSignals = append(stdSignals, syscall.SIGUSR2)
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/graceful/serve.go:
--------------------------------------------------------------------------------
1 | // +build !go1.3
2 |
3 | package graceful
4 |
5 | import (
6 | "net"
7 | "net/http"
8 | "time"
9 |
10 | "github.com/zenazn/goji/graceful/listener"
11 | )
12 |
13 | // About 200 years, also known as "forever"
14 | const forever time.Duration = 200 * 365 * 24 * time.Hour
15 |
16 | // Serve behaves like the method on net/http.Server with the same name.
17 | func (srv *Server) Serve(l net.Listener) error {
18 | // Spawn a shadow http.Server to do the actual servering. We do this
19 | // because we need to sketch on some of the parameters you passed in,
20 | // and it's nice to keep our sketching to ourselves.
21 | shadow := *(*http.Server)(srv)
22 |
23 | if shadow.ReadTimeout == 0 {
24 | shadow.ReadTimeout = forever
25 | }
26 | shadow.Handler = middleware(shadow.Handler)
27 |
28 | wrap := listener.Wrap(l, listener.Deadline)
29 | appendListener(wrap)
30 |
31 | err := shadow.Serve(wrap)
32 | return peacefulError(err)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/atomic.go:
--------------------------------------------------------------------------------
1 | // +build !appengine
2 |
3 | package web
4 |
5 | import (
6 | "sync/atomic"
7 | "unsafe"
8 | )
9 |
10 | func (rt *router) getMachine() *routeMachine {
11 | ptr := (*unsafe.Pointer)(unsafe.Pointer(&rt.machine))
12 | sm := (*routeMachine)(atomic.LoadPointer(ptr))
13 | return sm
14 | }
15 | func (rt *router) setMachine(m *routeMachine) {
16 | ptr := (*unsafe.Pointer)(unsafe.Pointer(&rt.machine))
17 | atomic.StorePointer(ptr, unsafe.Pointer(m))
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/atomic_appengine.go:
--------------------------------------------------------------------------------
1 | // +build appengine
2 |
3 | package web
4 |
5 | func (rt *router) getMachine() *routeMachine {
6 | rt.lock.Lock()
7 | defer rt.lock.Unlock()
8 | return rt.machine
9 | }
10 |
11 | // We always hold the lock when calling setMachine.
12 | func (rt *router) setMachine(m *routeMachine) {
13 | rt.machine = m
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/chanpool.go:
--------------------------------------------------------------------------------
1 | // +build !go1.3
2 |
3 | package web
4 |
5 | // This is an alternate implementation of Go 1.3's sync.Pool.
6 |
7 | // Maximum size of the pool of spare middleware stacks
8 | const cPoolSize = 32
9 |
10 | type cPool chan *cStack
11 |
12 | func makeCPool() *cPool {
13 | p := make(cPool, cPoolSize)
14 | return &p
15 | }
16 |
17 | func (c cPool) alloc() *cStack {
18 | select {
19 | case cs := <-c:
20 | return cs
21 | default:
22 | return nil
23 | }
24 | }
25 |
26 | func (c cPool) release(cs *cStack) {
27 | select {
28 | case c <- cs:
29 | default:
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/cpool.go:
--------------------------------------------------------------------------------
1 | // +build go1.3
2 |
3 | package web
4 |
5 | import "sync"
6 |
7 | type cPool sync.Pool
8 |
9 | func makeCPool() *cPool {
10 | return &cPool{}
11 | }
12 |
13 | func (c *cPool) alloc() *cStack {
14 | cs := (*sync.Pool)(c).Get()
15 | if cs == nil {
16 | return nil
17 | }
18 | return cs.(*cStack)
19 | }
20 |
21 | func (c *cPool) release(cs *cStack) {
22 | (*sync.Pool)(c).Put(cs)
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/func_equal.go:
--------------------------------------------------------------------------------
1 | package web
2 |
3 | import (
4 | "reflect"
5 | )
6 |
7 | /*
8 | This is more than a little sketchtacular. Go's rules for function pointer
9 | equality are pretty restrictive: nil function pointers always compare equal, and
10 | all other pointer types never do. However, this is pretty limiting: it means
11 | that we can't let people reference the middleware they've given us since we have
12 | no idea which function they're referring to.
13 |
14 | To get better data out of Go, we sketch on the representation of interfaces. We
15 | happen to know that interfaces are pairs of pointers: one to the real data, one
16 | to data about the type. Therefore, two interfaces, including two function
17 | interface{}'s, point to exactly the same objects iff their interface
18 | representations are identical. And it turns out this is sufficient for our
19 | purposes.
20 |
21 | If you're curious, you can read more about the representation of functions here:
22 | http://golang.org/s/go11func
23 | We're in effect comparing the pointers of the indirect layer.
24 |
25 | This function also works on non-function values.
26 | */
27 | func funcEqual(a, b interface{}) bool {
28 | av := reflect.ValueOf(&a).Elem()
29 | bv := reflect.ValueOf(&b).Elem()
30 |
31 | return av.InterfaceData() == bv.InterfaceData()
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/handler.go:
--------------------------------------------------------------------------------
1 | package web
2 |
3 | import (
4 | "log"
5 | "net/http"
6 | )
7 |
8 | const unknownHandler = `Unknown handler type %T. See http://godoc.org/github.com/zenazn/goji/web#HandlerType for a list of acceptable types.`
9 |
10 | type netHTTPHandlerWrap struct{ http.Handler }
11 | type netHTTPHandlerFuncWrap struct {
12 | fn func(http.ResponseWriter, *http.Request)
13 | }
14 | type handlerFuncWrap struct {
15 | fn func(C, http.ResponseWriter, *http.Request)
16 | }
17 |
18 | func (h netHTTPHandlerWrap) ServeHTTPC(c C, w http.ResponseWriter, r *http.Request) {
19 | h.Handler.ServeHTTP(w, r)
20 | }
21 | func (h netHTTPHandlerFuncWrap) ServeHTTPC(c C, w http.ResponseWriter, r *http.Request) {
22 | h.fn(w, r)
23 | }
24 | func (h handlerFuncWrap) ServeHTTPC(c C, w http.ResponseWriter, r *http.Request) {
25 | h.fn(c, w, r)
26 | }
27 |
28 | func parseHandler(h HandlerType) Handler {
29 | switch f := h.(type) {
30 | case func(c C, w http.ResponseWriter, r *http.Request):
31 | return handlerFuncWrap{f}
32 | case func(w http.ResponseWriter, r *http.Request):
33 | return netHTTPHandlerFuncWrap{f}
34 | case Handler:
35 | return f
36 | case http.Handler:
37 | return netHTTPHandlerWrap{f}
38 | default:
39 | log.Fatalf(unknownHandler, h)
40 | panic("log.Fatalf does not return")
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/middleware/envinit.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "net/http"
5 |
6 | "github.com/zenazn/goji/web"
7 | )
8 |
9 | type envInit struct {
10 | c *web.C
11 | h http.Handler
12 | }
13 |
14 | func (e envInit) ServeHTTP(w http.ResponseWriter, r *http.Request) {
15 | if e.c.Env == nil {
16 | e.c.Env = make(map[interface{}]interface{})
17 | }
18 | e.h.ServeHTTP(w, r)
19 | }
20 |
21 | // EnvInit is a middleware that allocates an environment map if it is nil. While
22 | // it's impossible in general to ensure that Env is never nil in a middleware
23 | // stack, in most common cases placing this middleware at the top of the stack
24 | // will eliminate the need for repetative nil checks.
25 | func EnvInit(c *web.C, h http.Handler) http.Handler {
26 | return envInit{c, h}
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/middleware/middleware.go:
--------------------------------------------------------------------------------
1 | /*
2 | Package middleware provides several standard middleware implementations.
3 | */
4 | package middleware
5 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/middleware/nocache.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "net/http"
5 | "time"
6 | )
7 |
8 | // Unix epoch time
9 | var epoch = time.Unix(0, 0).Format(time.RFC1123)
10 |
11 | // Taken from https://github.com/mytrile/nocache
12 | var noCacheHeaders = map[string]string{
13 | "Expires": epoch,
14 | "Cache-Control": "no-cache, private, max-age=0",
15 | "Pragma": "no-cache",
16 | "X-Accel-Expires": "0",
17 | }
18 |
19 | var etagHeaders = []string{
20 | "ETag",
21 | "If-Modified-Since",
22 | "If-Match",
23 | "If-None-Match",
24 | "If-Range",
25 | "If-Unmodified-Since",
26 | }
27 |
28 | // NoCache is a simple piece of middleware that sets a number of HTTP headers to prevent
29 | // a router (or subrouter) from being cached by an upstream proxy and/or client.
30 | //
31 | // As per http://wiki.nginx.org/HttpProxyModule - NoCache sets:
32 | // Expires: Thu, 01 Jan 1970 00:00:00 UTC
33 | // Cache-Control: no-cache, private, max-age=0
34 | // X-Accel-Expires: 0
35 | // Pragma: no-cache (for HTTP/1.0 proxies/clients)
36 | func NoCache(h http.Handler) http.Handler {
37 | fn := func(w http.ResponseWriter, r *http.Request) {
38 |
39 | // Delete any ETag headers that may have been set
40 | for _, v := range etagHeaders {
41 | if r.Header.Get(v) != "" {
42 | r.Header.Del(v)
43 | }
44 | }
45 |
46 | // Set our NoCache headers
47 | for k, v := range noCacheHeaders {
48 | w.Header().Set(k, v)
49 | }
50 |
51 | h.ServeHTTP(w, r)
52 | }
53 |
54 | return http.HandlerFunc(fn)
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/middleware/recoverer.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "bytes"
5 | "log"
6 | "net/http"
7 | "runtime/debug"
8 |
9 | "github.com/zenazn/goji/web"
10 | )
11 |
12 | // Recoverer is a middleware that recovers from panics, logs the panic (and a
13 | // backtrace), and returns a HTTP 500 (Internal Server Error) status if
14 | // possible.
15 | //
16 | // Recoverer prints a request ID if one is provided.
17 | func Recoverer(c *web.C, h http.Handler) http.Handler {
18 | fn := func(w http.ResponseWriter, r *http.Request) {
19 | reqID := GetReqID(*c)
20 |
21 | defer func() {
22 | if err := recover(); err != nil {
23 | printPanic(reqID, err)
24 | debug.PrintStack()
25 | http.Error(w, http.StatusText(500), 500)
26 | }
27 | }()
28 |
29 | h.ServeHTTP(w, r)
30 | }
31 |
32 | return http.HandlerFunc(fn)
33 | }
34 |
35 | func printPanic(reqID string, err interface{}) {
36 | var buf bytes.Buffer
37 |
38 | if reqID != "" {
39 | cW(&buf, bBlack, "[%s] ", reqID)
40 | }
41 | cW(&buf, bRed, "panic: %+v", err)
42 |
43 | log.Print(buf.String())
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/zenazn/goji/web/mutil/mutil.go:
--------------------------------------------------------------------------------
1 | // Package mutil contains various functions that are helpful when writing http
2 | // middleware.
3 | package mutil
4 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/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/golang.org/x/crypto/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/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/net/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/golang.org/x/net/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/golang.org/x/net/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/net/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/net/proxy/direct.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 | package proxy
6 |
7 | import (
8 | "net"
9 | )
10 |
11 | type direct struct{}
12 |
13 | // Direct is a direct proxy: one that makes network connections directly.
14 | var Direct = direct{}
15 |
16 | func (direct) Dial(network, addr string) (net.Conn, error) {
17 | return net.Dial(network, addr)
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Nate Finch
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/gopkg.in/natefinch/lumberjack.v2/chown.go:
--------------------------------------------------------------------------------
1 | // +build !linux
2 |
3 | package lumberjack
4 |
5 | import (
6 | "os"
7 | )
8 |
9 | func chown(_ string, _ os.FileInfo) error {
10 | return nil
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/chown_linux.go:
--------------------------------------------------------------------------------
1 | package lumberjack
2 |
3 | import (
4 | "os"
5 | "syscall"
6 | )
7 |
8 | // os_Chown is a var so we can mock it out during tests.
9 | var os_Chown = os.Chown
10 |
11 | func chown(name string, info os.FileInfo) error {
12 | f, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, info.Mode())
13 | if err != nil {
14 | return err
15 | }
16 | f.Close()
17 | stat := info.Sys().(*syscall.Stat_t)
18 | return os_Chown(name, int(stat.Uid), int(stat.Gid))
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
24 | /generator
25 | /cluster-test/cluster-test
26 | /cluster-test/*.log
27 | /cluster-test/es-chaos-monkey
28 | /spec
29 | /tmp
30 | /CHANGELOG-3.0.html
31 |
32 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | language: go
4 |
5 | go:
6 | #- 1.4
7 | - 1.5.2
8 | #- tip
9 |
10 | env:
11 | matrix:
12 | - ES_VERSION=2.1.1
13 |
14 | before_script:
15 | - mkdir ${HOME}/elasticsearch
16 | - wget http://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.tar.gz
17 | - tar -xzvf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch
18 | - ls -alFR ${HOME}/elasticsearch
19 | - cp config/elasticsearch.yml ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/
20 | - cat ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml
21 | - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >& /dev/null &
22 | - sleep 15
23 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | Elastic is an open-source project and we are looking forward to each
4 | contribution.
5 |
6 | ## Your Pull Request
7 |
8 | To make it easy to review and understand your changes, please keep the
9 | following things in mind before submitting your pull request:
10 |
11 | * Work on the latest possible state of `olivere/elastic`.
12 | * Create a branch dedicated to your change.
13 | * If possible, write a test case which confirms your change.
14 | * Make sure your changes and your tests work with all recent versions of
15 | Elasticsearch. At the moment, we're targeting the current and the previous
16 | release, e.g. the 1.4 and the 1.3 branch.
17 | * Test your changes before creating a pull request (`go test ./...`).
18 | * Don't mix several features or bug fixes in one pull request.
19 | * Create a meaningful commit message.
20 | * Explain your change, e.g. provide a link to the issue you are fixing and
21 | probably a link to the Elasticsearch documentation and/or source code.
22 | * Format your source with `go fmt`.
23 |
24 | ## Additional Resources
25 |
26 | * [GitHub documentation](http://help.github.com/)
27 | * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
28 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This is a list of people who have contributed code
2 | # to the Elastic repository.
3 | #
4 | # It is just my small "thank you" to all those that helped
5 | # making Elastic what it is.
6 | #
7 | # Please keep this list sorted.
8 |
9 | Adam Weiner [@adamweiner](https://github.com/adamweiner)
10 | Alexey Sharov [@nizsheanez](https://github.com/nizsheanez)
11 | Braden Bassingthwaite [@bbassingthwaite-va](https://github.com/bbassingthwaite-va)
12 | Conrad Pankoff [@deoxxa](https://github.com/deoxxa)
13 | Corey Scott [@corsc](https://github.com/corsc)
14 | Daniel Heckrath [@DanielHeckrath](https://github.com/DanielHeckrath)
15 | Gerhard Häring [@ghaering](https://github.com/ghaering)
16 | Guilherme Silveira [@guilherme-santos](https://github.com/guilherme-santos)
17 | Guillaume J. Charmes [@creack](https://github.com/creack)
18 | Isaac Saldana [@isaldana](https://github.com/isaldana)
19 | Jack Lindamood [@cep21](https://github.com/cep21)
20 | Junpei Tsuji [@jun06t](https://github.com/jun06t)
21 | Maciej Lisiewski [@c2h5oh](https://github.com/c2h5oh)
22 | Mara Kim [@autochthe](https://github.com/autochthe)
23 | Medhi Bechina [@mdzor](https://github.com/mdzor)
24 | Nicholas Wolff [@nwolff](https://github.com/nwolff)
25 | Orne Brocaar [@brocaar](https://github.com/brocaar)
26 | Sacheendra talluri [@sacheendra](https://github.com/sacheendra)
27 | Sean DuBois [@Sean-Der](https://github.com/Sean-Der)
28 | Tetsuya Morimoto [@t2y](https://github.com/t2y)
29 | zakthomas [@zakthomas](https://github.com/zakthomas)
30 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright © 2012-2015 Oliver Eilhard
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the “Software”), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 | IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/bulk_request.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import (
8 | "fmt"
9 | )
10 |
11 | // -- Bulkable request (index/update/delete) --
12 |
13 | // Generic interface to bulkable requests.
14 | type BulkableRequest interface {
15 | fmt.Stringer
16 | Source() ([]string, error)
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/canonicalize.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import "net/url"
8 |
9 | // canonicalize takes a list of URLs and returns its canonicalized form, i.e.
10 | // remove anything but scheme, userinfo, host, and port. It also removes the
11 | // slash at the end. It also skips invalid URLs or URLs that do not use
12 | // protocol http or https.
13 | //
14 | // Example:
15 | // http://127.0.0.1:9200/path?query=1 -> http://127.0.0.1:9200
16 | func canonicalize(rawurls ...string) []string {
17 | canonicalized := make([]string, 0)
18 | for _, rawurl := range rawurls {
19 | u, err := url.Parse(rawurl)
20 | if err == nil && (u.Scheme == "http" || u.Scheme == "https") {
21 | u.Fragment = ""
22 | u.Path = ""
23 | u.RawQuery = ""
24 | canonicalized = append(canonicalized, u.String())
25 | }
26 | }
27 | return canonicalized
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/decoder.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import (
8 | "encoding/json"
9 | )
10 |
11 | // Decoder is used to decode responses from Elasticsearch.
12 | // Users of elastic can implement their own marshaler for advanced purposes
13 | // and set them per Client (see SetDecoder). If none is specified,
14 | // DefaultDecoder is used.
15 | type Decoder interface {
16 | Decode(data []byte, v interface{}) error
17 | }
18 |
19 | // DefaultDecoder uses json.Unmarshal from the Go standard library
20 | // to decode JSON data.
21 | type DefaultDecoder struct{}
22 |
23 | // Decode decodes with json.Unmarshal from the Go standard library.
24 | func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
25 | return json.Unmarshal(data, v)
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/geo_point.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import (
8 | "fmt"
9 | "strconv"
10 | "strings"
11 | )
12 |
13 | // GeoPoint is a geographic position described via latitude and longitude.
14 | type GeoPoint struct {
15 | Lat float64 `json:"lat"`
16 | Lon float64 `json:"lon"`
17 | }
18 |
19 | // Source returns the object to be serialized in Elasticsearch DSL.
20 | func (pt *GeoPoint) Source() map[string]float64 {
21 | return map[string]float64{
22 | "lat": pt.Lat,
23 | "lon": pt.Lon,
24 | }
25 | }
26 |
27 | // GeoPointFromLatLon initializes a new GeoPoint by latitude and longitude.
28 | func GeoPointFromLatLon(lat, lon float64) *GeoPoint {
29 | return &GeoPoint{Lat: lat, Lon: lon}
30 | }
31 |
32 | // GeoPointFromString initializes a new GeoPoint by a string that is
33 | // formatted as "{latitude},{longitude}", e.g. "40.10210,-70.12091".
34 | func GeoPointFromString(latLon string) (*GeoPoint, error) {
35 | latlon := strings.SplitN(latLon, ",", 2)
36 | if len(latlon) != 2 {
37 | return nil, fmt.Errorf("elastic: %s is not a valid geo point string", latLon)
38 | }
39 | lat, err := strconv.ParseFloat(latlon[0], 64)
40 | if err != nil {
41 | return nil, err
42 | }
43 | lon, err := strconv.ParseFloat(latlon[1], 64)
44 | if err != nil {
45 | return nil, err
46 | }
47 | return &GeoPoint{Lat: lat, Lon: lon}, nil
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/plugins.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // HasPlugin indicates whether the cluster has the named plugin.
8 | func (c *Client) HasPlugin(name string) (bool, error) {
9 | plugins, err := c.Plugins()
10 | if err != nil {
11 | return false, nil
12 | }
13 | for _, plugin := range plugins {
14 | if plugin == name {
15 | return true, nil
16 | }
17 | }
18 | return false, nil
19 | }
20 |
21 | // Plugins returns the list of all registered plugins.
22 | func (c *Client) Plugins() ([]string, error) {
23 | stats, err := c.ClusterStats().Do()
24 | if err != nil {
25 | return nil, err
26 | }
27 | if stats == nil {
28 | return nil, err
29 | }
30 | if stats.Nodes == nil {
31 | return nil, err
32 | }
33 | var plugins []string
34 | for _, plugin := range stats.Nodes.Plugins {
35 | plugins = append(plugins, plugin.Name)
36 | }
37 | return plugins, nil
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/query.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // Query represents the generic query interface. A query's sole purpose
8 | // is to return the source of the query as a JSON-serializable object.
9 | // Returning map[string]interface{} is the norm for queries.
10 | type Query interface {
11 | // Source returns the JSON-serializable query request.
12 | Source() (interface{}, error)
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/rescore.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | type Rescore struct {
8 | rescorer Rescorer
9 | windowSize *int
10 | defaultRescoreWindowSize *int
11 | }
12 |
13 | func NewRescore() *Rescore {
14 | return &Rescore{}
15 | }
16 |
17 | func (r *Rescore) WindowSize(windowSize int) *Rescore {
18 | r.windowSize = &windowSize
19 | return r
20 | }
21 |
22 | func (r *Rescore) IsEmpty() bool {
23 | return r.rescorer == nil
24 | }
25 |
26 | func (r *Rescore) Rescorer(rescorer Rescorer) *Rescore {
27 | r.rescorer = rescorer
28 | return r
29 | }
30 |
31 | func (r *Rescore) Source() (interface{}, error) {
32 | source := make(map[string]interface{})
33 | if r.windowSize != nil {
34 | source["window_size"] = *r.windowSize
35 | } else if r.defaultRescoreWindowSize != nil {
36 | source["window_size"] = *r.defaultRescoreWindowSize
37 | }
38 | rescorerSrc, err := r.rescorer.Source()
39 | if err != nil {
40 | return nil, err
41 | }
42 | source[r.rescorer.Name()] = rescorerSrc
43 | return source, nil
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/response.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import (
8 | "encoding/json"
9 | "io/ioutil"
10 | "net/http"
11 | )
12 |
13 | // Response represents a response from Elasticsearch.
14 | type Response struct {
15 | // StatusCode is the HTTP status code, e.g. 200.
16 | StatusCode int
17 | // Header is the HTTP header from the HTTP response.
18 | // Keys in the map are canonicalized (see http.CanonicalHeaderKey).
19 | Header http.Header
20 | // Body is the deserialized response body.
21 | Body json.RawMessage
22 | }
23 |
24 | // newResponse creates a new response from the HTTP response.
25 | func (c *Client) newResponse(res *http.Response) (*Response, error) {
26 | r := &Response{
27 | StatusCode: res.StatusCode,
28 | Header: res.Header,
29 | }
30 | if res.Body != nil {
31 | slurp, err := ioutil.ReadAll(res.Body)
32 | if err != nil {
33 | return nil, err
34 | }
35 | // HEAD requests return a body but no content
36 | if len(slurp) > 0 {
37 | if err := c.decoder.Decode(slurp, &r.Body); err != nil {
38 | return nil, err
39 | }
40 | }
41 | }
42 | return r, nil
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/search_queries_exists.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // ExistsQuery is a query that only matches on documents that the field
8 | // has a value in them.
9 | //
10 | // For more details, see:
11 | // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html
12 | type ExistsQuery struct {
13 | name string
14 | queryName string
15 | }
16 |
17 | // NewExistsQuery creates and initializes a new dis max query.
18 | func NewExistsQuery(name string) *ExistsQuery {
19 | return &ExistsQuery{
20 | name: name,
21 | }
22 | }
23 |
24 | // QueryName sets the query name for the filter that can be used
25 | // when searching for matched queries per hit.
26 | func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery {
27 | q.queryName = queryName
28 | return q
29 | }
30 |
31 | // Source returns the JSON serializable content for this query.
32 | func (q *ExistsQuery) Source() (interface{}, error) {
33 | // {
34 | // "exists" : {
35 | // "field" : "user"
36 | // }
37 | // }
38 |
39 | query := make(map[string]interface{})
40 | params := make(map[string]interface{})
41 | query["exists"] = params
42 |
43 | params["field"] = q.name
44 | if q.queryName != "" {
45 | params["_name"] = q.queryName
46 | }
47 |
48 | return query, nil
49 | }
50 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/search_queries_match_all.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // MatchAllQuery is the most simple query, which matches all documents,
8 | // giving them all a _score of 1.0.
9 | //
10 | // For more details, see
11 | // https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-match-all-query.html
12 | type MatchAllQuery struct {
13 | boost *float64
14 | }
15 |
16 | // NewMatchAllQuery creates and initializes a new match all query.
17 | func NewMatchAllQuery() *MatchAllQuery {
18 | return &MatchAllQuery{}
19 | }
20 |
21 | // Boost sets the boost for this query. Documents matching this query will
22 | // (in addition to the normal weightings) have their score multiplied by the
23 | // boost provided.
24 | func (q *MatchAllQuery) Boost(boost float64) *MatchAllQuery {
25 | q.boost = &boost
26 | return q
27 | }
28 |
29 | // Source returns JSON for the function score query.
30 | func (q MatchAllQuery) Source() (interface{}, error) {
31 | // {
32 | // "match_all" : { ... }
33 | // }
34 | source := make(map[string]interface{})
35 | params := make(map[string]interface{})
36 | source["match_all"] = params
37 | if q.boost != nil {
38 | params["boost"] = *q.boost
39 | }
40 | return source, nil
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/search_queries_not.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // NotQuery filters out matched documents using a query.
8 | //
9 | // For details, see
10 | // https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-not-query.html
11 | type NotQuery struct {
12 | filter Query
13 | queryName string
14 | }
15 |
16 | // NewNotQuery creates and initializes a new NotQuery.
17 | func NewNotQuery(filter Query) *NotQuery {
18 | return &NotQuery{
19 | filter: filter,
20 | }
21 | }
22 |
23 | // QueryName sets the query name for the filter that can be used
24 | // when searching for matched_filters per hit
25 | func (q *NotQuery) QueryName(queryName string) *NotQuery {
26 | q.queryName = queryName
27 | return q
28 | }
29 |
30 | // Source returns JSON for the query.
31 | func (q *NotQuery) Source() (interface{}, error) {
32 | source := make(map[string]interface{})
33 | params := make(map[string]interface{})
34 | source["not"] = params
35 |
36 | src, err := q.filter.Source()
37 | if err != nil {
38 | return nil, err
39 | }
40 | params["query"] = src
41 | if q.queryName != "" {
42 | params["_name"] = q.queryName
43 | }
44 | return source, nil
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/search_queries_script.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | import "errors"
8 |
9 | // ScriptQuery allows to define scripts as filters.
10 | //
11 | // For details, see
12 | // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html
13 | type ScriptQuery struct {
14 | script *Script
15 | queryName string
16 | }
17 |
18 | // NewScriptQuery creates and initializes a new ScriptQuery.
19 | func NewScriptQuery(script *Script) *ScriptQuery {
20 | return &ScriptQuery{
21 | script: script,
22 | }
23 | }
24 |
25 | // QueryName sets the query name for the filter that can be used
26 | // when searching for matched_filters per hit
27 | func (q *ScriptQuery) QueryName(queryName string) *ScriptQuery {
28 | q.queryName = queryName
29 | return q
30 | }
31 |
32 | // Source returns JSON for the query.
33 | func (q *ScriptQuery) Source() (interface{}, error) {
34 | if q.script == nil {
35 | return nil, errors.New("ScriptQuery expected a script")
36 | }
37 | source := make(map[string]interface{})
38 | params := make(map[string]interface{})
39 | source["script"] = params
40 |
41 | src, err := q.script.Source()
42 | if err != nil {
43 | return nil, err
44 | }
45 | params["script"] = src
46 |
47 | if q.queryName != "" {
48 | params["_name"] = q.queryName
49 | }
50 | return source, nil
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/search_queries_type.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // TypeQuery filters documents matching the provided document / mapping type.
8 | //
9 | // For details, see:
10 | // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-type-query.html
11 | type TypeQuery struct {
12 | typ string
13 | }
14 |
15 | func NewTypeQuery(typ string) *TypeQuery {
16 | return &TypeQuery{typ: typ}
17 | }
18 |
19 | // Source returns JSON for the query.
20 | func (q *TypeQuery) Source() (interface{}, error) {
21 | source := make(map[string]interface{})
22 | params := make(map[string]interface{})
23 | source["type"] = params
24 | params["value"] = q.typ
25 | return source, nil
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/suggester.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // Represents the generic suggester interface.
8 | // A suggester's only purpose is to return the
9 | // source of the query as a JSON-serializable
10 | // object. Returning a map[string]interface{}
11 | // will do.
12 | type Suggester interface {
13 | Name() string
14 | Source(includeName bool) (interface{}, error)
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/suggester_context.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012-2015 Oliver Eilhard. All rights reserved.
2 | // Use of this source code is governed by a MIT-license.
3 | // See http://olivere.mit-license.org/license.txt for details.
4 |
5 | package elastic
6 |
7 | // SuggesterContextQuery is used to define context information within
8 | // a suggestion request.
9 | type SuggesterContextQuery interface {
10 | Source() (interface{}, error)
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/uritemplates/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 Joshua Tacoma
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | 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, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/olivere/elastic.v3/uritemplates/utils.go:
--------------------------------------------------------------------------------
1 | package uritemplates
2 |
3 | func Expand(path string, expansions map[string]string) (string, error) {
4 | template, err := Parse(path)
5 | if err != nil {
6 | return "", err
7 | }
8 | values := make(map[string]interface{})
9 | for k, v := range expansions {
10 | values[k] = v
11 | }
12 | return template.Expand(values)
13 | }
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------