├── .gitignore ├── Godeps ├── README.md ├── bsonutil ├── bsonutil.go └── bsonutil_test.go ├── buffer ├── read.go ├── read_test.go └── write.go ├── convert ├── convert.go └── convert_test.go ├── example_bi_config.json ├── log └── log.go ├── main ├── frontend.go └── server.go ├── messages ├── decode.go ├── decode_test.go ├── encode.go ├── encode_test.go ├── messages.go ├── request.go ├── request_helpers.go ├── response.go └── response_helpers.go ├── mock └── io.go ├── modules ├── bi │ ├── README.md │ ├── frontend │ │ ├── README.md │ │ ├── controllers │ │ │ ├── config.go │ │ │ ├── controllers.go │ │ │ └── metrics.go │ │ ├── package.json │ │ ├── public │ │ │ ├── css │ │ │ │ ├── components │ │ │ │ │ └── json-editor.less │ │ │ │ ├── main.less │ │ │ │ └── vendor │ │ │ │ │ └── bootstrap-multiselect.less │ │ │ └── js │ │ │ │ ├── ajax │ │ │ │ └── controller.js │ │ │ │ ├── components │ │ │ │ ├── addRule.js │ │ │ │ ├── granularityToggle.js │ │ │ │ ├── ruleSelector.js │ │ │ │ └── timeseriesChart.js │ │ │ │ ├── config.js │ │ │ │ ├── main.js │ │ │ │ ├── sections │ │ │ │ ├── connectionConfig.js │ │ │ │ ├── graphPanel.js │ │ │ │ └── ruleConfig.js │ │ │ │ ├── utils │ │ │ │ ├── addLabelToRules.js │ │ │ │ ├── convertTimeGranularity.js │ │ │ │ ├── getCurrentMetric.js │ │ │ │ ├── granularities.js │ │ │ │ └── populateRuleValues.js │ │ │ │ └── vendor │ │ │ │ └── jquery.timer.js │ │ ├── server.go │ │ └── views │ │ │ ├── config_ui.html │ │ │ └── index.html │ ├── granularities.go │ ├── metadata.go │ ├── module.go │ ├── rules.go │ └── rules_test.go ├── mockule │ ├── README.md │ └── mockule.go └── mongod │ ├── README.md │ └── module.go ├── proxy.go ├── server ├── chain.go ├── chain_test.go ├── config │ └── installed_modules.go ├── modules.go └── registry.go ├── set_gopath.bat ├── set_gopath.sh ├── start.sh ├── test.sh ├── tests ├── main │ └── test_server.go ├── test.js └── test_dir.js ├── vendor.sh └── vendor └── src ├── github.com ├── gin-gonic │ └── gin │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS.md │ │ ├── BENCHMARKS.md │ │ ├── CHANGELOG.md │ │ ├── Godeps │ │ └── Godeps.json │ │ ├── LICENSE │ │ ├── README.md │ │ ├── auth.go │ │ ├── auth_test.go │ │ ├── benchmarks_test.go │ │ ├── binding │ │ ├── binding.go │ │ ├── binding_test.go │ │ ├── default_validator.go │ │ ├── form.go │ │ ├── form_mapping.go │ │ ├── json.go │ │ ├── validate_test.go │ │ └── xml.go │ │ ├── context.go │ │ ├── context_test.go │ │ ├── debug.go │ │ ├── debug_test.go │ │ ├── deprecated.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── examples │ │ ├── app-engine │ │ │ ├── README.md │ │ │ ├── app.yaml │ │ │ └── hello.go │ │ ├── basic │ │ │ └── main.go │ │ ├── realtime-advanced │ │ │ ├── main.go │ │ │ ├── resources │ │ │ │ ├── room_login.templ.html │ │ │ │ └── static │ │ │ │ │ ├── epoch.min.css │ │ │ │ │ ├── epoch.min.js │ │ │ │ │ ├── prismjs.min.css │ │ │ │ │ ├── prismjs.min.js │ │ │ │ │ └── realtime.js │ │ │ ├── rooms.go │ │ │ ├── routes.go │ │ │ └── stats.go │ │ └── realtime-chat │ │ │ ├── main.go │ │ │ ├── rooms.go │ │ │ └── template.go │ │ ├── fs.go │ │ ├── gin.go │ │ ├── gin_integration_test.go │ │ ├── gin_test.go │ │ ├── githubapi_test.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── middleware_test.go │ │ ├── mode.go │ │ ├── mode_test.go │ │ ├── path.go │ │ ├── path_test.go │ │ ├── recovery.go │ │ ├── recovery_test.go │ │ ├── render │ │ ├── data.go │ │ ├── html.go │ │ ├── json.go │ │ ├── redirect.go │ │ ├── render.go │ │ ├── render_test.go │ │ ├── text.go │ │ └── xml.go │ │ ├── response_writer.go │ │ ├── response_writer_test.go │ │ ├── routergroup.go │ │ ├── routergroup_test.go │ │ ├── routes_test.go │ │ ├── tree.go │ │ ├── tree_test.go │ │ ├── utils.go │ │ ├── utils_test.go │ │ └── wercker.yml ├── jtolds │ └── gls │ │ ├── LICENSE │ │ ├── README.md │ │ ├── context.go │ │ ├── context_test.go │ │ ├── gen_sym.go │ │ ├── id_pool.go │ │ └── stack_tags.go ├── manucorporat │ └── sse │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── sse-decoder.go │ │ ├── sse-decoder_test.go │ │ ├── sse-encoder.go │ │ ├── sse_test.go │ │ └── writer.go ├── mattn │ └── go-colorable │ │ ├── README.md │ │ ├── _example │ │ └── main.go │ │ ├── colorable_others.go │ │ └── colorable_windows.go ├── op │ └── go-logging │ │ ├── .travis.yml │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backend.go │ │ ├── example_test.go │ │ ├── examples │ │ ├── example.go │ │ └── example.png │ │ ├── format.go │ │ ├── format_test.go │ │ ├── level.go │ │ ├── level_test.go │ │ ├── log.go │ │ ├── log_test.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── memory.go │ │ ├── memory_test.go │ │ ├── multi.go │ │ ├── multi_test.go │ │ ├── syslog.go │ │ └── syslog_fallback.go └── smartystreets │ ├── assertions │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE.md │ ├── README.md │ ├── assertions.goconvey │ ├── collections.go │ ├── collections_test.go │ ├── doc.go │ ├── doc_test.go │ ├── equality.go │ ├── equality_test.go │ ├── filter.go │ ├── internal │ │ ├── Makefile │ │ ├── oglematchers │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── all_of.go │ │ │ ├── all_of_test.go │ │ │ ├── any.go │ │ │ ├── any_of.go │ │ │ ├── any_of_test.go │ │ │ ├── any_test.go │ │ │ ├── contains.go │ │ │ ├── contains_test.go │ │ │ ├── deep_equals.go │ │ │ ├── deep_equals_test.go │ │ │ ├── elements_are.go │ │ │ ├── elements_are_test.go │ │ │ ├── equals.go │ │ │ ├── equals_test.go │ │ │ ├── error.go │ │ │ ├── error_test.go │ │ │ ├── greater_or_equal.go │ │ │ ├── greater_or_equal_test.go │ │ │ ├── greater_than.go │ │ │ ├── greater_than_test.go │ │ │ ├── has_same_type_as.go │ │ │ ├── has_same_type_as_test.go │ │ │ ├── has_substr.go │ │ │ ├── has_substr_test.go │ │ │ ├── identical_to.go │ │ │ ├── identical_to_test.go │ │ │ ├── less_or_equal.go │ │ │ ├── less_or_equal_test.go │ │ │ ├── less_than.go │ │ │ ├── less_than_test.go │ │ │ ├── matcher.go │ │ │ ├── matches_regexp.go │ │ │ ├── matches_regexp_test.go │ │ │ ├── new_matcher.go │ │ │ ├── not.go │ │ │ ├── not_test.go │ │ │ ├── panics.go │ │ │ ├── panics_test.go │ │ │ ├── pointee.go │ │ │ ├── pointee_test.go │ │ │ └── transform_description.go │ │ ├── oglemock │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── action.go │ │ │ ├── controller.go │ │ │ ├── controller_test.go │ │ │ ├── createmock │ │ │ │ ├── createmock.go │ │ │ │ ├── createmock_test.go │ │ │ │ └── test_cases │ │ │ │ │ ├── golden.no_interfaces │ │ │ │ │ ├── golden.no_package │ │ │ │ │ ├── golden.unknown_interface │ │ │ │ │ └── golden.unknown_package │ │ │ ├── do_all.go │ │ │ ├── do_all_test.go │ │ │ ├── error_reporter.go │ │ │ ├── expectation.go │ │ │ ├── generate │ │ │ │ ├── generate.go │ │ │ │ ├── generate_test.go │ │ │ │ └── test_cases │ │ │ │ │ ├── complicated_pkg │ │ │ │ │ └── complicated_pkg.go │ │ │ │ │ ├── golden.complicated_pkg.go │ │ │ │ │ ├── golden.image.go │ │ │ │ │ ├── golden.io_reader_writer.go │ │ │ │ │ ├── golden.renamed_pkg.go │ │ │ │ │ └── renamed_pkg │ │ │ │ │ └── renamed_pkg.go │ │ │ ├── integration_test.go │ │ │ ├── internal_expectation.go │ │ │ ├── internal_expectation_test.go │ │ │ ├── invoke.go │ │ │ ├── invoke_test.go │ │ │ ├── mock_object.go │ │ │ ├── return.go │ │ │ ├── return_test.go │ │ │ ├── sample │ │ │ │ ├── README.markdown │ │ │ │ └── mock_io │ │ │ │ │ └── mock_io.go │ │ │ ├── save_arg.go │ │ │ └── save_arg_test.go │ │ ├── ogletest │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── assert_aliases.go │ │ │ ├── assert_that.go │ │ │ ├── doc.go │ │ │ ├── expect_aliases.go │ │ │ ├── expect_call.go │ │ │ ├── expect_that.go │ │ │ ├── expect_that_test.go │ │ │ ├── failure.go │ │ │ ├── integration_test.go │ │ │ ├── register.go │ │ │ ├── register_test_suite.go │ │ │ ├── run_tests.go │ │ │ ├── srcutil │ │ │ │ ├── docs.go │ │ │ │ ├── methods.go │ │ │ │ └── methods_test.go │ │ │ ├── test_cases │ │ │ │ ├── failing.test.go │ │ │ │ ├── filtered.test.go │ │ │ │ ├── golden.failing_test │ │ │ │ ├── golden.filtered_test │ │ │ │ ├── golden.mock_test │ │ │ │ ├── golden.no_cases_test │ │ │ │ ├── golden.panicking_test │ │ │ │ ├── golden.passing_test │ │ │ │ ├── golden.run_twice_test │ │ │ │ ├── golden.stop_test │ │ │ │ ├── golden.unexported_test │ │ │ │ ├── mock.test.go │ │ │ │ ├── mock_image │ │ │ │ │ └── mock_image.go │ │ │ │ ├── no_cases.test.go │ │ │ │ ├── panicking.test.go │ │ │ │ ├── passing.test.go │ │ │ │ ├── run_twice.test.go │ │ │ │ ├── stop.test.go │ │ │ │ └── unexported.test.go │ │ │ └── test_info.go │ │ └── reqtrace │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── reqtrace.go │ │ │ └── trace_state.go │ ├── messages.go │ ├── panic.go │ ├── panic_test.go │ ├── quantity.go │ ├── quantity_test.go │ ├── serializer.go │ ├── serializer_test.go │ ├── should │ │ └── should.go │ ├── strings.go │ ├── strings_test.go │ ├── time.go │ ├── time_test.go │ ├── type.go │ ├── type_test.go │ └── utilities_for_test.go │ └── goconvey │ ├── .gitignore │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── LICENSE.md │ ├── README.md │ ├── convey │ ├── assertions.go │ ├── context.go │ ├── convey.goconvey │ ├── discovery.go │ ├── doc.go │ ├── focused_execution_test.go │ ├── gotest │ │ └── utils.go │ ├── init.go │ ├── isolated_execution_test.go │ ├── nilReporter.go │ ├── reporting │ │ ├── console.go │ │ ├── doc.go │ │ ├── dot.go │ │ ├── dot_test.go │ │ ├── gotest.go │ │ ├── gotest_test.go │ │ ├── init.go │ │ ├── json.go │ │ ├── printer.go │ │ ├── printer_test.go │ │ ├── problems.go │ │ ├── problems_test.go │ │ ├── reporter.go │ │ ├── reporter_test.go │ │ ├── reporting.goconvey │ │ ├── reports.go │ │ ├── statistics.go │ │ └── story.go │ ├── reporting_hooks_test.go │ └── story_conventions_test.go │ ├── dependencies.go │ ├── examples │ ├── assertion_examples_test.go │ ├── bowling_game.go │ ├── bowling_game_test.go │ ├── doc.go │ ├── examples.goconvey │ └── simple_example_test.go │ ├── goconvey.go │ └── web │ ├── client │ ├── composer.html │ ├── favicon.ico │ ├── index.html │ └── resources │ │ ├── css │ │ ├── common.css │ │ ├── composer.css │ │ ├── font-awesome.min.css │ │ ├── themes │ │ │ ├── dark-bigtext.css │ │ │ ├── dark.css │ │ │ └── light.css │ │ └── tipsy.css │ │ ├── fonts │ │ ├── FontAwesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── Open_Sans │ │ │ ├── LICENSE.txt │ │ │ ├── OpenSans-Bold.ttf │ │ │ ├── OpenSans-Italic.ttf │ │ │ ├── OpenSans-Light.ttf │ │ │ ├── OpenSans-LightItalic.ttf │ │ │ └── OpenSans-Regular.ttf │ │ ├── Orbitron │ │ │ ├── OFL.txt │ │ │ └── Orbitron-Regular.ttf │ │ └── Oswald │ │ │ ├── OFL.txt │ │ │ └── Oswald-Regular.ttf │ │ ├── ico │ │ ├── goconvey-buildfail.ico │ │ ├── goconvey-fail.ico │ │ ├── goconvey-ok.ico │ │ └── goconvey-panic.ico │ │ └── js │ │ ├── composer.js │ │ ├── config.js │ │ ├── convey.js │ │ ├── goconvey.js │ │ ├── lib │ │ ├── ansispan.js │ │ ├── diff-match-patch.min.js │ │ ├── jquery-2_1_0.min.js │ │ ├── jquery-ui-1_10_3-custom.min.js │ │ ├── jquery.pretty-text-diff.min.js │ │ ├── jquery.tipsy.min.js │ │ ├── markup.min.js │ │ ├── moment.min.js │ │ └── taboverride.min.js │ │ └── poller.js │ └── server │ ├── api │ ├── api.goconvey │ ├── server.go │ └── server_test.go │ ├── contract │ ├── contracts.go │ └── result.go │ ├── executor │ ├── contract.go │ ├── coordinator.go │ ├── executor.go │ ├── executor.goconvey │ ├── executor_test.go │ ├── tester.go │ └── tester_test.go │ ├── messaging │ └── messages.go │ ├── parser │ ├── packageParser.go │ ├── package_parser_test.go │ ├── parser.go │ ├── parser.goconvey │ ├── parser_test.go │ ├── rules.go │ ├── testParser.go │ └── util.go │ ├── system │ ├── shell.go │ ├── shell_integration_test.go │ ├── shell_test.go │ └── system.goconvey │ └── watch │ ├── functional_core.go │ ├── functional_core_test.go │ ├── imperative_shell.go │ ├── integration.go │ ├── integration_test.go │ ├── integration_testing │ ├── main.go │ └── sub │ │ ├── .gitignore │ │ ├── stuff.go │ │ ├── stuff_test.go │ │ └── sub.goconvey │ ├── util_test.go │ └── watch.goconvey ├── golang.org └── x │ └── net │ ├── .gitattributes │ ├── .gitignore │ ├── AUTHORS │ ├── CONTRIBUTING.md │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── README │ ├── codereview.cfg │ ├── context │ ├── context.go │ ├── context_test.go │ └── withtimeout_test.go │ ├── dict │ └── dict.go │ ├── html │ ├── atom │ │ ├── atom.go │ │ ├── atom_test.go │ │ ├── gen.go │ │ ├── table.go │ │ └── table_test.go │ ├── charset │ │ ├── charset.go │ │ ├── charset_test.go │ │ ├── gen.go │ │ ├── table.go │ │ └── testdata │ │ │ ├── HTTP-charset.html │ │ │ ├── HTTP-vs-UTF-8-BOM.html │ │ │ ├── HTTP-vs-meta-charset.html │ │ │ ├── HTTP-vs-meta-content.html │ │ │ ├── No-encoding-declaration.html │ │ │ ├── README │ │ │ ├── UTF-16BE-BOM.html │ │ │ ├── UTF-16LE-BOM.html │ │ │ ├── UTF-8-BOM-vs-meta-charset.html │ │ │ ├── UTF-8-BOM-vs-meta-content.html │ │ │ ├── meta-charset-attribute.html │ │ │ └── meta-content-attribute.html │ ├── const.go │ ├── doc.go │ ├── doctype.go │ ├── entity.go │ ├── entity_test.go │ ├── escape.go │ ├── escape_test.go │ ├── example_test.go │ ├── foreign.go │ ├── node.go │ ├── node_test.go │ ├── parse.go │ ├── parse_test.go │ ├── render.go │ ├── render_test.go │ ├── testdata │ │ ├── go1.html │ │ └── webkit │ │ │ ├── README │ │ │ ├── adoption01.dat │ │ │ ├── adoption02.dat │ │ │ ├── comments01.dat │ │ │ ├── doctype01.dat │ │ │ ├── entities01.dat │ │ │ ├── entities02.dat │ │ │ ├── html5test-com.dat │ │ │ ├── inbody01.dat │ │ │ ├── isindex.dat │ │ │ ├── pending-spec-changes-plain-text-unsafe.dat │ │ │ ├── pending-spec-changes.dat │ │ │ ├── plain-text-unsafe.dat │ │ │ ├── scriptdata01.dat │ │ │ ├── scripted │ │ │ ├── adoption01.dat │ │ │ └── webkit01.dat │ │ │ ├── tables01.dat │ │ │ ├── tests1.dat │ │ │ ├── tests10.dat │ │ │ ├── tests11.dat │ │ │ ├── tests12.dat │ │ │ ├── tests14.dat │ │ │ ├── tests15.dat │ │ │ ├── tests16.dat │ │ │ ├── tests17.dat │ │ │ ├── tests18.dat │ │ │ ├── tests19.dat │ │ │ ├── tests2.dat │ │ │ ├── tests20.dat │ │ │ ├── tests21.dat │ │ │ ├── tests22.dat │ │ │ ├── tests23.dat │ │ │ ├── tests24.dat │ │ │ ├── tests25.dat │ │ │ ├── tests26.dat │ │ │ ├── tests3.dat │ │ │ ├── tests4.dat │ │ │ ├── tests5.dat │ │ │ ├── tests6.dat │ │ │ ├── tests7.dat │ │ │ ├── tests8.dat │ │ │ ├── tests9.dat │ │ │ ├── tests_innerHTML_1.dat │ │ │ ├── tricky01.dat │ │ │ ├── webkit01.dat │ │ │ └── webkit02.dat │ ├── token.go │ └── token_test.go │ ├── icmp │ ├── dstunreach.go │ ├── echo.go │ ├── endpoint.go │ ├── example_test.go │ ├── extension.go │ ├── extension_test.go │ ├── helper_posix.go │ ├── interface.go │ ├── ipv4.go │ ├── ipv4_test.go │ ├── ipv6.go │ ├── listen_posix.go │ ├── listen_stub.go │ ├── message.go │ ├── message_test.go │ ├── messagebody.go │ ├── mpls.go │ ├── multipart.go │ ├── multipart_test.go │ ├── packettoobig.go │ ├── paramprob.go │ ├── ping_test.go │ ├── sys_freebsd.go │ └── timeexceeded.go │ ├── idna │ ├── idna.go │ ├── idna_test.go │ ├── punycode.go │ └── punycode_test.go │ ├── internal │ ├── iana │ │ ├── const.go │ │ └── gen.go │ ├── nettest │ │ ├── error_posix.go │ │ ├── error_stub.go │ │ ├── interface.go │ │ ├── rlimit.go │ │ ├── rlimit_stub.go │ │ ├── rlimit_unix.go │ │ ├── rlimit_windows.go │ │ ├── stack.go │ │ ├── stack_stub.go │ │ ├── stack_unix.go │ │ └── stack_windows.go │ └── timeseries │ │ ├── timeseries.go │ │ └── timeseries_test.go │ ├── ipv4 │ ├── control.go │ ├── control_bsd.go │ ├── control_pktinfo.go │ ├── control_stub.go │ ├── control_unix.go │ ├── control_windows.go │ ├── defs_darwin.go │ ├── defs_dragonfly.go │ ├── defs_freebsd.go │ ├── defs_linux.go │ ├── defs_netbsd.go │ ├── defs_openbsd.go │ ├── defs_solaris.go │ ├── dgramopt_posix.go │ ├── dgramopt_stub.go │ ├── doc.go │ ├── endpoint.go │ ├── example_test.go │ ├── gen.go │ ├── genericopt_posix.go │ ├── genericopt_stub.go │ ├── header.go │ ├── header_test.go │ ├── helper.go │ ├── helper_stub.go │ ├── helper_unix.go │ ├── helper_windows.go │ ├── iana.go │ ├── icmp.go │ ├── icmp_linux.go │ ├── icmp_stub.go │ ├── icmp_test.go │ ├── mocktransponder_test.go │ ├── multicast_test.go │ ├── multicastlistener_test.go │ ├── multicastsockopt_test.go │ ├── packet.go │ ├── payload.go │ ├── payload_cmsg.go │ ├── payload_nocmsg.go │ ├── readwrite_test.go │ ├── sockopt.go │ ├── sockopt_asmreq.go │ ├── sockopt_asmreq_stub.go │ ├── sockopt_asmreq_unix.go │ ├── sockopt_asmreq_windows.go │ ├── sockopt_asmreqn_stub.go │ ├── sockopt_asmreqn_unix.go │ ├── sockopt_ssmreq_stub.go │ ├── sockopt_ssmreq_unix.go │ ├── sockopt_stub.go │ ├── sockopt_unix.go │ ├── sockopt_windows.go │ ├── sys_bsd.go │ ├── sys_darwin.go │ ├── sys_freebsd.go │ ├── sys_linux.go │ ├── sys_openbsd.go │ ├── sys_stub.go │ ├── sys_windows.go │ ├── syscall_linux_386.go │ ├── syscall_unix.go │ ├── thunk_linux_386.s │ ├── unicast_test.go │ ├── unicastsockopt_test.go │ ├── zsys_darwin.go │ ├── zsys_dragonfly.go │ ├── zsys_freebsd_386.go │ ├── zsys_freebsd_amd64.go │ ├── zsys_freebsd_arm.go │ ├── zsys_linux_386.go │ ├── zsys_linux_amd64.go │ ├── zsys_linux_arm.go │ ├── zsys_linux_arm64.go │ ├── zsys_linux_ppc64.go │ ├── zsys_linux_ppc64le.go │ ├── zsys_netbsd.go │ ├── zsys_openbsd.go │ └── zsys_solaris.go │ ├── ipv6 │ ├── control.go │ ├── control_rfc2292_unix.go │ ├── control_rfc3542_unix.go │ ├── control_stub.go │ ├── control_unix.go │ ├── control_windows.go │ ├── defs_darwin.go │ ├── defs_dragonfly.go │ ├── defs_freebsd.go │ ├── defs_linux.go │ ├── defs_netbsd.go │ ├── defs_openbsd.go │ ├── defs_solaris.go │ ├── dgramopt_posix.go │ ├── dgramopt_stub.go │ ├── doc.go │ ├── endpoint.go │ ├── example_test.go │ ├── gen.go │ ├── genericopt_posix.go │ ├── genericopt_stub.go │ ├── header.go │ ├── header_test.go │ ├── helper.go │ ├── helper_stub.go │ ├── helper_unix.go │ ├── helper_windows.go │ ├── iana.go │ ├── icmp.go │ ├── icmp_bsd.go │ ├── icmp_linux.go │ ├── icmp_solaris.go │ ├── icmp_stub.go │ ├── icmp_test.go │ ├── icmp_windows.go │ ├── mocktransponder_test.go │ ├── multicast_test.go │ ├── multicastlistener_test.go │ ├── multicastsockopt_test.go │ ├── payload.go │ ├── payload_cmsg.go │ ├── payload_nocmsg.go │ ├── readwrite_test.go │ ├── sockopt.go │ ├── sockopt_asmreq_unix.go │ ├── sockopt_asmreq_windows.go │ ├── sockopt_ssmreq_stub.go │ ├── sockopt_ssmreq_unix.go │ ├── sockopt_stub.go │ ├── sockopt_test.go │ ├── sockopt_unix.go │ ├── sockopt_windows.go │ ├── sys_bsd.go │ ├── sys_darwin.go │ ├── sys_freebsd.go │ ├── sys_linux.go │ ├── sys_stub.go │ ├── sys_windows.go │ ├── syscall_linux_386.go │ ├── syscall_unix.go │ ├── thunk_linux_386.s │ ├── unicast_test.go │ ├── unicastsockopt_test.go │ ├── zsys_darwin.go │ ├── zsys_dragonfly.go │ ├── zsys_freebsd_386.go │ ├── zsys_freebsd_amd64.go │ ├── zsys_freebsd_arm.go │ ├── zsys_linux_386.go │ ├── zsys_linux_amd64.go │ ├── zsys_linux_arm.go │ ├── zsys_linux_arm64.go │ ├── zsys_linux_ppc64.go │ ├── zsys_linux_ppc64le.go │ ├── zsys_netbsd.go │ ├── zsys_openbsd.go │ └── zsys_solaris.go │ ├── netutil │ ├── listen.go │ └── listen_test.go │ ├── proxy │ ├── direct.go │ ├── per_host.go │ ├── per_host_test.go │ ├── proxy.go │ ├── proxy_test.go │ └── socks5.go │ ├── publicsuffix │ ├── gen.go │ ├── list.go │ ├── list_test.go │ ├── table.go │ └── table_test.go │ ├── trace │ ├── histogram.go │ ├── histogram_test.go │ ├── trace.go │ └── trace_test.go │ ├── webdav │ ├── file.go │ ├── file_test.go │ ├── if.go │ ├── if_test.go │ ├── litmus_test_server.go │ ├── lock.go │ ├── lock_test.go │ ├── prop.go │ ├── prop_test.go │ ├── webdav.go │ ├── webdav_test.go │ ├── xml.go │ └── xml_test.go │ └── websocket │ ├── client.go │ ├── exampledial_test.go │ ├── examplehandler_test.go │ ├── hybi.go │ ├── hybi_test.go │ ├── server.go │ ├── websocket.go │ └── websocket_test.go └── gopkg.in ├── bluesuncorp └── validator.v5 │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── baked_in.go │ ├── benchmarks_test.go │ ├── doc.go │ ├── examples │ └── simple.go │ ├── examples_test.go │ ├── regexes.go │ ├── validator.go │ └── validator_test.go └── mgo.v2 ├── LICENSE ├── Makefile ├── README.md ├── auth.go ├── auth_test.go ├── bson ├── LICENSE ├── bson.go ├── bson_test.go ├── decode.go └── encode.go ├── bulk.go ├── bulk_test.go ├── cluster.go ├── cluster_test.go ├── dbtest ├── dbserver.go ├── dbserver_test.go └── export_test.go ├── doc.go ├── export_test.go ├── gridfs.go ├── gridfs_test.go ├── internal ├── sasl │ ├── sasl.c │ ├── sasl.go │ ├── sasl_windows.c │ ├── sasl_windows.go │ ├── sasl_windows.h │ ├── sspi_windows.c │ └── sspi_windows.h └── scram │ ├── scram.go │ └── scram_test.go ├── log.go ├── queue.go ├── queue_test.go ├── raceoff.go ├── raceon.go ├── saslimpl.go ├── saslstub.go ├── server.go ├── session.go ├── session_test.go ├── socket.go ├── stats.go ├── suite_test.go ├── syscall_test.go ├── syscall_windows_test.go ├── testdb ├── client.pem ├── dropall.js ├── init.js ├── server.pem ├── setup.sh ├── supervisord.conf └── wait.js ├── testserver ├── export_test.go ├── testserver.go └── testserver_test.go └── txn ├── chaos.go ├── debug.go ├── dockey_test.go ├── flusher.go ├── mgo_test.go ├── sim_test.go ├── tarjan.go ├── tarjan_test.go ├── txn.go └── txn_test.go /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.exe 3 | *.pyc 4 | 5 | vendor/pkg 6 | bin/ 7 | 8 | .gopath 9 | .godeps 10 | 11 | coverage.out 12 | out 13 | 14 | node_modules/ 15 | build/ 16 | -------------------------------------------------------------------------------- /Godeps: -------------------------------------------------------------------------------- 1 | gopkg.in/mgo.v2 0e631fbd094d2e11c3fbc83aaf1dfaadd20d34a1 github.com/dmliao/mgo 2 | github.com/smartystreets/goconvey/convey eb2e83c1df892d2c9ad5a3c85672da30be585dfd 3 | github.com/op/go-logging e8d5414f0947014548c2334044a0fac13187dfee 4 | github.com/gin-gonic/gin 5f2f8d9cb443a2c31babfbaf7980370995522d5f 5 | -------------------------------------------------------------------------------- /bsonutil/bsonutil.go: -------------------------------------------------------------------------------- 1 | // Package bsonutil provides a utility function to retrieve values from BSON documents. 2 | package bsonutil 3 | 4 | import ( 5 | "github.com/mongodbinc-interns/mongoproxy/convert" 6 | "gopkg.in/mgo.v2/bson" 7 | "strings" 8 | ) 9 | 10 | // FindValueByKey returns the value of keyName in document. If keyName is not found 11 | // in the top-level of the document, a nil document is returned. 12 | func FindValueByKey(keyName string, document bson.D) interface{} { 13 | for _, key := range document { 14 | if key.Name == keyName { 15 | return key.Value 16 | } 17 | } 18 | return nil 19 | } 20 | 21 | // FindDeepValueInMap returns the value of a dot-notation-separated keyName in a map m. 22 | // If the path is not found in the document, a nil document is returned. 23 | func FindDeepValueInMap(keyName string, m bson.M) interface{} { 24 | keyChain := strings.Split(keyName, ".") 25 | currentDoc := m 26 | var val interface{} 27 | for i := 0; i < len(keyChain); i++ { 28 | val = currentDoc[keyChain[i]] 29 | 30 | if i < len(keyChain)-1 { 31 | currentDoc = convert.ToBSONMap(val) 32 | if currentDoc == nil { 33 | return nil 34 | } 35 | } 36 | } 37 | return val 38 | } 39 | -------------------------------------------------------------------------------- /buffer/write.go: -------------------------------------------------------------------------------- 1 | package buffer 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | ) 7 | 8 | // WriteToBuf takes in a buffer and writes the data as bytes to the buffer 9 | // in the order provided in the arguments. Returns an error if writing to 10 | // the buffer fails for any reason. 11 | func WriteToBuf(buf *bytes.Buffer, data ...interface{}) error { 12 | for _, d := range data { 13 | if err := binary.Write(buf, binary.LittleEndian, d); err != nil { 14 | return err 15 | } 16 | } 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /example_bi_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "modules": [ 3 | { 4 | "name": "bi", 5 | "config": { 6 | "connection": { 7 | "addresses": [ 8 | "localhost:27017" 9 | ] 10 | }, 11 | "rules": [ 12 | { 13 | "origin": "test.foo", 14 | "prefix": "db.metrics", 15 | "timeGranularity": ["M", "D", "h", "m", "s"], 16 | "valueField": "price" 17 | } 18 | ] 19 | } 20 | }, 21 | { 22 | "name": "mongod", 23 | "config": { 24 | "addresses": [ 25 | "localhost:27017" 26 | ] 27 | } 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /main/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "github.com/mongodbinc-interns/mongoproxy" 6 | . "github.com/mongodbinc-interns/mongoproxy/log" 7 | "gopkg.in/mgo.v2/bson" 8 | ) 9 | 10 | var ( 11 | port int 12 | logLevel int 13 | mongoURI string 14 | configNamespace string 15 | configFilename string 16 | ) 17 | 18 | func parseFlags() { 19 | flag.IntVar(&port, "port", 8124, "port to listen on") 20 | flag.IntVar(&logLevel, "logLevel", 3, "verbosity for logging") 21 | flag.StringVar(&mongoURI, "m", "mongodb://localhost:27017", 22 | "MongoDB instance to connect to for configuration.") 23 | flag.StringVar(&configNamespace, "c", "test.config", 24 | "Namespace to query for configuration.") 25 | flag.StringVar(&configFilename, "f", "", 26 | "JSON config filename. If set, will be used instead of mongoDB configuration.") 27 | flag.Parse() 28 | } 29 | 30 | func main() { 31 | 32 | parseFlags() 33 | SetLogLevel(logLevel) 34 | 35 | // grab config file 36 | var result bson.M 37 | var err error 38 | if len(configFilename) == 0 { 39 | result, err = mongoproxy.ParseConfigFromDB(mongoURI, configNamespace) 40 | } else { 41 | result, err = mongoproxy.ParseConfigFromFile(configFilename) 42 | } 43 | 44 | if err != nil { 45 | Log(WARNING, "%v", err) 46 | } 47 | 48 | mongoproxy.StartWithConfig(port, result) 49 | } 50 | -------------------------------------------------------------------------------- /messages/request.go: -------------------------------------------------------------------------------- 1 | package messages 2 | 3 | type Requester interface { 4 | 5 | // Type returns a string that identifies the structure of this particular 6 | // Requester, which can then be used to cast it into its proper struct 7 | // type to examine its fields 8 | Type() string 9 | } 10 | -------------------------------------------------------------------------------- /messages/response.go: -------------------------------------------------------------------------------- 1 | package messages 2 | 3 | // A ResponderError is used to represent an error in a module response. 4 | type ResponderError struct { 5 | ErrorCode int32 6 | Message string 7 | } 8 | 9 | // A Responder is the interface that are used to record responses from modules 10 | // to other modules or the proxy core. 11 | type Responder interface { 12 | Type() string 13 | 14 | // Write takes a ResponseWriter to be sent to an upstream module, or to proxy core. 15 | Write(ResponseWriter) 16 | 17 | // Error indicates that the response failed, and takes in an int32 error code 18 | // and a string for an error message. 19 | Error(int32, string) 20 | } 21 | 22 | // Struct that records the responses from modules to be handled by proxy core. 23 | // implements a Responder 24 | type ModuleResponse struct { 25 | CommandError *ResponderError 26 | Writer ResponseWriter 27 | } 28 | 29 | func (r *ModuleResponse) Type() string { 30 | return "response" 31 | } 32 | 33 | func (r *ModuleResponse) Write(writer ResponseWriter) { 34 | r.Writer = writer 35 | } 36 | 37 | func (r *ModuleResponse) Error(code int32, message string) { 38 | r.CommandError = &ResponderError{code, message} 39 | } 40 | -------------------------------------------------------------------------------- /mock/io.go: -------------------------------------------------------------------------------- 1 | // Package mock contains mock structs that implement interfaces for reading / 2 | // writing data, which is useful for testing purposes. 3 | package mock 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | // A MockIO emulates an io.Reader and an io.Writer for testing purposes 10 | // the bytes of a MockIO can be immediately examined, and also prefilled 11 | // ahead of time. 12 | type MockIO struct { 13 | Input []byte 14 | Output []byte 15 | pos int 16 | } 17 | 18 | func (m *MockIO) Reset() { 19 | m.pos = 0 20 | } 21 | 22 | func (m *MockIO) Read(b []byte) (int, error) { 23 | inputLen := len(m.Input) - m.pos 24 | bLen := len(b) 25 | n := 0 26 | 27 | for i := 0; i < inputLen && i < bLen; i++ { 28 | b[i] = m.Input[m.pos] 29 | 30 | m.pos += 1 31 | n += 1 32 | } 33 | 34 | return n, io.EOF 35 | } 36 | func (m *MockIO) Write(b []byte) (int, error) { 37 | m.Output = append(m.Output, b...) 38 | return len(b), nil 39 | } 40 | -------------------------------------------------------------------------------- /modules/bi/frontend/README.md: -------------------------------------------------------------------------------- 1 | # BI Module Frontend 2 | 3 | A web application to visualize the data collected from the BI Module. 4 | 5 | ## Building and running 6 | 7 | All operations assume that you are in the `modules/bi/frontend` directory, relative to the base path of the project (the directory of this README). 8 | 9 | The application is written in Go and Javascript. It requires `node` and `npm` to be installed. 10 | 11 | To grab dependencies: 12 | 13 | npm install 14 | 15 | To run (requires mongod to be running on localhost:27017): 16 | 17 | npm start 18 | -------------------------------------------------------------------------------- /modules/bi/frontend/controllers/config.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "fmt" 5 | "gopkg.in/mgo.v2" 6 | "gopkg.in/mgo.v2/bson" 7 | ) 8 | 9 | type ConfigLocation struct { 10 | Session *mgo.Session 11 | Database string 12 | Collection string 13 | } 14 | 15 | var configSaveLocation *ConfigLocation 16 | 17 | // SetConfigSaveLocation takes a driver session, a database and a collection to determine where the 18 | // configuration of the BI module is stored. 19 | func SetConfigSaveLocation(c *ConfigLocation) { 20 | configSaveLocation = c 21 | } 22 | 23 | // helper function to update the BI module's configuration. Assumes that the frontend 24 | // was started with a configuration in a mongod instance, not a file. 25 | func updateConfiguration(config bson.M) error { 26 | 27 | sessionCopy := configSaveLocation.Session.Copy() 28 | defer sessionCopy.Close() 29 | if configSaveLocation == nil { 30 | return fmt.Errorf("No configuration save location.") 31 | } 32 | c := sessionCopy.DB(configSaveLocation.Database).C(configSaveLocation.Collection) 33 | return c.Update(bson.M{"modules.name": "bi"}, 34 | bson.M{"$set": bson.M{"modules.$.config": config}}, 35 | ) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/css/main.less: -------------------------------------------------------------------------------- 1 | @import "../../node_modules/bootstrap/less/bootstrap.less"; 2 | @import (less) "../../node_modules/c3/c3.css"; 3 | @import (inline) "../../node_modules/sweetalert/dist/sweetalert.css"; 4 | @import "./vendor/bootstrap-multiselect.less"; 5 | @import "./components/json-editor.less"; 6 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/components/addRule.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react'); 4 | var Button = require('react-bootstrap').Button; 5 | 6 | // AddRuleButton is a button to add a new rule to the configuration. 7 | var AddRuleButton = React.createClass({ 8 | 9 | render: function() { 10 | return 11 | } 12 | }) 13 | 14 | module.exports = AddRuleButton 15 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/components/granularityToggle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react') 4 | var Multiselect = require('react-bootstrap-multiselect'); 5 | var _ = require('lodash'); 6 | 7 | // GranularityToggle is a select component that lets users choose the time 8 | // granularity to display on a graph. 9 | var GranularityToggle = React.createClass({ 10 | getInitialState: function() { 11 | return { 12 | data: [ 13 | { 14 | value: "M", 15 | label: "Month" 16 | }, 17 | { 18 | value: "D", 19 | label: "Day" 20 | }, 21 | { 22 | value: "h", 23 | label: "Hour" 24 | }, 25 | { 26 | value: "m", 27 | label: "Minute", 28 | selected: true, 29 | }, 30 | { 31 | value: "s", 32 | label: "Second" 33 | } 34 | ], 35 | selected: "m" 36 | }; 37 | }, 38 | 39 | handleChange: function(element, checked) { 40 | 41 | this.setState({selected: element.val()}) 42 | 43 | // bubble to parent 44 | this.props.onChange(this); 45 | }, 46 | 47 | render: function() { 48 | return 49 | } 50 | }); 51 | 52 | module.exports = GranularityToggle 53 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/components/ruleSelector.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react') 4 | var Multiselect = require('react-bootstrap-multiselect'); 5 | var _ = require('lodash'); 6 | 7 | // RuleSelector is a multi selector that lets users choose which rules to display 8 | // on a graph. 9 | var RuleSelector = React.createClass({ 10 | getInitialState: function() { 11 | return { 12 | rules: this.props.rules, 13 | selected: {} 14 | } 15 | }, 16 | handleChange: function(element, checked) { 17 | var newSelectItems = _.extend({}, this.state.selected); 18 | newSelectItems[element.val()] = checked; 19 | this.setState({selected: newSelectItems}) 20 | 21 | // bubble to parent 22 | this.props.onChange(this); 23 | }, 24 | render: function() { 25 | return 26 | } 27 | }) 28 | 29 | module.exports = RuleSelector 30 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Application file for the primary dashboard view. 4 | 5 | window.jQuery = window.$ = require('jquery'); 6 | require('bootstrap/js/button'); 7 | require('./vendor/jquery.timer'); 8 | 9 | var React = require('react'); 10 | 11 | var GraphPanel = require('./sections/graphPanel'); 12 | 13 | // add extra fields to the rules 14 | var addLabelToRules = require('./utils/addLabelToRules'); 15 | addLabelToRules(window.config.Rules); 16 | 17 | var populateRuleValues = require('./utils/populateRuleValues'); 18 | 19 | populateRuleValues(function(err) { 20 | if (err) { 21 | console.log(err); 22 | } 23 | 24 | // initialize the application. Currently starts up a single graph panel. 25 | var App = React.createClass({ 26 | render: function() { 27 | return
28 |
29 | 30 |
31 |
; 32 | } 33 | }) 34 | 35 | React.render(, document.getElementById("app")); 36 | 37 | }) 38 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/sections/connectionConfig.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react'); 4 | var Panel = require('react-bootstrap').Panel; 5 | var JSONEditor = require('react-json'); 6 | 7 | var _ = require('lodash'); 8 | 9 | var defaultConnection = { 10 | addresses: [], 11 | direct: false, 12 | timeout: 60000, 13 | auth: { 14 | username: "username", 15 | password: "password", 16 | database: "database" 17 | } 18 | } 19 | 20 | // ConnectionConfig is an editor for the connection part of BI Module configuration. 21 | var ConnectionConfig = React.createClass({ 22 | getInitialState: function() { 23 | return { 24 | connection: _.extend(defaultConnection, window.config.connection) 25 | } 26 | }, 27 | 28 | handleChange: function(value) { 29 | // bubble up to parent 30 | this.setState({ 31 | connection: value 32 | }); 33 | this.props.onChange(this, value) 34 | }, 35 | 36 | render: function() { 37 | var settings = { 38 | form: false, 39 | editing: 'always', 40 | }; 41 | return 42 |

Connection

43 |
44 | 46 |
47 | } 48 | }) 49 | 50 | module.exports = ConnectionConfig 51 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/utils/addLabelToRules.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // helper function that is called on application start, to add some useful 4 | // fields to the rules 5 | function addLabelsToRules(rules) { 6 | if (!rules || !rules.length) { 7 | return rules; 8 | } 9 | 10 | for (var i = 0; i < rules.length; i++) { 11 | rules[i].label = rules[i].ValueField; 12 | rules[i].value = i; 13 | rules[i].index = i; 14 | } 15 | 16 | return rules; 17 | } 18 | 19 | module.exports = addLabelsToRules; 20 | -------------------------------------------------------------------------------- /modules/bi/frontend/public/js/utils/populateRuleValues.js: -------------------------------------------------------------------------------- 1 | // add additional rules for all the ones with string values 2 | var async = require('async'); 3 | var Controller = require('../ajax/controller'); 4 | var _ = require('lodash'); 5 | 6 | var newRules = []; 7 | 8 | // helper function to inject additional labels and rules for all the values 9 | // of the given rules, so they can be displayed on the graph. 10 | function populateRuleValues(cb) { 11 | 12 | async.forEachOfSeries(window.config.Rules, function(rule, i, callback) { 13 | newRules.push(rule); 14 | Controller.getMetadata(i, rule.TimeGranularities[0], function(data) { 15 | if (data.values) { 16 | for (var i = 0; i < data.values.length; i++) { 17 | valueRule = _.extend({}, rule); 18 | valueRule.ValueType = data.values[i]; 19 | valueRule.label = valueRule.ValueField + " - " + data.values[i]; 20 | newRules.push(valueRule); 21 | } 22 | } 23 | callback(); 24 | }, function () { 25 | // don't do anything 26 | callback(); 27 | }) 28 | }, function(err) { 29 | for (var i = 0; i < newRules.length; i++) { 30 | newRules[i].value = i; 31 | } 32 | window.config.Rules = newRules; 33 | cb(err); 34 | }) 35 | 36 | } 37 | 38 | module.exports = populateRuleValues; 39 | -------------------------------------------------------------------------------- /modules/bi/frontend/server.go: -------------------------------------------------------------------------------- 1 | package frontend 2 | 3 | import ( 4 | "encoding/json" 5 | "github.com/gin-gonic/gin" 6 | "github.com/mongodbinc-interns/mongoproxy/modules/bi/frontend/controllers" 7 | "gopkg.in/mgo.v2/bson" 8 | "html/template" 9 | ) 10 | 11 | // the funcMap adds helper functions that can be injected into the HTML 12 | // templates 13 | var funcMap = template.FuncMap{ 14 | // marshal converts an interface{} into a JSON object that can be consumed 15 | // by the browser. 16 | "marshal": func(v interface{}) template.JS { 17 | a, _ := json.Marshal(v) 18 | return template.JS(a) 19 | }, 20 | } 21 | 22 | // Start initializes a new server for the BI Module Frontend. 23 | func Start(config bson.M, baseDir string, configLocation *controllers.ConfigLocation) (*gin.Engine, error) { 24 | r := gin.New() 25 | 26 | // set up views 27 | // It's a bit of a hack right now, since we need the function map 28 | // https://github.com/gin-gonic/gin/issues/228 29 | if tmpl, err := template.New("projectViews").Funcs(funcMap).ParseGlob(baseDir + "/views/*"); err == nil { 30 | r.SetHTMLTemplate(tmpl) 31 | } else { 32 | return nil, err 33 | } 34 | 35 | // set up routes 36 | controllers.SetConfigSaveLocation(configLocation) 37 | err := controllers.Setup(r, config, baseDir) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | return r, nil 43 | } 44 | -------------------------------------------------------------------------------- /modules/bi/frontend/views/config_ui.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 |
21 | 22 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /modules/bi/frontend/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 |
21 | 22 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /modules/bi/metadata.go: -------------------------------------------------------------------------------- 1 | package bi 2 | 3 | import ( 4 | "github.com/mongodbinc-interns/mongoproxy/messages" 5 | "gopkg.in/mgo.v2/bson" 6 | ) 7 | 8 | // helper function to upsert a metadata document into the metric collection. Metric 9 | // documents have a special id, and contain the list of possible string values for a 10 | // rule's valueField. 11 | func saveMetadataForValue(rule Rule, granularity string, 12 | value string) messages.SingleUpdate { 13 | 14 | selector := bson.D{{"_id", "metadata"}} 15 | update := bson.D{{"$set", bson.D{{rule.ValueField + "." + value, true}}}} 16 | 17 | single := messages.SingleUpdate{ 18 | Selector: selector, 19 | Update: update, 20 | Upsert: true, 21 | } 22 | return single 23 | } 24 | -------------------------------------------------------------------------------- /modules/mockule/README.md: -------------------------------------------------------------------------------- 1 | # Mockule 2 | 3 | A mock module for MongoProxy. Stores `insert` requests in memory, and outputs them when a `find` is performed. 4 | 5 | ## Usage 6 | 7 | name: mockule 8 | 9 | ## Configuration 10 | 11 | This module does not have any configuration options. 12 | -------------------------------------------------------------------------------- /modules/mongod/README.md: -------------------------------------------------------------------------------- 1 | # Mongod Module 2 | 3 | A proxying module for MongoProxy, that sends the request to the configured mongod instance(s). 4 | 5 | ## Configuration 6 | 7 | The configuration defines the server(s) that the module connects to. It has the following fields: 8 | 9 | { 10 | addresses: (array of strings) - contains addresses of servers to connect to. If no port is provided, will default to 27017. 11 | direct: (optional boolean) - determines whether to establish connections only with the specified server, or to obtain cluster information to connect with other servers. 12 | timeout: (optional integer) - the amount of time to wait for the server(s) to respond on connecting, in nanoseconds, before returning an error. If set to 0, then there is no timeout. Defaults to 10 seconds. 13 | auth: (optional object) { 14 | database: (string) - the default database that will be connected to for authentication 15 | username: (string) 16 | password: (string) 17 | } 18 | } 19 | 20 | ## Example 21 | 22 | { 23 | "addresses": [ 24 | "localhost:27017" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /server/config/installed_modules.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import _ "github.com/mongodbinc-interns/mongoproxy/modules/bi" 4 | import _ "github.com/mongodbinc-interns/mongoproxy/modules/mockule" 5 | import _ "github.com/mongodbinc-interns/mongoproxy/modules/mongod" 6 | -------------------------------------------------------------------------------- /server/modules.go: -------------------------------------------------------------------------------- 1 | // Package server contains interfaces and functions dealing with setting up proxy core, 2 | // including code construct the module pipeline. 3 | package server 4 | 5 | import ( 6 | "github.com/mongodbinc-interns/mongoproxy/messages" 7 | "gopkg.in/mgo.v2/bson" 8 | ) 9 | 10 | type Module interface { 11 | 12 | // Name returns the name to identify this module when registered. 13 | Name() string 14 | 15 | // Configure configures this module with the given configuration object. Returns 16 | // an error if the configuration is invalid for the module. 17 | Configure(bson.M) error 18 | 19 | // Process is the function executed when a message is called in the pipeline. 20 | // It takes in a Requester from an upstream module (or proxy core), a 21 | // Responder that it writes a response to, and a PipelineFunc that should 22 | // be called to execute the next module in the pipeline. 23 | Process(messages.Requester, messages.Responder, PipelineFunc) 24 | 25 | // New creates a new instance of this module. 26 | New() Module 27 | } 28 | -------------------------------------------------------------------------------- /server/registry.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | var Registry = make(map[string]Module) 4 | 5 | func Publish(m Module) { 6 | Registry[m.Name()] = m 7 | } 8 | -------------------------------------------------------------------------------- /set_gopath.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set PKG=%cd%\.gopath\src\github.com\mongodbinc-interns\mongoproxy 3 | for %%t in (bsonutil, buffer, convert, log, main, messages, mock, modules, server, tests) do echo d | xcopy %cd%\%%t %PKG%\%%t /Y /E /S 4 | REM copy vendored libraries to GOPATH 5 | for /f %%v in ('dir /b /a:d "%cd%\vendor\src\*"') do echo d | xcopy %cd%\vendor\src\%%v %cd%\.gopath\src\%%v /Y /E /S 6 | set GOPATH=%cd%\.gopath;%cd%\vendor 7 | -------------------------------------------------------------------------------- /set_gopath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROXY_PKG='github.com/mongodbinc-interns/mongoproxy'; 4 | 5 | setgopath() { 6 | if [ "Windows_NT" != "$OS" ]; then 7 | SOURCE_GOPATH=`pwd`.gopath 8 | VENDOR_GOPATH=`pwd`/vendor 9 | 10 | # set up the $GOPATH to use the vendored dependencies as 11 | # well as the source for the mongo tools 12 | rm -rf .gopath/ 13 | mkdir -p .gopath/src/"$(dirname "${PROXY_PKG}")" 14 | ln -sf `pwd` .gopath/src/$PROXY_PKG 15 | export GOPATH=`pwd`/.gopath:`pwd`/vendor 16 | else 17 | # This is assuming the use of git bash. Cygwin might require a different 18 | # configuration. 19 | SOURCE_GOPATH=`pwd`/.gopath 20 | VENDOR_GOPATH=`pwd`/vendor 21 | 22 | 23 | # set up the $GOPATH to use the vendored dependencies as 24 | # well as the source for the mongo tools 25 | rm -rf .gopath/ 26 | mkdir -p .gopath/src/"$PROXY_PKG" 27 | 28 | packages=(bsonutil buffer convert log main messages mock modules server tests) 29 | for i in ${packages[@]}; do 30 | cp -r `pwd`/${i} .gopath/src/$PROXY_PKG/ 31 | done 32 | cp * .gopath/src/$PROXY_PKG/ 33 | export GOPATH=`pwd`/.gopath:`pwd`/vendor 34 | fi; 35 | } 36 | 37 | setgopath 38 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | chmod 755 ./set_gopath.sh 4 | . ./set_gopath.sh 5 | go run main/server.go $@ 6 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # usage: test.sh 4 | chmod 755 ./set_gopath.sh 5 | . ./set_gopath.sh 6 | 7 | packages=(bsonutil buffer convert messages server modules/bi) 8 | for i in ${packages[@]}; do 9 | go test github.com/mongodbinc-interns/mongoproxy/${i} -coverprofile=coverage.out $1 10 | done 11 | -------------------------------------------------------------------------------- /tests/main/test_server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "github.com/mongodbinc-interns/mongoproxy" 6 | . "github.com/mongodbinc-interns/mongoproxy/log" 7 | "github.com/mongodbinc-interns/mongoproxy/server" 8 | _ "github.com/mongodbinc-interns/mongoproxy/server/config" 9 | "gopkg.in/mgo.v2/bson" 10 | ) 11 | 12 | var ( 13 | port int 14 | logLevel int 15 | ) 16 | 17 | func parseFlags() { 18 | flag.IntVar(&port, "port", 8124, "port to listen on") 19 | flag.IntVar(&logLevel, "logLevel", DEBUG, "verbosity for logging") 20 | 21 | flag.Parse() 22 | } 23 | 24 | func main() { 25 | 26 | parseFlags() 27 | SetLogLevel(logLevel) 28 | 29 | module := server.Registry["mongod"].New() 30 | 31 | connection := bson.M{} 32 | connection["addresses"] = []string{"localhost:27017"} 33 | 34 | // initialize the pipeline 35 | chain := server.CreateChain() 36 | module.Configure(connection) 37 | chain.AddModule(module) 38 | 39 | mongoproxy.Start(port, chain) 40 | } 41 | -------------------------------------------------------------------------------- /tests/test.js: -------------------------------------------------------------------------------- 1 | // node script to run the proxy server and Javascript integration tests. 2 | // Usage: node test 3 | 4 | var childProcess = require('child_process'); 5 | var fs = require('fs'); 6 | var path = process.cwd(); 7 | 8 | 9 | var build = childProcess.spawnSync('go', [ 10 | 'build', 11 | '-o', 12 | __dirname + '/out', 13 | __dirname + '/main/test_server.go' 14 | ], { 15 | stdio: 'inherit' 16 | }); 17 | 18 | var server = childProcess.spawn(__dirname + '/out', [ 19 | '-port=' + 8000, 20 | '-logLevel=' + 1 21 | ], { 22 | stdio: 'inherit' 23 | }); 24 | 25 | testFile = process.argv[2] 26 | i = 0; 27 | 28 | // hack to make sure that the server is up before running tests. 29 | setTimeout(function() { 30 | 31 | console.log("Testing: " + testFile) 32 | var shell = childProcess.spawnSync('mongo', [ 33 | testFile, 34 | '--port=8000' 35 | ], { 36 | stdio: 'inherit' 37 | }) 38 | server.kill(); 39 | }, 2000) 40 | -------------------------------------------------------------------------------- /tests/test_dir.js: -------------------------------------------------------------------------------- 1 | // node script to run the proxy server and Javascript integration tests. 2 | // Usage: node test 3 | 4 | var childProcess = require('child_process'); 5 | var fs = require('fs'); 6 | var path = process.cwd(); 7 | 8 | 9 | var build = childProcess.spawnSync('go', [ 10 | 'build', 11 | '-o', 12 | __dirname + '/out', 13 | __dirname + '/main/test_server.go' 14 | ], { 15 | stdio: 'inherit' 16 | }); 17 | 18 | var server = childProcess.spawn(__dirname + '/out', [ 19 | '-port=' + 8000, 20 | '-logLevel=' + 1 21 | ], { 22 | stdio: 'inherit' 23 | }); 24 | 25 | testFiles = fs.readdirSync(process.argv[2]) 26 | i = 0; 27 | 28 | // hack to make sure that the server is up before running tests. 29 | setTimeout(function() { 30 | 31 | var id = setInterval(function() { 32 | if (!testFiles[i]) { 33 | clearInterval(id) 34 | return; 35 | } 36 | var ext = testFiles[i].split('.').pop(); 37 | if (ext != 'js') { 38 | i++; 39 | return; 40 | } 41 | 42 | console.log("Testing: " + testFiles[i]) 43 | var shell = childProcess.spawnSync('mongo', [ 44 | process.argv[2] + '/' + testFiles[i], 45 | '--port=8000' 46 | ], { 47 | stdio: 'inherit' 48 | }) 49 | i++; 50 | 51 | if (i >= testFiles.length) { 52 | clearInterval(id); 53 | server.kill(); 54 | } 55 | }, 100) 56 | 57 | }, 2000) 58 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/.gitignore: -------------------------------------------------------------------------------- 1 | Godeps/* 2 | !Godeps/Godeps.json 3 | coverage.out 4 | count.out 5 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.4 5 | - 1.4.2 6 | - tip 7 | 8 | script: 9 | - go get golang.org/x/tools/cmd/cover 10 | - go get github.com/mattn/goveralls 11 | - go test -v -covermode=count -coverprofile=coverage.out 12 | 13 | after_success: 14 | - goveralls -coverprofile=coverage.out -service=travis-ci -repotoken yFj7FrCeddvBzUaaCyG33jCLfWXeb93eA 15 | 16 | notifications: 17 | webhooks: 18 | urls: 19 | - https://webhooks.gitter.im/e/acc2c57482e94b44f557 20 | on_success: change # options: [always|never|change] default: always 21 | on_failure: always # options: [always|never|change] default: always 22 | on_start: false # default: false 23 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "github.com/gin-gonic/gin", 3 | "GoVersion": "go1.4.2", 4 | "Packages": [ 5 | "./..." 6 | ], 7 | "Deps": [ 8 | { 9 | "ImportPath": "github.com/dustin/go-broadcast", 10 | "Rev": "3bdf6d4a7164a50bc19d5f230e2981d87d2584f1" 11 | }, 12 | { 13 | "ImportPath": "github.com/manucorporat/sse", 14 | "Rev": "c142f0f1baea5cef7f98a8a6c222f6134368c1f5" 15 | }, 16 | { 17 | "ImportPath": "github.com/manucorporat/stats", 18 | "Rev": "8f2d6ace262eba462e9beb552382c98be51d807b" 19 | }, 20 | { 21 | "ImportPath": "github.com/mattn/go-colorable", 22 | "Rev": "d67e0b7d1797975196499f79bcc322c08b9f218b" 23 | }, 24 | { 25 | "ImportPath": "github.com/stretchr/testify/assert", 26 | "Comment": "v1.0", 27 | "Rev": "232e8563676cd15c3a36ba5e675ad4312ac4cb11" 28 | }, 29 | { 30 | "ImportPath": "golang.org/x/net/context", 31 | "Rev": "621fff363a1d9ad7fdd0bfa9d80a42881267deb4" 32 | }, 33 | { 34 | "ImportPath": "gopkg.in/bluesuncorp/validator.v5", 35 | "Comment": "v5.4", 36 | "Rev": "07cbdd2e6dfd947b002e83c13b775c7580fab2d5" 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manuel Martínez-Almeida 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/src/github.com/gin-gonic/gin/binding/default_validator.go: -------------------------------------------------------------------------------- 1 | package binding 2 | 3 | import ( 4 | "reflect" 5 | "sync" 6 | 7 | "gopkg.in/bluesuncorp/validator.v5" 8 | ) 9 | 10 | type defaultValidator struct { 11 | once sync.Once 12 | validate *validator.Validate 13 | } 14 | 15 | var _ StructValidator = &defaultValidator{} 16 | 17 | func (v *defaultValidator) ValidateStruct(obj interface{}) error { 18 | if kindOfData(obj) == reflect.Struct { 19 | v.lazyinit() 20 | if err := v.validate.Struct(obj); err != nil { 21 | return error(err) 22 | } 23 | } 24 | return nil 25 | } 26 | 27 | func (v *defaultValidator) lazyinit() { 28 | v.once.Do(func() { 29 | v.validate = validator.New("binding", validator.BakedInValidators) 30 | }) 31 | } 32 | 33 | func kindOfData(data interface{}) reflect.Kind { 34 | value := reflect.ValueOf(data) 35 | valueType := value.Kind() 36 | if valueType == reflect.Ptr { 37 | valueType = value.Elem().Kind() 38 | } 39 | return valueType 40 | } 41 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/binding/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package binding 6 | 7 | import ( 8 | "encoding/json" 9 | 10 | "net/http" 11 | ) 12 | 13 | type jsonBinding struct{} 14 | 15 | func (_ jsonBinding) Name() string { 16 | return "json" 17 | } 18 | 19 | func (_ jsonBinding) Bind(req *http.Request, obj interface{}) error { 20 | decoder := json.NewDecoder(req.Body) 21 | if err := decoder.Decode(obj); err != nil { 22 | return err 23 | } 24 | return validate(obj) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/binding/xml.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package binding 6 | 7 | import ( 8 | "encoding/xml" 9 | "net/http" 10 | ) 11 | 12 | type xmlBinding struct{} 13 | 14 | func (_ xmlBinding) Name() string { 15 | return "xml" 16 | } 17 | 18 | func (_ xmlBinding) Bind(req *http.Request, obj interface{}) error { 19 | decoder := xml.NewDecoder(req.Body) 20 | if err := decoder.Decode(obj); err != nil { 21 | return err 22 | } 23 | return validate(obj) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/deprecated.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gin 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/app-engine/README.md: -------------------------------------------------------------------------------- 1 | # Guide to run Gin under App Engine LOCAL Development Server 2 | 3 | 1. Download, install and setup Go in your computer. (That includes setting your `$GOPATH`.) 4 | 2. Download SDK for your platform from here: `https://developers.google.com/appengine/downloads?hl=es#Google_App_Engine_SDK_for_Go` 5 | 3. Download Gin source code using: `$ go get github.com/gin-gonic/gin` 6 | 4. Navigate to examples folder: `$ cd $GOPATH/src/github.com/gin-gonic/gin/examples/` 7 | 5. Run it: `$ goapp serve app-engine/` -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/app-engine/app.yaml: -------------------------------------------------------------------------------- 1 | application: hello 2 | version: 1 3 | runtime: go 4 | api_version: go1 5 | 6 | handlers: 7 | - url: /.* 8 | script: _go_app -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/app-engine/hello.go: -------------------------------------------------------------------------------- 1 | package hello 2 | 3 | import ( 4 | "net/http" 5 | "github.com/gin-gonic/gin" 6 | ) 7 | 8 | // This function's name is a must. App Engine uses it to drive the requests properly. 9 | func init() { 10 | // Starts a new Gin instance with no middle-ware 11 | r := gin.New() 12 | 13 | // Define your handlers 14 | r.GET("/", func(c *gin.Context){ 15 | c.String(200, "Hello World!") 16 | }) 17 | r.GET("/ping", func(c *gin.Context){ 18 | c.String(200, "pong") 19 | }) 20 | 21 | // Handle all requests using net/http 22 | http.Handle("/", r) 23 | } -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/basic/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | ) 6 | 7 | var DB = make(map[string]string) 8 | 9 | func main() { 10 | r := gin.Default() 11 | 12 | // Ping test 13 | r.GET("/ping", func(c *gin.Context) { 14 | c.String(200, "pong") 15 | }) 16 | 17 | // Get user value 18 | r.GET("/user/:name", func(c *gin.Context) { 19 | user := c.Params.ByName("name") 20 | value, ok := DB[user] 21 | if ok { 22 | c.JSON(200, gin.H{"user": user, "value": value}) 23 | } else { 24 | c.JSON(200, gin.H{"user": user, "status": "no value"}) 25 | } 26 | }) 27 | 28 | // Authorized group (uses gin.BasicAuth() middleware) 29 | // Same than: 30 | // authorized := r.Group("/") 31 | // authorized.Use(gin.BasicAuth(gin.Credentials{ 32 | // "foo": "bar", 33 | // "manu": "123", 34 | //})) 35 | authorized := r.Group("/", gin.BasicAuth(gin.Accounts{ 36 | "foo": "bar", // user:foo password:bar 37 | "manu": "123", // user:manu password:123 38 | })) 39 | 40 | authorized.POST("admin", func(c *gin.Context) { 41 | user := c.MustGet(gin.AuthUserKey).(string) 42 | 43 | // Parse JSON 44 | var json struct { 45 | Value string `json:"value" binding:"required"` 46 | } 47 | 48 | if c.Bind(&json) == nil { 49 | DB[user] = json.Value 50 | c.JSON(200, gin.H{"status": "ok"}) 51 | } 52 | }) 53 | 54 | // Listen and Server in 0.0.0.0:8080 55 | r.Run(":8080") 56 | } 57 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/realtime-advanced/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | func main() { 11 | ConfigRuntime() 12 | StartWorkers() 13 | StartGin() 14 | } 15 | 16 | func ConfigRuntime() { 17 | nuCPU := runtime.NumCPU() 18 | runtime.GOMAXPROCS(nuCPU) 19 | fmt.Printf("Running with %d CPUs\n", nuCPU) 20 | } 21 | 22 | func StartWorkers() { 23 | go statsWorker() 24 | } 25 | 26 | func StartGin() { 27 | gin.SetMode(gin.ReleaseMode) 28 | 29 | router := gin.New() 30 | router.Use(rateLimit, gin.Recovery()) 31 | router.LoadHTMLGlob("resources/*.templ.html") 32 | router.Static("/static", "resources/static") 33 | router.GET("/", index) 34 | router.GET("/room/:roomid", roomGET) 35 | router.POST("/room-post/:roomid", roomPOST) 36 | router.GET("/stream/:roomid", streamRoom) 37 | 38 | router.Run(":80") 39 | } 40 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/realtime-advanced/rooms.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/dustin/go-broadcast" 4 | 5 | var roomChannels = make(map[string]broadcast.Broadcaster) 6 | 7 | func openListener(roomid string) chan interface{} { 8 | listener := make(chan interface{}) 9 | room(roomid).Register(listener) 10 | return listener 11 | } 12 | 13 | func closeListener(roomid string, listener chan interface{}) { 14 | room(roomid).Unregister(listener) 15 | close(listener) 16 | } 17 | 18 | func room(roomid string) broadcast.Broadcaster { 19 | b, ok := roomChannels[roomid] 20 | if !ok { 21 | b = broadcast.NewBroadcaster(10) 22 | roomChannels[roomid] = b 23 | } 24 | return b 25 | } 26 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/realtime-chat/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "math/rand" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func main() { 12 | router := gin.Default() 13 | router.SetHTMLTemplate(html) 14 | 15 | router.GET("/room/:roomid", roomGET) 16 | router.POST("/room/:roomid", roomPOST) 17 | router.DELETE("/room/:roomid", roomDELETE) 18 | router.GET("/stream/:roomid", stream) 19 | 20 | router.Run(":8080") 21 | } 22 | 23 | func stream(c *gin.Context) { 24 | roomid := c.Param("roomid") 25 | listener := openListener(roomid) 26 | defer closeListener(roomid, listener) 27 | 28 | c.Stream(func(w io.Writer) bool { 29 | c.SSEvent("message", <-listener) 30 | return true 31 | }) 32 | } 33 | 34 | func roomGET(c *gin.Context) { 35 | roomid := c.Param("roomid") 36 | userid := fmt.Sprint(rand.Int31()) 37 | c.HTML(200, "chat_room", gin.H{ 38 | "roomid": roomid, 39 | "userid": userid, 40 | }) 41 | } 42 | 43 | func roomPOST(c *gin.Context) { 44 | roomid := c.Param("roomid") 45 | userid := c.PostForm("user") 46 | message := c.PostForm("message") 47 | room(roomid).Submit(userid + ": " + message) 48 | 49 | c.JSON(200, gin.H{ 50 | "status": "success", 51 | "message": message, 52 | }) 53 | } 54 | 55 | func roomDELETE(c *gin.Context) { 56 | roomid := c.Param("roomid") 57 | deleteBroadcast(roomid) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/examples/realtime-chat/rooms.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/dustin/go-broadcast" 4 | 5 | var roomChannels = make(map[string]broadcast.Broadcaster) 6 | 7 | func openListener(roomid string) chan interface{} { 8 | listener := make(chan interface{}) 9 | room(roomid).Register(listener) 10 | return listener 11 | } 12 | 13 | func closeListener(roomid string, listener chan interface{}) { 14 | room(roomid).Unregister(listener) 15 | close(listener) 16 | } 17 | 18 | func deleteBroadcast(roomid string) { 19 | b, ok := roomChannels[roomid] 20 | if ok { 21 | b.Close() 22 | delete(roomChannels, roomid) 23 | } 24 | } 25 | 26 | func room(roomid string) broadcast.Broadcaster { 27 | b, ok := roomChannels[roomid] 28 | if !ok { 29 | b = broadcast.NewBroadcaster(10) 30 | roomChannels[roomid] = b 31 | } 32 | return b 33 | } 34 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/fs.go: -------------------------------------------------------------------------------- 1 | package gin 2 | 3 | import ( 4 | "net/http" 5 | "os" 6 | ) 7 | 8 | type ( 9 | onlyfilesFS struct { 10 | fs http.FileSystem 11 | } 12 | neuteredReaddirFile struct { 13 | http.File 14 | } 15 | ) 16 | 17 | // Dir returns a http.Filesystem that can be used by http.FileServer(). It is used interally 18 | // in router.Static(). 19 | // if listDirectory == true, then it works the same as http.Dir() otherwise it returns 20 | // a filesystem that prevents http.FileServer() to list the directory files. 21 | func Dir(root string, listDirectory bool) http.FileSystem { 22 | fs := http.Dir(root) 23 | if listDirectory { 24 | return fs 25 | } 26 | return &onlyfilesFS{fs} 27 | } 28 | 29 | // Conforms to http.Filesystem 30 | func (fs onlyfilesFS) Open(name string) (http.File, error) { 31 | f, err := fs.fs.Open(name) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return neuteredReaddirFile{f}, nil 36 | } 37 | 38 | // Overrides the http.File default implementation 39 | func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) { 40 | // this disables directory listing 41 | return nil, nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gin 6 | 7 | import ( 8 | "io" 9 | "os" 10 | 11 | "github.com/gin-gonic/gin/binding" 12 | "github.com/mattn/go-colorable" 13 | ) 14 | 15 | const ENV_GIN_MODE = "GIN_MODE" 16 | 17 | const ( 18 | DebugMode string = "debug" 19 | ReleaseMode string = "release" 20 | TestMode string = "test" 21 | ) 22 | const ( 23 | debugCode = iota 24 | releaseCode = iota 25 | testCode = iota 26 | ) 27 | 28 | var DefaultWriter io.Writer = colorable.NewColorableStdout() 29 | var ginMode int = debugCode 30 | var modeName string = DebugMode 31 | 32 | func init() { 33 | mode := os.Getenv(ENV_GIN_MODE) 34 | if len(mode) == 0 { 35 | SetMode(DebugMode) 36 | } else { 37 | SetMode(mode) 38 | } 39 | } 40 | 41 | func SetMode(value string) { 42 | switch value { 43 | case DebugMode: 44 | ginMode = debugCode 45 | case ReleaseMode: 46 | ginMode = releaseCode 47 | case TestMode: 48 | ginMode = testCode 49 | default: 50 | panic("gin mode unknown: " + value) 51 | } 52 | modeName = value 53 | } 54 | 55 | func DisableBindValidation() { 56 | binding.Validator = nil 57 | } 58 | 59 | func Mode() string { 60 | return modeName 61 | } 62 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/mode_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gin 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func init() { 14 | SetMode(TestMode) 15 | } 16 | 17 | func TestSetMode(t *testing.T) { 18 | SetMode(DebugMode) 19 | assert.Equal(t, ginMode, debugCode) 20 | assert.Equal(t, Mode(), DebugMode) 21 | 22 | SetMode(ReleaseMode) 23 | assert.Equal(t, ginMode, releaseCode) 24 | assert.Equal(t, Mode(), ReleaseMode) 25 | 26 | SetMode(TestMode) 27 | assert.Equal(t, ginMode, testCode) 28 | assert.Equal(t, Mode(), TestMode) 29 | 30 | assert.Panics(t, func() { SetMode("unknown") }) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/recovery_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gin 6 | 7 | import ( 8 | "bytes" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | // TestPanicInHandler assert that panic has been recovered. 15 | func TestPanicInHandler(t *testing.T) { 16 | buffer := new(bytes.Buffer) 17 | router := New() 18 | router.Use(RecoveryWithWriter(buffer)) 19 | router.GET("/recovery", func(_ *Context) { 20 | panic("Oupps, Houston, we have a problem") 21 | }) 22 | // RUN 23 | w := performRequest(router, "GET", "/recovery") 24 | // TEST 25 | assert.Equal(t, w.Code, 500) 26 | assert.Contains(t, buffer.String(), "Panic recovery -> Oupps, Houston, we have a problem") 27 | assert.Contains(t, buffer.String(), "TestPanicInHandler") 28 | } 29 | 30 | // TestPanicWithAbort assert that panic has been recovered even if context.Abort was used. 31 | func TestPanicWithAbort(t *testing.T) { 32 | router := New() 33 | router.Use(RecoveryWithWriter(nil)) 34 | router.GET("/recovery", func(c *Context) { 35 | c.AbortWithStatus(400) 36 | panic("Oupps, Houston, we have a problem") 37 | }) 38 | // RUN 39 | w := performRequest(router, "GET", "/recovery") 40 | // TEST 41 | assert.Equal(t, w.Code, 500) // NOT SURE 42 | } 43 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/data.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import "net/http" 8 | 9 | type Data struct { 10 | ContentType string 11 | Data []byte 12 | } 13 | 14 | func (r Data) Render(w http.ResponseWriter) error { 15 | if len(r.ContentType) > 0 { 16 | w.Header()["Content-Type"] = []string{r.ContentType} 17 | } 18 | w.Write(r.Data) 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import ( 8 | "encoding/json" 9 | "net/http" 10 | ) 11 | 12 | type ( 13 | JSON struct { 14 | Data interface{} 15 | } 16 | 17 | IndentedJSON struct { 18 | Data interface{} 19 | } 20 | ) 21 | 22 | var jsonContentType = []string{"application/json; charset=utf-8"} 23 | 24 | func (r JSON) Render(w http.ResponseWriter) error { 25 | return WriteJSON(w, r.Data) 26 | } 27 | 28 | func (r IndentedJSON) Render(w http.ResponseWriter) error { 29 | writeContentType(w, jsonContentType) 30 | jsonBytes, err := json.MarshalIndent(r.Data, "", " ") 31 | if err != nil { 32 | return err 33 | } 34 | w.Write(jsonBytes) 35 | return nil 36 | } 37 | 38 | func WriteJSON(w http.ResponseWriter, obj interface{}) error { 39 | writeContentType(w, jsonContentType) 40 | return json.NewEncoder(w).Encode(obj) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/redirect.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import ( 8 | "fmt" 9 | "net/http" 10 | ) 11 | 12 | type Redirect struct { 13 | Code int 14 | Request *http.Request 15 | Location string 16 | } 17 | 18 | func (r Redirect) Render(w http.ResponseWriter) error { 19 | if r.Code < 300 || r.Code > 308 { 20 | panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code)) 21 | } 22 | http.Redirect(w, r.Request, r.Location, r.Code) 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/render.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import "net/http" 8 | 9 | type Render interface { 10 | Render(http.ResponseWriter) error 11 | } 12 | 13 | var ( 14 | _ Render = JSON{} 15 | _ Render = IndentedJSON{} 16 | _ Render = XML{} 17 | _ Render = String{} 18 | _ Render = Redirect{} 19 | _ Render = Data{} 20 | _ Render = HTML{} 21 | _ HTMLRender = HTMLDebug{} 22 | _ HTMLRender = HTMLProduction{} 23 | ) 24 | 25 | func writeContentType(w http.ResponseWriter, value []string) { 26 | header := w.Header() 27 | if val := header["Content-Type"]; len(val) == 0 { 28 | header["Content-Type"] = value 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/text.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | "net/http" 11 | ) 12 | 13 | type String struct { 14 | Format string 15 | Data []interface{} 16 | } 17 | 18 | var plainContentType = []string{"text/plain; charset=utf-8"} 19 | 20 | func (r String) Render(w http.ResponseWriter) error { 21 | WriteString(w, r.Format, r.Data) 22 | return nil 23 | } 24 | 25 | func WriteString(w http.ResponseWriter, format string, data []interface{}) { 26 | writeContentType(w, plainContentType) 27 | 28 | if len(data) > 0 { 29 | fmt.Fprintf(w, format, data...) 30 | } else { 31 | io.WriteString(w, format) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/render/xml.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved. 2 | // Use of this source code is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | package render 6 | 7 | import ( 8 | "encoding/xml" 9 | "net/http" 10 | ) 11 | 12 | type XML struct { 13 | Data interface{} 14 | } 15 | 16 | var xmlContentType = []string{"application/xml; charset=utf-8"} 17 | 18 | func (r XML) Render(w http.ResponseWriter) error { 19 | writeContentType(w, xmlContentType) 20 | return xml.NewEncoder(w).Encode(r.Data) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/src/github.com/gin-gonic/gin/wercker.yml: -------------------------------------------------------------------------------- 1 | box: wercker/default -------------------------------------------------------------------------------- /vendor/src/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/src/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/src/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/src/github.com/manucorporat/sse/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.3 5 | - 1.4 6 | - tip 7 | -------------------------------------------------------------------------------- /vendor/src/github.com/manucorporat/sse/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manuel Martínez-Almeida 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/src/github.com/manucorporat/sse/writer.go: -------------------------------------------------------------------------------- 1 | package sse 2 | 3 | import "io" 4 | 5 | type stringWriter interface { 6 | io.Writer 7 | WriteString(string) (int, error) 8 | } 9 | 10 | type stringWrapper struct { 11 | io.Writer 12 | } 13 | 14 | func (w stringWrapper) WriteString(str string) (int, error) { 15 | return w.Writer.Write([]byte(str)) 16 | } 17 | 18 | func checkWriter(writer io.Writer) stringWriter { 19 | if w, ok := writer.(stringWriter); ok { 20 | return w 21 | } else { 22 | return stringWrapper{writer} 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/src/github.com/mattn/go-colorable/README.md: -------------------------------------------------------------------------------- 1 | # go-colorable 2 | 3 | Colorable writer for windows. 4 | 5 | For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 6 | This package is possible to handle escape sequence for ansi color on windows. 7 | 8 | ## Too Bad! 9 | 10 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 11 | 12 | 13 | ## So Good! 14 | 15 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 16 | 17 | ## Usage 18 | 19 | ```go 20 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 21 | logrus.SetOutput(colorable.NewColorableStdout()) 22 | 23 | logrus.Info("succeeded") 24 | logrus.Warn("not correct") 25 | logrus.Error("something error") 26 | logrus.Fatal("panic") 27 | ``` 28 | 29 | You can compile above code on non-windows OSs. 30 | 31 | ## Installation 32 | 33 | ``` 34 | $ go get github.com/mattn/go-colorable 35 | ``` 36 | 37 | # License 38 | 39 | MIT 40 | 41 | # Author 42 | 43 | Yasuhiro Matsumoto (a.k.a mattn) 44 | -------------------------------------------------------------------------------- /vendor/src/github.com/mattn/go-colorable/_example/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/Sirupsen/logrus" 5 | "github.com/mattn/go-colorable" 6 | ) 7 | 8 | func main() { 9 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 10 | logrus.SetOutput(colorable.NewColorableStdout()) 11 | 12 | logrus.Info("succeeded") 13 | logrus.Warn("not correct") 14 | logrus.Error("something error") 15 | logrus.Fatal("panic") 16 | } 17 | -------------------------------------------------------------------------------- /vendor/src/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | func NewColorableStdout() io.Writer { 11 | return os.Stdout 12 | } 13 | 14 | func NewColorableStderr() io.Writer { 15 | return os.Stderr 16 | } 17 | -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - tip 7 | -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alec Thomas 2 | Guilhem Lettron 3 | Ivan Daniluk 4 | Nimi Wariboko Jr 5 | Róbert Selvek 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/backend.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package logging 6 | 7 | // defaultBackend is the backend used for all logging calls. 8 | var defaultBackend LeveledBackend 9 | 10 | // Backend is the interface which a log backend need to implement to be able to 11 | // be used as a logging backend. 12 | type Backend interface { 13 | Log(Level, int, *Record) error 14 | } 15 | 16 | // Set backend replaces the backend currently set with the given new logging 17 | // backend. 18 | func SetBackend(backends ...Backend) LeveledBackend { 19 | var backend Backend 20 | if len(backends) == 1 { 21 | backend = backends[0] 22 | } else { 23 | backend = MultiLogger(backends...) 24 | } 25 | 26 | defaultBackend = AddModuleLevel(backend) 27 | return defaultBackend 28 | } 29 | 30 | // SetLevel sets the logging level for the specified module. The module 31 | // corresponds to the string specified in GetLogger. 32 | func SetLevel(level Level, module string) { 33 | defaultBackend.SetLevel(level, module) 34 | } 35 | 36 | // GetLevel returns the logging level for the specified module. 37 | func GetLevel(module string) Level { 38 | return defaultBackend.GetLevel(module) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/example_test.go: -------------------------------------------------------------------------------- 1 | package logging 2 | 3 | import "os" 4 | 5 | func Example() { 6 | // This call is for testing purposes and will set the time to unix epoch. 7 | InitForTesting(DEBUG) 8 | 9 | var log = MustGetLogger("example") 10 | 11 | // For demo purposes, create two backend for os.Stdout. 12 | // 13 | // os.Stderr should most likely be used in the real world but then the 14 | // "Output:" check in this example would not work. 15 | backend1 := NewLogBackend(os.Stdout, "", 0) 16 | backend2 := NewLogBackend(os.Stdout, "", 0) 17 | 18 | // For messages written to backend2 we want to add some additional 19 | // information to the output, including the used log level and the name of 20 | // the function. 21 | var format = MustStringFormatter( 22 | "%{time:15:04:05.000} %{shortfunc} %{level:.1s} %{message}", 23 | ) 24 | backend2Formatter := NewBackendFormatter(backend2, format) 25 | 26 | // Only errors and more severe messages should be sent to backend2 27 | backend2Leveled := AddModuleLevel(backend2Formatter) 28 | backend2Leveled.SetLevel(ERROR, "") 29 | 30 | // Set the backends to be used and the default level. 31 | SetBackend(backend1, backend2Leveled) 32 | 33 | log.Debug("debug %s", "arg") 34 | log.Error("error") 35 | 36 | // Output: 37 | // debug arg 38 | // error 39 | // 00:00:00.000 Example E error 40 | } 41 | -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/examples/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/op/go-logging/examples/example.png -------------------------------------------------------------------------------- /vendor/src/github.com/op/go-logging/syslog_fallback.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build windows plan9 6 | 7 | package logging 8 | 9 | import ( 10 | "fmt" 11 | ) 12 | 13 | type Priority int 14 | 15 | type SyslogBackend struct { 16 | } 17 | 18 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 19 | return nil, fmt.Errorf("Platform does not support syslog") 20 | } 21 | 22 | func NewSyslogBackendPriority(prefix string, priority Priority) (b *SyslogBackend, err error) { 23 | return nil, fmt.Errorf("Platform does not support syslog") 24 | } 25 | 26 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 27 | return fmt.Errorf("Platform does not support syslog") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | 8 | install: 9 | - go get golang.org/x/tools/cover 10 | 11 | sudo: false 12 | -------------------------------------------------------------------------------- /vendor/src/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/src/github.com/smartystreets/assertions/assertions.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -coverpkg=github.com/smartystreets/assertions,github.com/smartystreets/assertions/internal/oglematchers -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/doc_test.go: -------------------------------------------------------------------------------- 1 | package assertions 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "testing" 7 | ) 8 | 9 | func TestPassingAssertion(t *testing.T) { 10 | fake := &FakeT{buffer: new(bytes.Buffer)} 11 | assertion := New(fake) 12 | passed := assertion.So(1, ShouldEqual, 1) 13 | 14 | if !passed { 15 | t.Error("Assertion failed when it should have passed.") 16 | } 17 | if fake.buffer.Len() > 0 { 18 | t.Error("Unexpected error message was printed.") 19 | } 20 | } 21 | 22 | func TestFailingAssertion(t *testing.T) { 23 | fake := &FakeT{buffer: new(bytes.Buffer)} 24 | assertion := New(fake) 25 | passed := assertion.So(1, ShouldEqual, 2) 26 | 27 | if passed { 28 | t.Error("Assertion passed when it should have failed.") 29 | } 30 | if fake.buffer.Len() == 0 { 31 | t.Error("Expected error message not printed.") 32 | } 33 | } 34 | 35 | type FakeT struct { 36 | buffer *bytes.Buffer 37 | } 38 | 39 | func (this *FakeT) Error(args ...interface{}) { 40 | fmt.Fprint(this.buffer, args...) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/src/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/src/github.com/smartystreets/assertions/internal/Makefile: -------------------------------------------------------------------------------- 1 | # This Makefile pulls the latest oglematchers (with dependencies), 2 | # rewrites the imports to match this location, 3 | # and ensures that all the tests pass. 4 | 5 | go: clean clone rewrite test 6 | 7 | clean: 8 | rm -rf ogle* 9 | rm -rf reqtrace 10 | 11 | clone: 12 | git clone https://github.com/jacobsa/ogletest.git && rm -rf ogletest/.git 13 | git clone https://github.com/jacobsa/oglemock.git && rm -rf oglemock/.git 14 | git clone https://github.com/jacobsa/oglematchers.git && rm -rf oglematchers/.git 15 | git clone https://github.com/jacobsa/reqtrace.git && rm -rf reqtrace/.git 16 | 17 | rewrite: 18 | grep -rl --exclude Makefile 'github.com/jacobsa' . | xargs sed -i '' 's#github.com/jacobsa#github.com/smartystreets/assertions/internal#g' 19 | 20 | test: 21 | go test github.com/smartystreets/assertions/... 22 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglematchers/.gitignore: -------------------------------------------------------------------------------- 1 | *.6 2 | 6.out 3 | _obj/ 4 | _test/ 5 | _testmain.go 6 | -------------------------------------------------------------------------------- /vendor/src/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/src/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/src/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/src/github.com/smartystreets/assertions/internal/oglemock/.gitignore: -------------------------------------------------------------------------------- 1 | *.6 2 | 6.out 3 | _obj/ 4 | _test/ 5 | _testmain.go 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/.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/src/github.com/smartystreets/assertions/internal/oglemock/createmock/test_cases/golden.no_interfaces: -------------------------------------------------------------------------------- 1 | Usage: createmock [package] [interface ...] 2 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/createmock/test_cases/golden.no_package: -------------------------------------------------------------------------------- 1 | Usage: createmock [package] [interface ...] 2 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/createmock/test_cases/golden.unknown_interface: -------------------------------------------------------------------------------- 1 | Unknown interface: Frobnicator 2 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/createmock/test_cases/golden.unknown_package: -------------------------------------------------------------------------------- 1 | Unknown package: foo/bar 2 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/generate/test_cases/renamed_pkg/renamed_pkg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 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 | // A package that calls itself something different than its package path would 17 | // have you believe. 18 | package tony 19 | 20 | type SomeUint8Alias uint8 21 | 22 | type SomeInterface interface { 23 | DoFoo(a int) int 24 | } 25 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/oglemock/sample/README.markdown: -------------------------------------------------------------------------------- 1 | This directory contains sample code generated with the `createmock` command. For 2 | example, the file `mock_io.go` can be regenerated with: 3 | 4 | createmock io Reader > sample/mock_io/mock_io.go 5 | 6 | The files are also used by `integration_test.go`. 7 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/.gitignore: -------------------------------------------------------------------------------- 1 | *.6 2 | 6.out 3 | _obj/ 4 | _test/ 5 | _testmain.go 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/.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/src/github.com/smartystreets/assertions/internal/ogletest/srcutil/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Aaron Jacobs. All Rights Reserved. 2 | // Author: aaronjjacobs@gmail.com (Aaron Jacobs) 3 | 4 | // Functions for working with source code. 5 | package srcutil 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.filtered_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from PartiallyFilteredTest 2 | [ RUN ] PartiallyFilteredTest.PassingTestBar 3 | [ OK ] PartiallyFilteredTest.PassingTestBar 4 | [ RUN ] PartiallyFilteredTest.PartiallyFilteredTestBar 5 | filtered_test.go:49: 6 | Expected: has substring "blah" 7 | Actual: taco 8 | 9 | [ FAILED ] PartiallyFilteredTest.PartiallyFilteredTestBar 10 | [ RUN ] PartiallyFilteredTest.PartiallyFilteredTestBaz 11 | filtered_test.go:53: 12 | Expected: less than 17 13 | Actual: 18 14 | 15 | [ FAILED ] PartiallyFilteredTest.PartiallyFilteredTestBaz 16 | [----------] Finished with tests from PartiallyFilteredTest 17 | [----------] Running tests from CompletelyFilteredTest 18 | SetUpTestSuite run! 19 | TearDownTestSuite run! 20 | [----------] Finished with tests from CompletelyFilteredTest 21 | --- FAIL: TestSomething (1.23s) 22 | FAIL 23 | exit status 1 24 | FAIL somepkg 1.234s 25 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.mock_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from MockTest 2 | [ RUN ] MockTest.ExpectationSatisfied 3 | [ OK ] MockTest.ExpectationSatisfied 4 | [ RUN ] MockTest.MockExpectationNotSatisfied 5 | /some/path/mock_test.go:56: 6 | Unsatisfied expectation; expected At to be called at least 1 times; called 0 times. 7 | 8 | [ FAILED ] MockTest.MockExpectationNotSatisfied 9 | [ RUN ] MockTest.ExpectCallForUnknownMethod 10 | /some/path/mock_test.go:61: 11 | Unknown method: FooBar 12 | 13 | [ FAILED ] MockTest.ExpectCallForUnknownMethod 14 | [ RUN ] MockTest.UnexpectedCall 15 | /some/path/mock_test.go:65: 16 | Unexpected call to At with args: [11 23] 17 | 18 | [ FAILED ] MockTest.UnexpectedCall 19 | [ RUN ] MockTest.InvokeFunction 20 | [ OK ] MockTest.InvokeFunction 21 | [----------] Finished with tests from MockTest 22 | --- FAIL: TestSomething (1.23s) 23 | FAIL 24 | exit status 1 25 | FAIL somepkg 1.234s 26 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.no_cases_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from NoCasesTest 2 | SetUpTestSuite run! 3 | TearDownTestSuite run! 4 | [----------] Finished with tests from NoCasesTest 5 | PASS 6 | ok somepkg 1.234s 7 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.passing_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from PassingTest 2 | [ RUN ] PassingTest.EmptyTestMethod 3 | [ OK ] PassingTest.EmptyTestMethod 4 | [ RUN ] PassingTest.SuccessfullMatches 5 | [ OK ] PassingTest.SuccessfullMatches 6 | [ RUN ] PassingTest.ExpectAliases 7 | [ OK ] PassingTest.ExpectAliases 8 | [ RUN ] PassingTest.AssertAliases 9 | [ OK ] PassingTest.AssertAliases 10 | [ RUN ] PassingTest.SlowTest 11 | [ OK ] PassingTest.SlowTest (1234ms) 12 | [----------] Finished with tests from PassingTest 13 | [----------] Running tests from PassingTestWithHelpers 14 | SetUpTestSuite ran. 15 | [ RUN ] PassingTestWithHelpers.EmptyTestMethod 16 | SetUp ran. 17 | TearDown ran. 18 | [ OK ] PassingTestWithHelpers.EmptyTestMethod 19 | TearDownTestSuite ran. 20 | [----------] Finished with tests from PassingTestWithHelpers 21 | PASS 22 | ok somepkg 1.234s 23 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.run_twice_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from RunTwiceTest 2 | [ RUN ] RunTwiceTest.PassingMethod 3 | [ OK ] RunTwiceTest.PassingMethod 4 | [ RUN ] RunTwiceTest.FailingMethod 5 | run_twice_test.go:46: 6 | Expected: 17.5 7 | Actual: 17 8 | 9 | [ FAILED ] RunTwiceTest.FailingMethod 10 | [----------] Finished with tests from RunTwiceTest 11 | --- FAIL: TestSomething (1.23s) 12 | FAIL 13 | exit status 1 14 | FAIL somepkg 1.234s 15 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.stop_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from StopTest 2 | [ RUN ] StopTest.First 3 | TearDown running. 4 | [ OK ] StopTest.First 5 | [ RUN ] StopTest.Second 6 | About to call StopRunningTests. 7 | Called StopRunningTests. 8 | TearDown running. 9 | [ OK ] StopTest.Second 10 | TearDownTestSuite running. 11 | Exiting early due to user request. 12 | exit status 1 13 | FAIL somepkg 1.234s 14 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/ogletest/test_cases/golden.unexported_test: -------------------------------------------------------------------------------- 1 | [----------] Running tests from UnexportedTest 2 | [ RUN ] UnexportedTest.SomeTest 3 | unexported_test.go:42: 4 | Expected: 4 5 | Actual: 3 6 | 7 | [ FAILED ] UnexportedTest.SomeTest 8 | [----------] Finished with tests from UnexportedTest 9 | --- FAIL: TestSomething (1.23s) 10 | FAIL 11 | exit status 1 12 | FAIL somepkg 1.234s 13 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/assertions/internal/reqtrace/.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/src/github.com/smartystreets/assertions/serializer_test.go: -------------------------------------------------------------------------------- 1 | package assertions 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "testing" 7 | 8 | "github.com/smartystreets/goconvey/convey/reporting" 9 | ) 10 | 11 | func TestSerializerCreatesSerializedVersionOfAssertionResult(t *testing.T) { 12 | thing1 := Thing1{"Hi"} 13 | thing2 := Thing2{"Bye"} 14 | message := "Super-hip failure message." 15 | serializer := newSerializer() 16 | 17 | actualResult := serializer.serialize(thing1, thing2, message) 18 | 19 | expectedResult, _ := json.Marshal(reporting.FailureView{ 20 | Message: message, 21 | Expected: fmt.Sprintf("%+v", thing1), 22 | Actual: fmt.Sprintf("%+v", thing2), 23 | }) 24 | 25 | if actualResult != string(expectedResult) { 26 | t.Errorf("\nExpected: %s\nActual: %s", string(expectedResult), actualResult) 27 | } 28 | 29 | actualResult = serializer.serializeDetailed(thing1, thing2, message) 30 | expectedResult, _ = json.Marshal(reporting.FailureView{ 31 | Message: message, 32 | Expected: fmt.Sprintf("%#v", thing1), 33 | Actual: fmt.Sprintf("%#v", thing2), 34 | }) 35 | if actualResult != string(expectedResult) { 36 | t.Errorf("\nExpected: %s\nActual: %s", string(expectedResult), actualResult) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | examples/output.json 4 | web/client/reports/ -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | 8 | install: 9 | - go get github.com/smartystreets/assertions 10 | - go get golang.org/x/tools/cover 11 | - go get github.com/jtolds/gls 12 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | At SmartyStreets we find GoConvey to be wonderfully useful and have declared the project "feature-complete" as it currently stands and so other projects are crowding in. Having said that, we welcome contributions, especially fixes to incorrect behavior (ok I'll admit it, there are some bugs...). 2 | 3 | You can track the progress of known issues on our public [Trello](https://trello.com/b/hM7xVauQ/goconvey) board. If you'd like to see a new feature included or have a bug report, please send an email to [goconvey@smartystreets.com](goconvey@smartystreets.com). -------------------------------------------------------------------------------- /vendor/src/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/src/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/src/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") { 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/src/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/src/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/src/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/src/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/src/github.com/smartystreets/goconvey/convey/reporting/dot_test.go: -------------------------------------------------------------------------------- 1 | package reporting 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | ) 7 | 8 | func TestDotReporterAssertionPrinting(t *testing.T) { 9 | monochrome() 10 | file := newMemoryFile() 11 | printer := NewPrinter(file) 12 | reporter := NewDotReporter(printer) 13 | 14 | reporter.Report(NewSuccessReport()) 15 | reporter.Report(NewFailureReport("failed")) 16 | reporter.Report(NewErrorReport(errors.New("error"))) 17 | reporter.Report(NewSkipReport()) 18 | 19 | expected := dotSuccess + dotFailure + dotError + dotSkip 20 | 21 | if file.buffer != expected { 22 | t.Errorf("\nExpected: '%s'\nActual: '%s'", expected, file.buffer) 23 | } 24 | } 25 | 26 | func TestDotReporterOnlyReportsAssertions(t *testing.T) { 27 | monochrome() 28 | file := newMemoryFile() 29 | printer := NewPrinter(file) 30 | reporter := NewDotReporter(printer) 31 | 32 | reporter.BeginStory(nil) 33 | reporter.Enter(nil) 34 | reporter.Exit() 35 | reporter.EndStory() 36 | 37 | if file.buffer != "" { 38 | t.Errorf("\nExpected: '(blank)'\nActual: '%s'", file.buffer) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/src/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/src/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/src/github.com/smartystreets/goconvey/convey/reporting/reporting.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/dependencies.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import _ "github.com/jtolds/gls" 4 | import _ "github.com/smartystreets/assertions" 5 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/examples/doc.go: -------------------------------------------------------------------------------- 1 | // Package examples contains, well, examples of how to use goconvey to 2 | // specify behavior of a system under test. It contains a well-known example 3 | // by Robert C. Martin called "Bowling Game Kata" as well as another very 4 | // trivial example that demonstrates Reset() and some of the assertions. 5 | package examples 6 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/examples/examples.goconvey: -------------------------------------------------------------------------------- 1 | // Uncomment the next line to disable the package when running the GoConvey UI: 2 | //IGNORE 3 | 4 | // Uncomment the next line to limit testing to the specified test function name pattern: 5 | //-run=TestAssertionsAreAvailableFromConveyPackage 6 | 7 | // Uncomment the next line to limit testing to those tests that don't bail when testing.Short() is true: 8 | //-short 9 | 10 | // include any additional `go test` flags or application-specific flags below: 11 | 12 | -timeout=1s 13 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/examples/simple_example_test.go: -------------------------------------------------------------------------------- 1 | package examples 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/smartystreets/goconvey/convey" 7 | ) 8 | 9 | func TestIntegerManipulation(t *testing.T) { 10 | t.Parallel() 11 | 12 | Convey("Given a starting integer value", t, func() { 13 | x := 42 14 | 15 | Convey("When incremented", func() { 16 | x++ 17 | 18 | Convey("The value should be greater by one", func() { 19 | So(x, ShouldEqual, 43) 20 | }) 21 | Convey("The value should NOT be what it used to be", func() { 22 | So(x, ShouldNotEqual, 42) 23 | }) 24 | }) 25 | Convey("When decremented", func() { 26 | x-- 27 | 28 | Convey("The value should be lesser by one", func() { 29 | So(x, ShouldEqual, 41) 30 | }) 31 | Convey("The value should NOT be what it used to be", func() { 32 | So(x, ShouldNotEqual, 42) 33 | }) 34 | }) 35 | }) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/composer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GoConvey Composer 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |

15 | 16 | 17 |

18 |
19 |
20 | 21 |
22 |
23 | 24 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/favicon.ico -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/FontAwesome.otf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/FontAwesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Italic.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Light.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Open_Sans/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/Orbitron-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/Orbitron-Regular.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/Oswald-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/Oswald-Regular.ttf -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-buildfail.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-buildfail.ico -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-fail.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-fail.ico -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-ok.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-ok.ico -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-panic.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/github.com/smartystreets/goconvey/web/client/resources/ico/goconvey-panic.ico -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/client/resources/js/config.js: -------------------------------------------------------------------------------- 1 | // Configure the GoConvey web UI client in here 2 | 3 | convey.config = { 4 | 5 | // Install new themes by adding them here; the first one will be default 6 | themes: { 7 | "dark": { name: "Dark", filename: "dark.css", coverage: "hsla({{hue}}, 75%, 30%, .5)" }, 8 | "dark-bigtext": { name: "Dark-BigText", filename: "dark-bigtext.css", coverage: "hsla({{hue}}, 75%, 30%, .5)" }, 9 | "light": { name: "Light", filename: "light.css", coverage: "hsla({{hue}}, 62%, 75%, 1)" } 10 | }, 11 | 12 | // Path to the themes (end with forward-slash) 13 | themePath: "/resources/css/themes/" 14 | 15 | }; -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/api/api.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/contract/contracts.go: -------------------------------------------------------------------------------- 1 | package contract 2 | 3 | import "net/http" 4 | 5 | type ( 6 | Server interface { 7 | ReceiveUpdate(root string, update *CompleteOutput) 8 | Watch(writer http.ResponseWriter, request *http.Request) 9 | Ignore(writer http.ResponseWriter, request *http.Request) 10 | Reinstate(writer http.ResponseWriter, request *http.Request) 11 | Status(writer http.ResponseWriter, request *http.Request) 12 | LongPollStatus(writer http.ResponseWriter, request *http.Request) 13 | Results(writer http.ResponseWriter, request *http.Request) 14 | Execute(writer http.ResponseWriter, request *http.Request) 15 | TogglePause(writer http.ResponseWriter, request *http.Request) 16 | } 17 | 18 | Executor interface { 19 | ExecuteTests([]*Package) *CompleteOutput 20 | Status() string 21 | ClearStatusFlag() bool 22 | } 23 | 24 | Shell interface { 25 | GoTest(directory, packageName string, tags, arguments []string) (output string, err error) 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/executor/contract.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import "github.com/smartystreets/goconvey/web/server/contract" 4 | 5 | type Parser interface { 6 | Parse([]*contract.Package) 7 | } 8 | 9 | type Tester interface { 10 | SetBatchSize(batchSize int) 11 | TestAll(folders []*contract.Package) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/executor/executor.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/messaging/messages.go: -------------------------------------------------------------------------------- 1 | package messaging 2 | 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | type WatcherCommand struct { 6 | Instruction WatcherInstruction 7 | Details string 8 | } 9 | 10 | type WatcherInstruction int 11 | 12 | func (this WatcherInstruction) String() string { 13 | switch this { 14 | case WatcherPause: 15 | return "Pause" 16 | case WatcherResume: 17 | return "Resume" 18 | case WatcherIgnore: 19 | return "Ignore" 20 | case WatcherReinstate: 21 | return "Reinstate" 22 | case WatcherAdjustRoot: 23 | return "AdjustRoot" 24 | case WatcherExecute: 25 | return "Execute" 26 | case WatcherStop: 27 | return "Stop" 28 | default: 29 | return "UNKNOWN INSTRUCTION" 30 | } 31 | } 32 | 33 | const ( 34 | WatcherPause WatcherInstruction = iota 35 | WatcherResume 36 | WatcherIgnore 37 | WatcherReinstate 38 | WatcherAdjustRoot 39 | WatcherExecute 40 | WatcherStop 41 | ) 42 | 43 | /////////////////////////////////////////////////////////////////////////////// 44 | 45 | type Folders map[string]*Folder 46 | 47 | type Folder struct { 48 | Path string // key 49 | Root string 50 | Ignored bool 51 | Disabled bool 52 | BuildTags []string 53 | TestArguments []string 54 | } 55 | 56 | /////////////////////////////////////////////////////////////////////////////// 57 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/parser/parser.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/smartystreets/goconvey/web/server/contract" 7 | ) 8 | 9 | type Parser struct { 10 | parser func(*contract.PackageResult, string) 11 | } 12 | 13 | func (self *Parser) Parse(packages []*contract.Package) { 14 | for _, p := range packages { 15 | if p.Active() && p.HasUsableResult() { 16 | self.parser(p.Result, p.Output) 17 | } else if p.Ignored { 18 | p.Result.Outcome = contract.Ignored 19 | } else if p.Disabled { 20 | p.Result.Outcome = contract.Disabled 21 | } else { 22 | p.Result.Outcome = contract.TestRunAbortedUnexpectedly 23 | } 24 | log.Printf("[%s]: %s\n", p.Result.Outcome, p.Name) 25 | } 26 | } 27 | 28 | func NewParser(helper func(*contract.PackageResult, string)) *Parser { 29 | self := new(Parser) 30 | self.parser = helper 31 | return self 32 | } 33 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/parser/parser.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/parser/util.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "math" 5 | "strings" 6 | "time" 7 | ) 8 | 9 | // parseTestFunctionDuration parses the duration in seconds as a float64 10 | // from a line of go test output that looks something like this: 11 | // --- PASS: TestOldSchool_PassesWithMessage (0.03 seconds) 12 | func parseTestFunctionDuration(line string) float64 { 13 | line = strings.Replace(line, "(", "", 1) 14 | fields := strings.Split(line, " ") 15 | return parseDurationInSeconds(fields[3]+"s", 2) 16 | } 17 | 18 | func parseDurationInSeconds(raw string, precision int) float64 { 19 | elapsed, _ := time.ParseDuration(raw) 20 | return round(elapsed.Seconds(), precision) 21 | } 22 | 23 | // round returns the rounded version of x with precision. 24 | // 25 | // Special cases are: 26 | // round(±0) = ±0 27 | // round(±Inf) = ±Inf 28 | // round(NaN) = NaN 29 | // 30 | // Why, oh why doesn't the math package come with a round function? 31 | // Inspiration: http://play.golang.org/p/ZmFfr07oHp 32 | func round(x float64, precision int) float64 { 33 | var rounder float64 34 | pow := math.Pow(10, float64(precision)) 35 | intermediate := x * pow 36 | 37 | if intermediate < 0.0 { 38 | intermediate -= 0.5 39 | } else { 40 | intermediate += 0.5 41 | } 42 | rounder = float64(int64(intermediate)) 43 | 44 | return rounder / float64(pow) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/system/shell_integration_test.go: -------------------------------------------------------------------------------- 1 | package system 2 | 3 | import ( 4 | "log" 5 | "path/filepath" 6 | "runtime" 7 | "strings" 8 | 9 | "testing" 10 | ) 11 | 12 | func TestShellIntegration(t *testing.T) { 13 | if testing.Short() { 14 | t.Skip("Skipping potentially long-running integration test...") 15 | return 16 | } 17 | 18 | log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds) 19 | 20 | _, filename, _, _ := runtime.Caller(0) 21 | directory := filepath.Join(filepath.Dir(filename), "..", "watch", "integration_testing", "sub") 22 | packageName := "github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub" 23 | 24 | shell := NewShell("go", "", true, "5s") 25 | output, err := shell.GoTest(directory, packageName, []string{}, []string{"-short"}) 26 | 27 | if !strings.Contains(output, "PASS\n") || !strings.Contains(output, "ok") { 28 | t.Errorf("Expected output that resembed tests passing but got this instead: [%s]", output) 29 | } 30 | if err != nil { 31 | t.Error("Test run resulted in the following error:", err) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/system/system.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -short -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/integration_testing/main.go: -------------------------------------------------------------------------------- 1 | // This file's only purpose is to provide a realistic 2 | // environment from which to run integration tests 3 | // against the Watcher. 4 | package main 5 | 6 | import "fmt" 7 | 8 | func main() { 9 | fmt.Println("Hello, World!") 10 | } 11 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/.gitignore: -------------------------------------------------------------------------------- 1 | github.com-smartystreets-goconvey-web-server-integration_testing-sub.html 2 | github.com-smartystreets-goconvey-web-server-integration_testing-sub.txt -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff.go: -------------------------------------------------------------------------------- 1 | // This file's only purpose is to provide a realistic 2 | // environment from which to run integration tests 3 | // against the Watcher. 4 | package sub 5 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff_test.go: -------------------------------------------------------------------------------- 1 | // This file's only purpose is to provide a realistic 2 | // environment from which to run integration tests 3 | // against the Watcher. 4 | package sub 5 | 6 | import ( 7 | "fmt" 8 | "testing" 9 | ) 10 | 11 | func TestStuff(t *testing.T) { 12 | if testing.Short() { 13 | return 14 | } 15 | 16 | fmt.Println() 17 | } 18 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/sub.goconvey: -------------------------------------------------------------------------------- 1 | IGNORE 2 | -short 3 | -run=TestStuff 4 | 5 | // This file's only purpose is to provide a realistic 6 | // environment from which to run integration tests 7 | // against the Watcher. 8 | -------------------------------------------------------------------------------- /vendor/src/github.com/smartystreets/goconvey/web/server/watch/watch.goconvey: -------------------------------------------------------------------------------- 1 | #ignore 2 | -timeout=1s 3 | -short -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all files in this repo as binary, with no git magic updating 2 | # line endings. Windows users contributing to Go will need to use a 3 | # modern version of git and editors capable of LF line endings. 4 | # 5 | # We'll prevent accidental CRLF line endings from entering the repo 6 | # via the git-review gofmt checks. 7 | # 8 | # See golang.org/issue/9281 9 | 10 | * -text 11 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .hgignore except for files generated by the build. 2 | last-change 3 | -------------------------------------------------------------------------------- /vendor/src/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/src/golang.org/x/net/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Go 2 | 3 | Go is an open source project. 4 | 5 | It is the work of hundreds of contributors. We appreciate your help! 6 | 7 | 8 | ## Filing issues 9 | 10 | When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 11 | 12 | 1. What version of Go are you using (`go version`)? 13 | 2. What operating system and processor architecture are you using? 14 | 3. What did you do? 15 | 4. What did you expect to see? 16 | 5. What did you see instead? 17 | 18 | General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. 19 | The gophers there will answer or ask you to file an issue if you've tripped over a bug. 20 | 21 | ## Contributing code 22 | 23 | Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) 24 | before sending patches. 25 | 26 | **We do not accept GitHub pull requests** 27 | (we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). 28 | 29 | Unless otherwise noted, the Go source files are distributed under 30 | the BSD-style license found in the LICENSE file. 31 | 32 | -------------------------------------------------------------------------------- /vendor/src/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/src/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/src/golang.org/x/net/README: -------------------------------------------------------------------------------- 1 | This repository holds supplementary Go networking libraries. 2 | 3 | To submit changes to this repository, see http://golang.org/doc/contribute.html. 4 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/context/withtimeout_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | "fmt" 9 | "time" 10 | 11 | "golang.org/x/net/context" 12 | ) 13 | 14 | func ExampleWithTimeout() { 15 | // Pass a context with a timeout to tell a blocking function that it 16 | // should abandon its work after the timeout elapses. 17 | ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) 18 | select { 19 | case <-time.After(200 * time.Millisecond): 20 | fmt.Println("overslept") 21 | case <-ctx.Done(): 22 | fmt.Println(ctx.Err()) // prints "context deadline exceeded" 23 | } 24 | // Output: 25 | // context deadline exceeded 26 | } 27 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/charset/testdata/README: -------------------------------------------------------------------------------- 1 | These test cases come from 2 | http://www.w3.org/International/tests/repository/html5/the-input-byte-stream/results-basics 3 | 4 | Distributed under both the W3C Test Suite License 5 | (http://www.w3.org/Consortium/Legal/2008/04-testsuite-license) 6 | and the W3C 3-clause BSD License 7 | (http://www.w3.org/Consortium/Legal/2008/03-bsd-license). 8 | To contribute to a W3C Test Suite, see the policies and contribution 9 | forms (http://www.w3.org/2004/10/27-testcases). 10 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb-labs/mongoproxy/60648291da5026a12328b67578f0400e17eee62c/vendor/src/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/entity_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 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 html 6 | 7 | import ( 8 | "testing" 9 | "unicode/utf8" 10 | ) 11 | 12 | func TestEntityLength(t *testing.T) { 13 | // We verify that the length of UTF-8 encoding of each value is <= 1 + len(key). 14 | // The +1 comes from the leading "&". This property implies that the length of 15 | // unescaped text is <= the length of escaped text. 16 | for k, v := range entity { 17 | if 1+len(k) < utf8.RuneLen(v) { 18 | t.Error("escaped entity &" + k + " is shorter than its UTF-8 encoding " + string(v)) 19 | } 20 | if len(k) > longestEntityWithoutSemicolon && k[len(k)-1] != ';' { 21 | t.Errorf("entity name %s is %d characters, but longestEntityWithoutSemicolon=%d", k, len(k), longestEntityWithoutSemicolon) 22 | } 23 | } 24 | for k, v := range entity2 { 25 | if 1+len(k) < utf8.RuneLen(v[0])+utf8.RuneLen(v[1]) { 26 | t.Error("escaped entity &" + k + " is shorter than its UTF-8 encoding " + string(v[0]) + string(v[1])) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This example demonstrates parsing HTML data and walking the resulting tree. 6 | package html_test 7 | 8 | import ( 9 | "fmt" 10 | "log" 11 | "strings" 12 | 13 | "golang.org/x/net/html" 14 | ) 15 | 16 | func ExampleParse() { 17 | s := `

Links:

` 18 | doc, err := html.Parse(strings.NewReader(s)) 19 | if err != nil { 20 | log.Fatal(err) 21 | } 22 | var f func(*html.Node) 23 | f = func(n *html.Node) { 24 | if n.Type == html.ElementNode && n.Data == "a" { 25 | for _, a := range n.Attr { 26 | if a.Key == "href" { 27 | fmt.Println(a.Val) 28 | break 29 | } 30 | } 31 | } 32 | for c := n.FirstChild; c != nil; c = c.NextSibling { 33 | f(c) 34 | } 35 | } 36 | f(doc) 37 | // Output: 38 | // foo 39 | // /bar/baz 40 | } 41 | -------------------------------------------------------------------------------- /vendor/src/golang.org/x/net/html/testdata/webkit/adoption02.dat: -------------------------------------------------------------------------------- 1 | #data 2 | 12

34 3 | #errors 4 | #document 5 | | 6 | | 7 | | 8 | | 9 | | "1" 10 | | 11 | | "2" 12 | | 13 | |

14 | | 15 | | "3" 16 | | "4" 17 | 18 | #data 19 |

20 | #errors 21 | #document 22 | | 23 | | 24 | | 25 | | 26 | |
27 | | 28 | |