├── configuration ├── arl-setbind.sh └── arl.service ├── database ├── clear-database.sql ├── grant-privileges.sql └── schema.sql ├── documents ├── compilation.md ├── compilation.pdf ├── configuration.md ├── configuration.pdf ├── information.md ├── information.pdf ├── installation.md └── installation.pdf ├── readme.md ├── readme.pdf └── source ├── src └── info-assure │ ├── arl-server.config │ ├── config.go │ ├── database.go │ ├── email.go │ ├── global.go │ ├── helper.go │ ├── main.go │ ├── processor.go │ ├── routes.go │ ├── tasks.go │ └── xml.go └── vendor ├── manifest └── src ├── github.com ├── MichaelTJones │ └── walk │ │ ├── README.md │ │ ├── path_plan9.go │ │ ├── path_unix.go │ │ ├── path_windows.go │ │ ├── symlink.go │ │ ├── symlink_windows.go │ │ ├── walk.go │ │ └── walk_test.go ├── cenkalti │ └── backoff │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backoff.go │ │ ├── backoff_test.go │ │ ├── example_test.go │ │ ├── exponential.go │ │ ├── exponential_test.go │ │ ├── retry.go │ │ ├── retry_test.go │ │ ├── ticker.go │ │ └── ticker_test.go ├── dustin │ └── go-broadcast │ │ ├── LICENSE │ │ ├── README.markdown │ │ ├── broadcaster.go │ │ ├── broadcaster_test.go │ │ ├── mux_observer.go │ │ └── mux_observer_test.go ├── garyburd │ └── redigo │ │ ├── internal │ │ ├── commandinfo.go │ │ ├── commandinfo_test.go │ │ └── redistest │ │ │ └── testdb.go │ │ └── redis │ │ ├── conn.go │ │ ├── conn_test.go │ │ ├── doc.go │ │ ├── go17.go │ │ ├── log.go │ │ ├── pool.go │ │ ├── pool_test.go │ │ ├── pre_go17.go │ │ ├── pubsub.go │ │ ├── pubsub_test.go │ │ ├── redis.go │ │ ├── reply.go │ │ ├── reply_test.go │ │ ├── scan.go │ │ ├── scan_test.go │ │ ├── script.go │ │ ├── script_test.go │ │ ├── test_test.go │ │ └── zpop_example_test.go ├── gin-gonic │ └── gin │ │ ├── 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 │ │ ├── example │ │ │ ├── test.pb.go │ │ │ └── test.proto │ │ ├── form.go │ │ ├── form_mapping.go │ │ ├── json.go │ │ ├── protobuf.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 │ │ ├── ginS │ │ ├── README.md │ │ └── gins.go │ │ ├── gin_integration_test.go │ │ ├── gin_test.go │ │ ├── githubapi_test.go │ │ ├── helpers_test.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── logo.jpg │ │ ├── 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 │ │ └── yaml.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 ├── golang │ └── protobuf │ │ └── proto │ │ ├── Makefile │ │ ├── all_test.go │ │ ├── any_test.go │ │ ├── clone.go │ │ ├── clone_test.go │ │ ├── decode.go │ │ ├── decode_test.go │ │ ├── encode.go │ │ ├── encode_test.go │ │ ├── equal.go │ │ ├── equal_test.go │ │ ├── extensions.go │ │ ├── extensions_test.go │ │ ├── lib.go │ │ ├── map_test.go │ │ ├── message_set.go │ │ ├── message_set_test.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── proto3_proto │ │ ├── proto3.pb.go │ │ └── proto3.proto │ │ ├── proto3_test.go │ │ ├── size2_test.go │ │ ├── size_test.go │ │ ├── testdata │ │ ├── Makefile │ │ ├── golden_test.go │ │ ├── test.pb.go │ │ └── test.proto │ │ ├── text.go │ │ ├── text_parser.go │ │ ├── text_parser_test.go │ │ └── text_test.go ├── howeyc │ └── gopass │ │ ├── LICENSE.txt │ │ ├── OPENSOLARIS.LICENSE │ │ ├── README.md │ │ ├── pass.go │ │ ├── pass_test.go │ │ ├── terminal.go │ │ └── terminal_solaris.go ├── jmoiron │ └── sqlx │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bind.go │ │ ├── doc.go │ │ ├── named.go │ │ ├── named_test.go │ │ ├── reflectx │ │ ├── README.md │ │ ├── reflect.go │ │ └── reflect_test.go │ │ ├── sqlx.go │ │ ├── sqlx_test.go │ │ └── types │ │ ├── README.md │ │ ├── types.go │ │ └── types_test.go ├── lib │ └── pq │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── array.go │ │ ├── array_test.go │ │ ├── bench_test.go │ │ ├── buf.go │ │ ├── certs │ │ ├── README │ │ ├── bogus_root.crt │ │ ├── postgresql.crt │ │ ├── postgresql.key │ │ ├── root.crt │ │ ├── server.crt │ │ └── server.key │ │ ├── conn.go │ │ ├── conn_test.go │ │ ├── copy.go │ │ ├── copy_test.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── encode_test.go │ │ ├── error.go │ │ ├── go18_test.go │ │ ├── hstore │ │ ├── hstore.go │ │ └── hstore_test.go │ │ ├── issues_test.go │ │ ├── listen_example │ │ └── doc.go │ │ ├── notify.go │ │ ├── notify_test.go │ │ ├── oid │ │ ├── doc.go │ │ ├── gen.go │ │ └── types.go │ │ ├── ssl_test.go │ │ ├── url.go │ │ ├── url_test.go │ │ ├── user_posix.go │ │ └── user_windows.go ├── manucorporat │ ├── sse │ │ ├── LICENSE │ │ ├── README.md │ │ ├── sse-decoder.go │ │ ├── sse-decoder_test.go │ │ ├── sse-encoder.go │ │ ├── sse_test.go │ │ └── writer.go │ └── stats │ │ └── stats.go ├── mattn │ ├── go-colorable │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _example │ │ │ └── main.go │ │ ├── _example2 │ │ │ └── main.go │ │ ├── colorable_others.go │ │ ├── colorable_test.go │ │ ├── colorable_windows.go │ │ └── noncolorable.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _example │ │ └── example.go │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── mgutz │ ├── ansi │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ansi.go │ │ ├── ansi_test.go │ │ ├── cmd │ │ │ └── ansi-mgutz │ │ │ │ └── main.go │ │ ├── doc.go │ │ └── print.go │ ├── logxi │ │ └── v1 │ │ │ ├── bench │ │ │ └── bench_test.go │ │ │ ├── callstack.go │ │ │ ├── cmd │ │ │ ├── demo │ │ │ │ ├── main.ansi │ │ │ │ └── main.go │ │ │ ├── filter │ │ │ │ ├── README.md │ │ │ │ └── main.go │ │ │ └── reldir │ │ │ │ ├── README.md │ │ │ │ └── foo.go │ │ │ ├── concurrentWriter.go │ │ │ ├── defaultLogger.go │ │ │ ├── env.go │ │ │ ├── formatter.go │ │ │ ├── happyDevFormatter.go │ │ │ ├── init.go │ │ │ ├── init_test.go │ │ │ ├── jsonFormatter.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── methods.go │ │ │ ├── nullLogger.go │ │ │ ├── pool.go │ │ │ ├── textFormatter.go │ │ │ ├── util.go │ │ │ └── version.go │ ├── minimist │ │ ├── README.md │ │ ├── argMap.go │ │ ├── as.go │ │ ├── cmd │ │ │ └── example │ │ │ │ └── main.go │ │ ├── deprecated.go │ │ ├── may.go │ │ ├── minimist.go │ │ ├── minimist_test.go │ │ └── must.go │ ├── str │ │ ├── CREDITS │ │ ├── Gododir │ │ │ └── main.go │ │ ├── LICENSE │ │ ├── README.md │ │ ├── VERSION │ │ ├── doc.go │ │ ├── funcsAO.go │ │ ├── funcsPZ.go │ │ └── str_test.go │ └── to │ │ ├── LICENSE │ │ ├── README.md │ │ ├── as.go │ │ ├── deprecated.go │ │ ├── must.go │ │ ├── or.go │ │ ├── to.go │ │ └── to_test.go ├── nozzle │ └── throttler │ │ ├── LICENSE │ │ ├── README.md │ │ ├── example_test.go │ │ ├── throttler.go │ │ └── throttler_test.go ├── op │ └── go-logging │ │ ├── CHANGELOG.md │ │ ├── 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_nix.go │ │ ├── log_test.go │ │ ├── log_windows.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── memory.go │ │ ├── memory_test.go │ │ ├── multi.go │ │ ├── multi_test.go │ │ ├── syslog.go │ │ └── syslog_fallback.go ├── pmylund │ └── go-cache │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cache.go │ │ ├── cache_test.go │ │ ├── sharded.go │ │ └── sharded_test.go ├── robfig │ └── cron │ │ ├── LICENSE │ │ ├── README.md │ │ ├── constantdelay.go │ │ ├── constantdelay_test.go │ │ ├── cron.go │ │ ├── cron_test.go │ │ ├── doc.go │ │ ├── parser.go │ │ ├── parser_test.go │ │ ├── spec.go │ │ └── spec_test.go ├── satori │ └── go.uuid │ │ ├── LICENSE │ │ ├── README.md │ │ ├── benchmarks_test.go │ │ ├── uuid.go │ │ └── uuid_test.go ├── voxelbrain │ └── goptions │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTORS.md │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── circle.yml │ │ ├── examples │ │ └── readme_example.go │ │ ├── examples_test.go │ │ ├── flag.go │ │ ├── flagset.go │ │ ├── goptions.go │ │ ├── helpfunc.go │ │ ├── marshaler.go │ │ ├── marshaler_test.go │ │ ├── mutexgroup.go │ │ ├── options.go │ │ ├── parse_test.go │ │ ├── parsetag_test.go │ │ ├── special_types.go │ │ ├── tagparser.go │ │ ├── valueparser.go │ │ └── valueparser_test.go └── woanware │ └── goutil │ ├── README.md │ ├── conv.go │ ├── datetime.go │ ├── file.go │ ├── misc.go │ ├── net.go │ ├── paths.go │ └── strings.go ├── golang.org └── x │ ├── crypto │ └── ssh │ │ └── terminal │ │ ├── terminal.go │ │ ├── terminal_test.go │ │ ├── util.go │ │ ├── util_bsd.go │ │ ├── util_linux.go │ │ ├── util_plan9.go │ │ ├── util_solaris.go │ │ └── util_windows.go │ ├── net │ └── context │ │ ├── context.go │ │ ├── context_test.go │ │ ├── ctxhttp │ │ ├── ctxhttp.go │ │ ├── ctxhttp_17_test.go │ │ ├── ctxhttp_pre17.go │ │ ├── ctxhttp_pre17_test.go │ │ └── ctxhttp_test.go │ │ ├── go17.go │ │ ├── pre_go17.go │ │ └── withtimeout_test.go │ └── text │ ├── encoding │ ├── charmap │ │ ├── charmap.go │ │ ├── charmap_test.go │ │ ├── maketables.go │ │ └── tables.go │ ├── encoding.go │ ├── encoding_test.go │ ├── example_test.go │ ├── htmlindex │ │ ├── gen.go │ │ ├── htmlindex.go │ │ ├── htmlindex_test.go │ │ ├── map.go │ │ └── tables.go │ ├── ianaindex │ │ ├── example_test.go │ │ └── ianaindex.go │ ├── internal │ │ ├── identifier │ │ │ ├── gen.go │ │ │ ├── identifier.go │ │ │ └── mib.go │ │ └── internal.go │ ├── japanese │ │ ├── all.go │ │ ├── all_test.go │ │ ├── eucjp.go │ │ ├── iso2022jp.go │ │ ├── maketables.go │ │ ├── shiftjis.go │ │ └── tables.go │ ├── korean │ │ ├── all_test.go │ │ ├── euckr.go │ │ ├── maketables.go │ │ └── tables.go │ ├── simplifiedchinese │ │ ├── all.go │ │ ├── all_test.go │ │ ├── gbk.go │ │ ├── hzgb2312.go │ │ ├── maketables.go │ │ └── tables.go │ ├── testdata │ │ ├── candide-gb18030.txt │ │ ├── candide-utf-16le.txt │ │ ├── candide-utf-32be.txt │ │ ├── candide-utf-8.txt │ │ ├── candide-windows-1252.txt │ │ ├── rashomon-euc-jp.txt │ │ ├── rashomon-iso-2022-jp.txt │ │ ├── rashomon-shift-jis.txt │ │ ├── rashomon-utf-8.txt │ │ ├── sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt │ │ ├── sunzi-bingfa-gb-levels-1-and-2-utf-8.txt │ │ ├── sunzi-bingfa-simplified-gbk.txt │ │ ├── sunzi-bingfa-simplified-utf-8.txt │ │ ├── sunzi-bingfa-traditional-big5.txt │ │ ├── sunzi-bingfa-traditional-utf-8.txt │ │ ├── unsu-joh-eun-nal-euc-kr.txt │ │ └── unsu-joh-eun-nal-utf-8.txt │ ├── traditionalchinese │ │ ├── all_test.go │ │ ├── big5.go │ │ ├── maketables.go │ │ └── tables.go │ └── unicode │ │ ├── override.go │ │ ├── unicode.go │ │ ├── unicode_test.go │ │ └── utf32 │ │ ├── utf32.go │ │ └── utf32_test.go │ ├── internal │ └── utf8internal │ │ └── utf8internal.go │ ├── runes │ ├── cond.go │ ├── cond_test.go │ ├── example_test.go │ ├── runes.go │ └── runes_test.go │ └── transform │ ├── examples_test.go │ ├── transform.go │ └── transform_test.go └── gopkg.in ├── go-playground └── validator.v8 │ ├── LICENSE │ ├── README.md │ ├── baked_in.go │ ├── benchmarks_test.go │ ├── cache.go │ ├── doc.go │ ├── examples │ ├── custom │ │ └── custom.go │ ├── simple │ │ └── simple.go │ └── struct-level │ │ └── struct_level.go │ ├── examples_test.go │ ├── logo.png │ ├── regexes.go │ ├── util.go │ ├── validator.go │ └── validator_test.go ├── godo.v2 ├── CHANGES-V2.md ├── Gododir │ └── main.go ├── LICENSE ├── Makefile ├── README.md ├── VERSION.go ├── book │ ├── README.md │ ├── SUMMARY.md │ ├── getting_started │ │ ├── README.md │ │ └── locating_maingo.md │ ├── installation │ │ └── README.md │ └── tasks │ │ └── README.md ├── cmd.go ├── cmd │ ├── example │ │ ├── handler.go │ │ └── main.go │ └── godo │ │ └── main.go ├── context.go ├── doc.go ├── env.go ├── env_test.go ├── exec.go ├── exec_test.go ├── fileWrapper.go ├── glob │ ├── fileAsset.go │ ├── glob.go │ ├── glob_test.go │ ├── test │ │ ├── foo.sh │ │ ├── foo.txt │ │ └── sub │ │ │ ├── sub │ │ │ ├── subsub1.txt │ │ │ └── subsub2.html │ │ │ ├── sub1.txt │ │ │ └── sub2.txt │ ├── test2 │ │ ├── main.css │ │ └── main.js │ ├── watchCriteria.go │ └── watchCriteria_test.go ├── handler.go ├── init_test.go ├── namespace_test.go ├── project.go ├── project_test.go ├── runner.go ├── task.go ├── task_options.go ├── test │ ├── bar.txt │ ├── foo.cmd │ ├── foo.sh │ ├── foo.txt │ ├── sub │ │ ├── foo.txt │ │ ├── sub │ │ │ ├── subsub1.txt │ │ │ └── subsub2.html │ │ ├── sub1.txt │ │ └── sub2.txt │ └── templates │ │ └── 1.go.html ├── util │ ├── doc.go │ ├── fs.go │ ├── logging.go │ ├── prompt.go │ └── utils.go ├── waitgroup.go ├── watch_test.go └── watcher │ ├── fileEvent.go │ ├── fswatch │ ├── ISSUES │ ├── LICENSE │ ├── README.md │ ├── clinotify │ │ └── clinotify.go │ ├── doc.go │ ├── fswatch.go │ ├── watch_item.go │ └── watcher.go │ └── watcher.go ├── gomail.v2 ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── auth.go ├── auth_test.go ├── doc.go ├── example_test.go ├── message.go ├── message_test.go ├── mime.go ├── mime_go14.go ├── send.go ├── send_test.go ├── smtp.go ├── smtp_test.go └── writeto.go ├── mgutz └── dat.v1 │ ├── CHANGES.md │ ├── Gododir │ ├── bench.md │ ├── generate.go │ ├── main.go │ └── pg.go │ ├── LICENSE │ ├── README.md │ ├── builder.go │ ├── builders_generated.go │ ├── call.go │ ├── call_test.go │ ├── common │ ├── buffer.go │ └── common.go │ ├── delete.go │ ├── delete_test.go │ ├── dialect.go │ ├── errors.go │ ├── execer.go │ ├── expression.go │ ├── fixtures │ └── data.sql │ ├── glide.lock │ ├── glide.yaml │ ├── init.go │ ├── init_test.go │ ├── insect.go │ ├── insect_test.go │ ├── insert.go │ ├── insert_test.go │ ├── interpolate.go │ ├── interpolate_test.go │ ├── issues_test.go │ ├── kvs │ ├── init.go │ ├── interfaces.go │ ├── memory.go │ └── redis.go │ ├── list_helpers.go │ ├── postgres │ └── postgres.go │ ├── raw.go │ ├── reflectx │ └── reflectx.go │ ├── scope.go │ ├── select.go │ ├── select_doc.go │ ├── select_doc_test.go │ ├── select_test.go │ ├── sqlx-runner │ ├── benchmark.sql │ ├── benchmark_init_test.go │ ├── benchmark_insert_transaction_test.go │ ├── benchmark_varying_length_test.go │ ├── benchmarks_build_sql_exec_test.go │ ├── benchmarks_sql_exec_test.go │ ├── cache_test.go │ ├── connection.go │ ├── connection_test.go │ ├── db.go │ ├── db_test.go │ ├── delete_exec_test.go │ ├── exec.go │ ├── execer.go │ ├── fixtures │ │ └── sprocs.sql │ ├── fixtures_test.go │ ├── init.go │ ├── init_test.go │ ├── insect_test.go │ ├── insert_exec_test.go │ ├── json_test.go │ ├── meta.go │ ├── query_object_test.go │ ├── queryable.go │ ├── select_doc_test.go │ ├── select_exec_test.go │ ├── sproc_test.go │ ├── sqli_test.go │ ├── timeout_test.go │ ├── tx.go │ ├── tx_test.go │ ├── update_exec_test.go │ └── upsert_test.go │ ├── struct_mapping.go │ ├── struct_mapping_test.go │ ├── types.go │ ├── types_test.go │ ├── update.go │ ├── update_test.go │ ├── upsert.go │ ├── upsert_test.go │ ├── util.go │ ├── util_test.go │ └── where.go └── yaml.v2 ├── LICENSE ├── LICENSE.libyaml ├── README.md ├── apic.go ├── decode.go ├── decode_test.go ├── emitterc.go ├── encode.go ├── encode_test.go ├── parserc.go ├── readerc.go ├── resolve.go ├── scannerc.go ├── sorter.go ├── suite_test.go ├── writerc.go ├── yaml.go ├── yamlh.go └── yamlprivateh.go /configuration/arl-setbind.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | chmod +x /opt/arl/arl 3 | sudo setcap cap_net_bind_service+ep /opt/arl/arl 4 | -------------------------------------------------------------------------------- /configuration/arl.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ARL 3 | 4 | [Service] 5 | ExecStart=/opt/arl/arl -c /opt/arl/arl.config 6 | 7 | [Install] 8 | WantedBy=multi-user.target 9 | -------------------------------------------------------------------------------- /database/clear-database.sql: -------------------------------------------------------------------------------- 1 | TRUNCATE TABLE alert; 2 | ALTER SEQUENCE alert_id_seq RESTART WITH 1; 3 | 4 | TRUNCATE TABLE current_autoruns; 5 | ALTER SEQUENCE current_autoruns_id_seq RESTART WITH 1; 6 | 7 | TRUNCATE TABLE instance; 8 | ALTER SEQUENCE instance_id_seq RESTART WITH 1; 9 | 10 | TRUNCATE TABLE previous_autoruns; 11 | ALTER SEQUENCE previous_autoruns_id_seq RESTART WITH 1; -------------------------------------------------------------------------------- /database/grant-privileges.sql: -------------------------------------------------------------------------------- 1 | -- Create a new user called "arl_user" and remove the DBA/Super User privs 2 | -- NOTE: Change the password ('test1') in the quotes below!!! 3 | CREATE USER arl_user with nosuperuser nocreatedb nocreaterole noreplication login inherit encrypted password 'test1'; 4 | 5 | -- Prevent the "public" role connecting to the 'arl' database 6 | REVOKE connect ON database arl FROM public; 7 | -- Allow the "arl_user" to connect to the database 8 | GRANT connect on database arl to arl_user; 9 | 10 | -- Change the table owner to "arl_user" 11 | ALTER TABLE public.alert OWNER TO arl_user; 12 | ALTER TABLE public.current_autoruns OWNER TO arl_user; 13 | ALTER TABLE public.export OWNER TO arl_user; 14 | ALTER TABLE public.instance OWNER TO arl_user; 15 | ALTER TABLE public.previous_autoruns OWNER TO arl_user; 16 | ALTER TABLE public.classification OWNER TO arl_user; 17 | 18 | -- Allow the "arl_user" to perform the various actions on the tables 19 | GRANT ALL ON TABLE public.alert TO arl_user; 20 | GRANT ALL ON TABLE public.current_autoruns TO arl_user; 21 | GRANT ALL ON TABLE public.export TO arl_user; 22 | GRANT ALL ON TABLE public.instance TO arl_user; 23 | GRANT ALL ON TABLE public.previous_autoruns TO arl_user; 24 | GRANT ALL ON TABLE public.classification TO arl_user; 25 | -------------------------------------------------------------------------------- /documents/compilation.md: -------------------------------------------------------------------------------- 1 | # Compiling 2 | 3 | This document assumes that the **golang** tool set has been installed. 4 | 5 | Golang applications always have a **src** directory which contains the applications source code, along with any associated projects that are referenced by the primary application. The following shows where the applications source code resides: 6 | 7 | /autorun-logger-server/source/src/info-assure 8 | 9 | ## gb 10 | 11 | The project uses [gb](https://getgb.io) for building the project. **gb** allows for reproducible builds and vendoring so that all dependencies are kept with the project source. 12 | 13 | To install **gb**, create a temporary directory and set the GOPATH environment variable to the new temporary directory. 14 | ``` 15 | $ export GOPATH=/home/bsmith/tempgb 16 | ``` 17 | Then download the source code for **gb** 18 | ``` 19 | go get github.com/constabulary/gb/... 20 | ``` 21 | Navigate to the **gb** sub-directory: 22 | ``` 23 | cd /home/bsmith/tempgb/src/github.com/constabulary/gb 24 | ``` 25 | Build the project 26 | ``` 27 | go build 28 | ``` 29 | Copy the binaries to the local path 30 | ``` 31 | cp ../../../bin/* /usr/local/bin 32 | ``` 33 | The **gb** command maybe aliased with git, so check with: 34 | ``` 35 | alias gb 36 | ``` 37 | If the alias exists then you can unaliase by: 38 | ``` 39 | unalias gb 40 | ``` 41 | ## Compile with gb 42 | 43 | To compile the application use the following commands (assuming the same directory structure): 44 | ``` 45 | $ cd /autorun-logger-server/source/ 46 | $ gb build all 47 | ``` 48 | -------------------------------------------------------------------------------- /documents/compilation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/documents/compilation.pdf -------------------------------------------------------------------------------- /documents/configuration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/documents/configuration.pdf -------------------------------------------------------------------------------- /documents/information.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/documents/information.pdf -------------------------------------------------------------------------------- /documents/installation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/documents/installation.pdf -------------------------------------------------------------------------------- /readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/readme.pdf -------------------------------------------------------------------------------- /source/src/info-assure/arl-server.config: -------------------------------------------------------------------------------- 1 | database_server: 127.0.0.1 2 | database_name: arl 3 | database_user: postgres 4 | database_password: 5 | processor_threads: 0 6 | http_ip: 0.0.0.0 7 | http_port: 8080 8 | debug: true 9 | archive_dir: "" 10 | temp_dir: "" 11 | export_dir: "" 12 | server_pem: "" 13 | server_key: "" 14 | max_data_age_days: 0 15 | -------------------------------------------------------------------------------- /source/src/info-assure/config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Holds the various objects/structs that are used in the system that don't warrant their own individual file 4 | 5 | // ##### Structs ############################################################# 6 | 7 | // Stores the YAML config file data 8 | type Config struct { 9 | DatabaseServer string `yaml:"database_server"` 10 | DatabaseName string `yaml:"database_name"` 11 | DatabaseUser string `yaml:"database_user"` 12 | DatabasePassword string `yaml:"database_password"` 13 | HttpIp string `yaml:"http_ip"` 14 | HttpPort int16 `yaml:"http_port"` 15 | ProcessorThreads int `yaml:"processor_threads"` 16 | Debug bool `yaml:"debug"` 17 | ArchiveDir string `yaml:"archive_dir"` 18 | TempDir string `yaml:"temp_dir"` 19 | ExportDir string `yaml:"export_dir"` 20 | ServerPem string `yaml:"server_pem"` 21 | ServerKey string `yaml:"server_key"` 22 | MaxDataAgeDays int `yaml:"max_data_age_days"` 23 | AlertDurationHours int `yaml:"alert_duration_hours"` 24 | SmtpServer string `yaml:"smtp_server"` 25 | SmtpUser string `yaml:"smtp_user"` 26 | SmtpPassword string `yaml:"smtp_password"` 27 | SmtpPort int `yaml:"smtp_port"` 28 | SmtpSender string `yaml:"smtp_sender"` 29 | SmtpFrom string `yaml:"smtp_from"` 30 | SmtpReceiver string `yaml:"smtp_receiver"` 31 | SmtpIsEncrypted bool `yaml:"smtp_is_encrypted"` 32 | } 33 | -------------------------------------------------------------------------------- /source/src/info-assure/global.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | const LAYOUT_AUTORUNS = "20060102-150405" 4 | const LAYOUT_DAILY_SUMMARY = "2006-01-02" 5 | 6 | const ( 7 | EXPORT_TYPE_SHA256 = 1 8 | EXPORT_TYPE_MD5 = 2 9 | EXPORT_TYPE_DOMAIN = 3 10 | EXPORT_TYPE_HOST = 4 11 | ) 12 | 13 | const ( 14 | VERIFIED_ALL = 0 15 | VERIFIED_TRUE = 1 16 | VERIFIED_FALSE = 2 17 | VERIFIED_MS = 3 18 | ) 19 | -------------------------------------------------------------------------------- /source/src/info-assure/routes.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "compress/gzip" 6 | "io/ioutil" 7 | "net/http" 8 | "fmt" 9 | ) 10 | 11 | // Provides a HTTP response to a GET request for https://x.x.x.x:XX/ 12 | func index (c *gin.Context) { 13 | c.String(http.StatusOK, fmt.Sprintf("\n%s (%s) %s\n\n", APP_TITLE, APP_NAME, APP_VERSION)) 14 | } 15 | 16 | // Provides a HTTP response to a GET request for https://x.x.x.x:XX/domain/host/user 17 | func receive (c *gin.Context) { 18 | c.String(http.StatusOK, fmt.Sprintf("\n%s (%s) %s\n\n", APP_TITLE, APP_NAME, APP_VERSION)) 19 | } 20 | 21 | // Receives the HTTP POST data from the clients 22 | func receiveData (c *gin.Context) { 23 | 24 | // Get the URL values 25 | host := c.Param("host") 26 | domain := c.Param("domain") 27 | 28 | reader, err := gzip.NewReader(c.Request.Body) 29 | if err != nil { 30 | logger.Errorf("Error creating GZIP reader: %v", err) 31 | c.String(http.StatusInternalServerError, "") 32 | return 33 | } 34 | defer reader.Close() 35 | 36 | // Read all of the HTTP POST body 37 | data, err := ioutil.ReadAll(reader) 38 | if err != nil { 39 | logger.Errorf("Error reading POST body: %v", err) 40 | c.String(http.StatusInternalServerError, "") 41 | return 42 | } 43 | 44 | // Create an ImportTask struct and populate with the HTTP POST data 45 | it := ImportTask{domain, host, string(data)} 46 | go func() { 47 | workQueue <- it 48 | }() 49 | 50 | c.String(http.StatusOK, fmt.Sprintf("\n%s (%s) %s\n\n", APP_TITLE, APP_NAME, APP_VERSION)) 51 | return 52 | } -------------------------------------------------------------------------------- /source/src/info-assure/xml.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | 5 | ) 6 | 7 | type XmlAutorun struct { 8 | Location string `xml:"location"` 9 | ItemName string `xml:"itemname"` 10 | Enabled string `xml:"enabled"` 11 | Profile string `xml:"profile"` 12 | LaunchString string `xml:"launchstring"` 13 | Description string `xml:"description"` 14 | Company string `xml:"company"` 15 | Signer string `xml:"signer"` 16 | Version string `xml:"version"` 17 | ImagePath string `xml:"imagepath"` 18 | Time string `xml:"time"` 19 | Sha256 string `xml:"sha256hash"` 20 | Md5 string `xml:"md5hash"` 21 | } 22 | 23 | // Encapsulates the Autoruns parent (from CrowdResponse) 24 | type XmlAutoruns struct { 25 | Autoruns []XmlAutorun `xml:"item"` 26 | } -------------------------------------------------------------------------------- /source/vendor/src/github.com/MichaelTJones/walk/path_plan9.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 walk 6 | 7 | import "strings" 8 | 9 | // IsAbs returns true if the path is absolute. 10 | func IsAbs(path string) bool { 11 | return strings.HasPrefix(path, "/") || strings.HasPrefix(path, "#") 12 | } 13 | 14 | // volumeNameLen returns length of the leading volume name on Windows. 15 | // It returns 0 elsewhere. 16 | func volumeNameLen(path string) int { 17 | return 0 18 | } 19 | 20 | // HasPrefix exists for historical compatibility and should not be used. 21 | func HasPrefix(p, prefix string) bool { 22 | return strings.HasPrefix(p, prefix) 23 | } 24 | 25 | func splitList(path string) []string { 26 | if path == "" { 27 | return []string{} 28 | } 29 | return strings.Split(path, string(ListSeparator)) 30 | } 31 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/MichaelTJones/walk/path_unix.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 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package walk 8 | 9 | import "strings" 10 | 11 | // IsAbs returns true if the path is absolute. 12 | func IsAbs(path string) bool { 13 | return strings.HasPrefix(path, "/") 14 | } 15 | 16 | // volumeNameLen returns length of the leading volume name on Windows. 17 | // It returns 0 elsewhere. 18 | func volumeNameLen(path string) int { 19 | return 0 20 | } 21 | 22 | // HasPrefix exists for historical compatibility and should not be used. 23 | func HasPrefix(p, prefix string) bool { 24 | return strings.HasPrefix(p, prefix) 25 | } 26 | 27 | func splitList(path string) []string { 28 | if path == "" { 29 | return []string{} 30 | } 31 | return strings.Split(path, string(ListSeparator)) 32 | } 33 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Cenk Altı 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/README.md: -------------------------------------------------------------------------------- 1 | # Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] 2 | 3 | This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. 4 | 5 | [Exponential backoff][exponential backoff wiki] 6 | is an algorithm that uses feedback to multiplicatively decrease the rate of some process, 7 | in order to gradually find an acceptable rate. 8 | The retries exponentially increase and stop increasing when a certain threshold is met. 9 | 10 | ## Usage 11 | 12 | See https://godoc.org/github.com/cenkalti/backoff#pkg-examples 13 | 14 | ## Contributing 15 | 16 | * I would like to keep this library as small as possible. 17 | * Please don't send a PR without opening an issue and discussing it first. 18 | * If proposed change is not a common use case, I will probably not accept it. 19 | 20 | [godoc]: https://godoc.org/github.com/cenkalti/backoff 21 | [godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png 22 | [travis]: https://travis-ci.org/cenkalti/backoff 23 | [travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master 24 | [coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master 25 | [coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master 26 | 27 | [google-http-java-client]: https://github.com/google/google-http-java-client 28 | [exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff 29 | 30 | [advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_ 31 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/backoff_test.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func TestNextBackOffMillis(t *testing.T) { 9 | subtestNextBackOff(t, 0, new(ZeroBackOff)) 10 | subtestNextBackOff(t, Stop, new(StopBackOff)) 11 | } 12 | 13 | func subtestNextBackOff(t *testing.T, expectedValue time.Duration, backOffPolicy BackOff) { 14 | for i := 0; i < 10; i++ { 15 | next := backOffPolicy.NextBackOff() 16 | if next != expectedValue { 17 | t.Errorf("got: %d expected: %d", next, expectedValue) 18 | } 19 | } 20 | } 21 | 22 | func TestConstantBackOff(t *testing.T) { 23 | backoff := NewConstantBackOff(time.Second) 24 | if backoff.NextBackOff() != time.Second { 25 | t.Error("invalid interval") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/example_test.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import "log" 4 | 5 | func ExampleRetry() { 6 | // An operation that may fail. 7 | operation := func() error { 8 | return nil // or an error 9 | } 10 | 11 | err := Retry(operation, NewExponentialBackOff()) 12 | if err != nil { 13 | // Handle error. 14 | return 15 | } 16 | 17 | // Operation is successful. 18 | } 19 | 20 | func ExampleTicker() { 21 | // An operation that may fail. 22 | operation := func() error { 23 | return nil // or an error 24 | } 25 | 26 | ticker := NewTicker(NewExponentialBackOff()) 27 | 28 | var err error 29 | 30 | // Ticks will continue to arrive when the previous operation is still running, 31 | // so operations that take a while to fail could run in quick succession. 32 | for _ = range ticker.C { 33 | if err = operation(); err != nil { 34 | log.Println(err, "will retry...") 35 | continue 36 | } 37 | 38 | ticker.Stop() 39 | break 40 | } 41 | 42 | if err != nil { 43 | // Operation has failed. 44 | return 45 | } 46 | 47 | // Operation is successful. 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/retry.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import "time" 4 | 5 | // An Operation is executing by Retry() or RetryNotify(). 6 | // The operation will be retried using a backoff policy if it returns an error. 7 | type Operation func() error 8 | 9 | // Notify is a notify-on-error function. It receives an operation error and 10 | // backoff delay if the operation failed (with an error). 11 | // 12 | // NOTE that if the backoff policy stated to stop retrying, 13 | // the notify function isn't called. 14 | type Notify func(error, time.Duration) 15 | 16 | // Retry the operation o until it does not return error or BackOff stops. 17 | // o is guaranteed to be run at least once. 18 | // It is the caller's responsibility to reset b after Retry returns. 19 | // 20 | // Retry sleeps the goroutine for the duration returned by BackOff after a 21 | // failed operation returns. 22 | func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) } 23 | 24 | // RetryNotify calls notify function with the error and wait duration 25 | // for each failed attempt before sleep. 26 | func RetryNotify(operation Operation, b BackOff, notify Notify) error { 27 | var err error 28 | var next time.Duration 29 | 30 | b.Reset() 31 | for { 32 | if err = operation(); err == nil { 33 | return nil 34 | } 35 | 36 | if next = b.NextBackOff(); next == Stop { 37 | return err 38 | } 39 | 40 | if notify != nil { 41 | notify(err, next) 42 | } 43 | 44 | time.Sleep(next) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/retry_test.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import ( 4 | "errors" 5 | "log" 6 | "testing" 7 | ) 8 | 9 | func TestRetry(t *testing.T) { 10 | const successOn = 3 11 | var i = 0 12 | 13 | // This function is successful on "successOn" calls. 14 | f := func() error { 15 | i++ 16 | log.Printf("function is called %d. time\n", i) 17 | 18 | if i == successOn { 19 | log.Println("OK") 20 | return nil 21 | } 22 | 23 | log.Println("error") 24 | return errors.New("error") 25 | } 26 | 27 | err := Retry(f, NewExponentialBackOff()) 28 | if err != nil { 29 | t.Errorf("unexpected error: %s", err.Error()) 30 | } 31 | if i != successOn { 32 | t.Errorf("invalid number of retries: %d", i) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/cenkalti/backoff/ticker_test.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import ( 4 | "errors" 5 | "log" 6 | "testing" 7 | ) 8 | 9 | func TestTicker(t *testing.T) { 10 | const successOn = 3 11 | var i = 0 12 | 13 | // This function is successful on "successOn" calls. 14 | f := func() error { 15 | i++ 16 | log.Printf("function is called %d. time\n", i) 17 | 18 | if i == successOn { 19 | log.Println("OK") 20 | return nil 21 | } 22 | 23 | log.Println("error") 24 | return errors.New("error") 25 | } 26 | 27 | b := NewExponentialBackOff() 28 | ticker := NewTicker(b) 29 | 30 | var err error 31 | for _ = range ticker.C { 32 | if err = f(); err != nil { 33 | t.Log(err) 34 | continue 35 | } 36 | 37 | break 38 | } 39 | if err != nil { 40 | t.Errorf("unexpected error: %s", err.Error()) 41 | } 42 | if i != successOn { 43 | t.Errorf("invalid number of retries: %d", i) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/dustin/go-broadcast/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dustin Sallings 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/dustin/go-broadcast/README.markdown: -------------------------------------------------------------------------------- 1 | pubsubbing channels. 2 | 3 | This project primarily exists because I've been copying and pasting 4 | the exact same two files into numerous projects. It does work well, 5 | though. 6 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/dustin/go-broadcast/mux_observer_test.go: -------------------------------------------------------------------------------- 1 | package broadcast 2 | 3 | import ( 4 | "sync" 5 | "testing" 6 | ) 7 | 8 | func TestMuxBroadcast(t *testing.T) { 9 | wg := sync.WaitGroup{} 10 | 11 | mo := NewMuxObserver(0, 0) 12 | defer mo.Close() 13 | 14 | b1 := mo.Sub() 15 | defer b1.Close() 16 | 17 | b2 := mo.Sub() 18 | defer b2.Close() 19 | 20 | for i := 0; i < 5; i++ { 21 | wg.Add(2) 22 | 23 | cch1 := make(chan interface{}) 24 | b1.Register(cch1) 25 | cch2 := make(chan interface{}) 26 | b2.Register(cch2) 27 | 28 | go func() { 29 | defer wg.Done() 30 | defer b1.Unregister(cch1) 31 | <-cch1 32 | }() 33 | go func() { 34 | defer wg.Done() 35 | defer b2.Unregister(cch2) 36 | <-cch2 37 | }() 38 | 39 | } 40 | 41 | go b1.Submit(1) 42 | go b2.Submit(1) 43 | 44 | wg.Wait() 45 | } 46 | 47 | func TestMuxBroadcastCleanup(t *testing.T) { 48 | mo := NewMuxObserver(0, 0) 49 | b := mo.Sub() 50 | b.Register(make(chan interface{})) 51 | b.Close() 52 | mo.Close() 53 | } 54 | 55 | func BenchmarkMuxBrodcast(b *testing.B) { 56 | chout := make(chan interface{}) 57 | 58 | mo := NewMuxObserver(0, 0) 59 | defer mo.Close() 60 | bc := mo.Sub() 61 | bc.Register(chout) 62 | 63 | for i := 0; i < b.N; i++ { 64 | bc.Submit(nil) 65 | <-chout 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/garyburd/redigo/internal/commandinfo_test.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import "testing" 4 | 5 | func TestLookupCommandInfo(t *testing.T) { 6 | for _, n := range []string{"watch", "WATCH", "wAtch"} { 7 | if LookupCommandInfo(n) == (CommandInfo{}) { 8 | t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n) 9 | } 10 | } 11 | } 12 | 13 | func benchmarkLookupCommandInfo(b *testing.B, names ...string) { 14 | for i := 0; i < b.N; i++ { 15 | for _, c := range names { 16 | LookupCommandInfo(c) 17 | } 18 | } 19 | } 20 | 21 | func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) { 22 | benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR") 23 | } 24 | 25 | func BenchmarkLookupCommandInfoMixedCase(b *testing.B) { 26 | benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR") 27 | } 28 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/garyburd/redigo/redis/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package redis 4 | 5 | import "crypto/tls" 6 | 7 | // similar cloneTLSClientConfig in the stdlib, but also honor skipVerify for the nil case 8 | func cloneTLSClientConfig(cfg *tls.Config, skipVerify bool) *tls.Config { 9 | if cfg == nil { 10 | return &tls.Config{InsecureSkipVerify: skipVerify} 11 | } 12 | return &tls.Config{ 13 | Rand: cfg.Rand, 14 | Time: cfg.Time, 15 | Certificates: cfg.Certificates, 16 | NameToCertificate: cfg.NameToCertificate, 17 | GetCertificate: cfg.GetCertificate, 18 | RootCAs: cfg.RootCAs, 19 | NextProtos: cfg.NextProtos, 20 | ServerName: cfg.ServerName, 21 | ClientAuth: cfg.ClientAuth, 22 | ClientCAs: cfg.ClientCAs, 23 | InsecureSkipVerify: cfg.InsecureSkipVerify, 24 | CipherSuites: cfg.CipherSuites, 25 | PreferServerCipherSuites: cfg.PreferServerCipherSuites, 26 | ClientSessionCache: cfg.ClientSessionCache, 27 | MinVersion: cfg.MinVersion, 28 | MaxVersion: cfg.MaxVersion, 29 | CurvePreferences: cfg.CurvePreferences, 30 | DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled, 31 | Renegotiation: cfg.Renegotiation, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/garyburd/redigo/redis/pre_go17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package redis 4 | 5 | import "crypto/tls" 6 | 7 | // similar cloneTLSClientConfig in the stdlib, but also honor skipVerify for the nil case 8 | func cloneTLSClientConfig(cfg *tls.Config, skipVerify bool) *tls.Config { 9 | if cfg == nil { 10 | return &tls.Config{InsecureSkipVerify: skipVerify} 11 | } 12 | return &tls.Config{ 13 | Rand: cfg.Rand, 14 | Time: cfg.Time, 15 | Certificates: cfg.Certificates, 16 | NameToCertificate: cfg.NameToCertificate, 17 | GetCertificate: cfg.GetCertificate, 18 | RootCAs: cfg.RootCAs, 19 | NextProtos: cfg.NextProtos, 20 | ServerName: cfg.ServerName, 21 | ClientAuth: cfg.ClientAuth, 22 | ClientCAs: cfg.ClientCAs, 23 | InsecureSkipVerify: cfg.InsecureSkipVerify, 24 | CipherSuites: cfg.CipherSuites, 25 | PreferServerCipherSuites: cfg.PreferServerCipherSuites, 26 | ClientSessionCache: cfg.ClientSessionCache, 27 | MinVersion: cfg.MinVersion, 28 | MaxVersion: cfg.MaxVersion, 29 | CurvePreferences: cfg.CurvePreferences, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "github.com/gin-gonic/gin", 3 | "GoVersion": "go1.5.1", 4 | "Deps": [ 5 | { 6 | "ImportPath": "github.com/davecgh/go-spew/spew", 7 | "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" 8 | }, 9 | { 10 | "ImportPath": "github.com/golang/protobuf/proto", 11 | "Rev": "2402d76f3d41f928c7902a765dfc872356dd3aad" 12 | }, 13 | { 14 | "ImportPath": "github.com/manucorporat/sse", 15 | "Rev": "ee05b128a739a0fb76c7ebd3ae4810c1de808d6d" 16 | }, 17 | { 18 | "ImportPath": "github.com/pmezard/go-difflib/difflib", 19 | "Rev": "792786c7400a136282c1664665ae0a8db921c6c2" 20 | }, 21 | { 22 | "ImportPath": "github.com/stretchr/testify/assert", 23 | "Comment": "v1.1.3", 24 | "Rev": "f390dcf405f7b83c997eac1b06768bb9f44dec18" 25 | }, 26 | { 27 | "ImportPath": "golang.org/x/net/context", 28 | "Rev": "f315505cf3349909cdf013ea56690da34e96a451" 29 | }, 30 | { 31 | "ImportPath": "gopkg.in/go-playground/validator.v8", 32 | "Comment": "v8.15.1", 33 | "Rev": "c193cecd124b5cc722d7ee5538e945bdb3348435" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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/go-playground/validator.v8" 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 | config := &validator.Config{TagName: "binding"} 30 | v.validate = validator.New(config) 31 | }) 32 | } 33 | 34 | func kindOfData(data interface{}) reflect.Kind { 35 | value := reflect.ValueOf(data) 36 | valueType := value.Kind() 37 | if valueType == reflect.Ptr { 38 | valueType = value.Elem().Kind() 39 | } 40 | return valueType 41 | } 42 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/binding/example/test.proto: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | enum FOO {X=17;}; 4 | 5 | message Test { 6 | required string label = 1; 7 | optional int32 type = 2[default=77]; 8 | repeated int64 reps = 3; 9 | optional group OptionalGroup = 4{ 10 | required string RequiredField = 5; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/binding/form.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 "net/http" 8 | 9 | type formBinding struct{} 10 | type formPostBinding struct{} 11 | type formMultipartBinding struct{} 12 | 13 | func (formBinding) Name() string { 14 | return "form" 15 | } 16 | 17 | func (formBinding) Bind(req *http.Request, obj interface{}) error { 18 | if err := req.ParseForm(); err != nil { 19 | return err 20 | } 21 | req.ParseMultipartForm(32 << 10) // 32 MB 22 | if err := mapForm(obj, req.Form); err != nil { 23 | return err 24 | } 25 | return validate(obj) 26 | } 27 | 28 | func (formPostBinding) Name() string { 29 | return "form-urlencoded" 30 | } 31 | 32 | func (formPostBinding) Bind(req *http.Request, obj interface{}) error { 33 | if err := req.ParseForm(); err != nil { 34 | return err 35 | } 36 | if err := mapForm(obj, req.PostForm); err != nil { 37 | return err 38 | } 39 | return validate(obj) 40 | } 41 | 42 | func (formMultipartBinding) Name() string { 43 | return "multipart/form-data" 44 | } 45 | 46 | func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error { 47 | if err := req.ParseMultipartForm(32 << 10); err != nil { 48 | return err 49 | } 50 | if err := mapForm(obj, req.MultipartForm.Value); err != nil { 51 | return err 52 | } 53 | return validate(obj) 54 | } 55 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/binding/protobuf.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 | "github.com/golang/protobuf/proto" 9 | 10 | "io/ioutil" 11 | "net/http" 12 | ) 13 | 14 | type protobufBinding struct{} 15 | 16 | func (protobufBinding) Name() string { 17 | return "protobuf" 18 | } 19 | 20 | func (protobufBinding) Bind(req *http.Request, obj interface{}) error { 21 | 22 | buf, err := ioutil.ReadAll(req.Body) 23 | if err != nil { 24 | return err 25 | } 26 | 27 | if err = proto.Unmarshal(buf, obj.(proto.Message)); err != nil { 28 | return err 29 | } 30 | 31 | //Here it's same to return validate(obj), but util now we cann't add `binding:""` to the struct 32 | //which automatically generate by gen-proto 33 | return nil 34 | //return validate(obj) 35 | } 36 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | 7 | import "log" 8 | 9 | func (c *Context) GetCookie(name string) (string, error) { 10 | log.Println("GetCookie() method is deprecated. Use Cookie() instead.") 11 | return c.Cookie(name) 12 | } 13 | -------------------------------------------------------------------------------- /source/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/` -------------------------------------------------------------------------------- /source/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 -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/examples/app-engine/hello.go: -------------------------------------------------------------------------------- 1 | package hello 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "net/http" 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 | } 24 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/examples/realtime-advanced/stats.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "runtime" 5 | "sync" 6 | "time" 7 | 8 | "github.com/manucorporat/stats" 9 | ) 10 | 11 | var ips = stats.New() 12 | var messages = stats.New() 13 | var users = stats.New() 14 | var mutexStats sync.RWMutex 15 | var savedStats map[string]uint64 16 | 17 | func statsWorker() { 18 | c := time.Tick(1 * time.Second) 19 | var lastMallocs uint64 20 | var lastFrees uint64 21 | for range c { 22 | var stats runtime.MemStats 23 | runtime.ReadMemStats(&stats) 24 | 25 | mutexStats.Lock() 26 | savedStats = map[string]uint64{ 27 | "timestamp": uint64(time.Now().Unix()), 28 | "HeapInuse": stats.HeapInuse, 29 | "StackInuse": stats.StackInuse, 30 | "Mallocs": (stats.Mallocs - lastMallocs), 31 | "Frees": (stats.Frees - lastFrees), 32 | "Inbound": uint64(messages.Get("inbound")), 33 | "Outbound": uint64(messages.Get("outbound")), 34 | "Connected": connectedUsers(), 35 | } 36 | lastMallocs = stats.Mallocs 37 | lastFrees = stats.Frees 38 | messages.Reset() 39 | mutexStats.Unlock() 40 | } 41 | } 42 | 43 | func connectedUsers() uint64 { 44 | connected := users.Get("connected") - users.Get("disconnected") 45 | if connected < 0 { 46 | return 0 47 | } 48 | return uint64(connected) 49 | } 50 | 51 | func Stats() map[string]uint64 { 52 | mutexStats.RLock() 53 | defer mutexStats.RUnlock() 54 | 55 | return savedStats 56 | } 57 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/ginS/README.md: -------------------------------------------------------------------------------- 1 | #Gin Default Server 2 | 3 | This is API experiment for Gin. 4 | 5 | ```go 6 | package main 7 | 8 | import ( 9 | "github.com/gin-gonic/gin" 10 | "github.com/gin-gonic/gin/ginS" 11 | ) 12 | 13 | func main() { 14 | ginS.GET("/", func(c *gin.Context) { c.String(200, "Hello World") }) 15 | ginS.Run() 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/helpers_test.go: -------------------------------------------------------------------------------- 1 | package gin 2 | 3 | import ( 4 | "net/http/httptest" 5 | ) 6 | 7 | func CreateTestContext() (c *Context, w *httptest.ResponseRecorder, r *Engine) { 8 | w = httptest.NewRecorder() 9 | r = New() 10 | c = r.allocateContext() 11 | c.reset() 12 | c.writermem.reset(w) 13 | return 14 | } 15 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/github.com/gin-gonic/gin/logo.jpg -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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(), "GET /recovery") 27 | assert.Contains(t, buffer.String(), "Oupps, Houston, we have a problem") 28 | assert.Contains(t, buffer.String(), "TestPanicInHandler") 29 | } 30 | 31 | // TestPanicWithAbort assert that panic has been recovered even if context.Abort was used. 32 | func TestPanicWithAbort(t *testing.T) { 33 | router := New() 34 | router.Use(RecoveryWithWriter(nil)) 35 | router.GET("/recovery", func(c *Context) { 36 | c.AbortWithStatus(400) 37 | panic("Oupps, Houston, we have a problem") 38 | }) 39 | // RUN 40 | w := performRequest(router, "GET", "/recovery") 41 | // TEST 42 | assert.Equal(t, w.Code, 400) 43 | } 44 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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) && r.Code != 201 { 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 | -------------------------------------------------------------------------------- /source/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 | _ Render = YAML{} 24 | ) 25 | 26 | func writeContentType(w http.ResponseWriter, value []string) { 27 | header := w.Header() 28 | if val := header["Content-Type"]; len(val) == 0 { 29 | header["Content-Type"] = value 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/render/yaml.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 | "net/http" 9 | 10 | "gopkg.in/yaml.v2" 11 | ) 12 | 13 | type YAML struct { 14 | Data interface{} 15 | } 16 | 17 | var yamlContentType = []string{"application/x-yaml; charset=utf-8"} 18 | 19 | func (r YAML) Render(w http.ResponseWriter) error { 20 | writeContentType(w, yamlContentType) 21 | 22 | bytes, err := yaml.Marshal(r.Data) 23 | if err != nil { 24 | return err 25 | } 26 | 27 | w.Write(bytes) 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/gin-gonic/gin/wercker.yml: -------------------------------------------------------------------------------- 1 | box: wercker/default -------------------------------------------------------------------------------- /source/vendor/src/github.com/golang/protobuf/proto/map_test.go: -------------------------------------------------------------------------------- 1 | package proto_test 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/golang/protobuf/proto" 8 | ppb "github.com/golang/protobuf/proto/proto3_proto" 9 | ) 10 | 11 | func marshalled() []byte { 12 | m := &ppb.IntMaps{} 13 | for i := 0; i < 1000; i++ { 14 | m.Maps = append(m.Maps, &ppb.IntMap{ 15 | Rtt: map[int32]int32{1: 2}, 16 | }) 17 | } 18 | b, err := proto.Marshal(m) 19 | if err != nil { 20 | panic(fmt.Sprintf("Can't marshal %+v: %v", m, err)) 21 | } 22 | return b 23 | } 24 | 25 | func BenchmarkConcurrentMapUnmarshal(b *testing.B) { 26 | in := marshalled() 27 | b.RunParallel(func(pb *testing.PB) { 28 | for pb.Next() { 29 | var out ppb.IntMaps 30 | if err := proto.Unmarshal(in, &out); err != nil { 31 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) 32 | } 33 | } 34 | }) 35 | } 36 | 37 | func BenchmarkSequentialMapUnmarshal(b *testing.B) { 38 | in := marshalled() 39 | b.ResetTimer() 40 | for i := 0; i < b.N; i++ { 41 | var out ppb.IntMaps 42 | if err := proto.Unmarshal(in, &out); err != nil { 43 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/howeyc/gopass/LICENSE.txt: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012 Chris Howey 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/howeyc/gopass/README.md: -------------------------------------------------------------------------------- 1 | # getpasswd in Go [![GoDoc](https://godoc.org/github.com/howeyc/gopass?status.svg)](https://godoc.org/github.com/howeyc/gopass) [![Build Status](https://secure.travis-ci.org/howeyc/gopass.png?branch=master)](http://travis-ci.org/howeyc/gopass) 2 | 3 | Retrieve password from user terminal or piped input without echo. 4 | 5 | Verified on BSD, Linux, and Windows. 6 | 7 | Example: 8 | ```go 9 | package main 10 | 11 | import "fmt" 12 | import "github.com/howeyc/gopass" 13 | 14 | func main() { 15 | fmt.Printf("Password: ") 16 | 17 | // Silent. For printing *'s use gopass.GetPasswdMasked() 18 | pass, err := gopass.GetPasswd() 19 | if err != nil { 20 | // Handle gopass.ErrInterrupted or getch() read error 21 | } 22 | 23 | // Do something with pass 24 | } 25 | ``` 26 | 27 | Caution: Multi-byte characters not supported! 28 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/howeyc/gopass/terminal.go: -------------------------------------------------------------------------------- 1 | // +build !solaris 2 | 3 | package gopass 4 | 5 | import "golang.org/x/crypto/ssh/terminal" 6 | 7 | type terminalState struct { 8 | state *terminal.State 9 | } 10 | 11 | func isTerminal(fd uintptr) bool { 12 | return terminal.IsTerminal(int(fd)) 13 | } 14 | 15 | func makeRaw(fd uintptr) (*terminalState, error) { 16 | state, err := terminal.MakeRaw(int(fd)) 17 | 18 | return &terminalState{ 19 | state: state, 20 | }, err 21 | } 22 | 23 | func restore(fd uintptr, oldState *terminalState) error { 24 | return terminal.Restore(int(fd), oldState.state) 25 | } 26 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/jmoiron/sqlx/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Jason Moiron 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/jmoiron/sqlx/doc.go: -------------------------------------------------------------------------------- 1 | // Package sqlx provides general purpose extensions to database/sql. 2 | // 3 | // It is intended to seamlessly wrap database/sql and provide convenience 4 | // methods which are useful in the development of database driven applications. 5 | // None of the underlying database/sql methods are changed. Instead all extended 6 | // behavior is implemented through new methods defined on wrapper types. 7 | // 8 | // Additions include scanning into structs, named query support, rebinding 9 | // queries for different drivers, convenient shorthands for common error handling 10 | // and more. 11 | // 12 | package sqlx 13 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/jmoiron/sqlx/reflectx/README.md: -------------------------------------------------------------------------------- 1 | # reflectx 2 | 3 | The sqlx package has special reflect needs. In particular, it needs to: 4 | 5 | * be able to map a name to a field 6 | * understand embedded structs 7 | * understand mapping names to fields by a particular tag 8 | * user specified name -> field mapping functions 9 | 10 | These behaviors mimic the behaviors by the standard library marshallers and also the 11 | behavior of standard Go accessors. 12 | 13 | The first two are amply taken care of by `Reflect.Value.FieldByName`, and the third is 14 | addressed by `Reflect.Value.FieldByNameFunc`, but these don't quite understand struct 15 | tags in the ways that are vital to most marshallers, and they are slow. 16 | 17 | This reflectx package extends reflect to achieve these goals. 18 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/jmoiron/sqlx/types/README.md: -------------------------------------------------------------------------------- 1 | # types 2 | 3 | The types package provides some useful types which implement the `sql.Scanner` 4 | and `driver.Valuer` interfaces, suitable for use as scan and value targets with 5 | database/sql. 6 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to pq 2 | 3 | `pq` has a backlog of pull requests, but contributions are still very 4 | much welcome. You can help with patch review, submitting bug reports, 5 | or adding new functionality. There is no formal style guide, but 6 | please conform to the style of existing code and general Go formatting 7 | conventions when submitting patches. 8 | 9 | ### Patch review 10 | 11 | Help review existing open pull requests by commenting on the code or 12 | proposed functionality. 13 | 14 | ### Bug reports 15 | 16 | We appreciate any bug reports, but especially ones with self-contained 17 | (doesn't depend on code outside of pq), minimal (can't be simplified 18 | further) test cases. It's especially helpful if you can submit a pull 19 | request with just the failing test case (you'll probably want to 20 | pattern it after the tests in 21 | [conn_test.go](https://github.com/lib/pq/blob/master/conn_test.go). 22 | 23 | ### New functionality 24 | 25 | There are a number of pending patches for new functionality, so 26 | additional feature patches will take a while to merge. Still, patches 27 | are generally reviewed based on usefulness and complexity in addition 28 | to time-in-queue, so if you have a knockout idea, take a shot. Feel 29 | free to open an issue discussion your proposed patch beforehand. 30 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2013, 'pq' Contributors 2 | Portions Copyright (C) 2011 Blake Mizerany 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/certs/README: -------------------------------------------------------------------------------- 1 | This directory contains certificates and private keys for testing some 2 | SSL-related functionality in Travis. Do NOT use these certificates for 3 | anything other than testing. 4 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/certs/bogus_root.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBjCCAe6gAwIBAgIQSnDYp/Naet9HOZljF5PuwDANBgkqhkiG9w0BAQsFADAr 3 | MRIwEAYDVQQKEwlDb2Nrcm9hY2gxFTATBgNVBAMTDENvY2tyb2FjaCBDQTAeFw0x 4 | NjAyMDcxNjQ0MzdaFw0xNzAyMDYxNjQ0MzdaMCsxEjAQBgNVBAoTCUNvY2tyb2Fj 5 | aDEVMBMGA1UEAxMMQ29ja3JvYWNoIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A 6 | MIIBCgKCAQEAxdln3/UdgP7ayA/G1kT7upjLe4ERwQjYQ25q0e1+vgsB5jhiirxJ 7 | e0+WkhhYu/mwoSAXzvlsbZ2PWFyfdanZeD/Lh6SvIeWXVVaPcWVWL1TEcoN2jr5+ 8 | E85MMHmbbmaT2he8s6br2tM/UZxyTQ2XRprIzApbDssyw1c0Yufcpu3C6267FLEl 9 | IfcWrzDhnluFhthhtGXv3ToD8IuMScMC5qlKBXtKmD1B5x14ngO/ecNJ+OlEi0HU 10 | mavK4KWgI2rDXRZ2EnCpyTZdkc3kkRnzKcg653oOjMDRZdrhfIrha+Jq38ACsUmZ 11 | Su7Sp5jkIHOCO8Zg+l6GKVSq37dKMapD8wIDAQABoyYwJDAOBgNVHQ8BAf8EBAMC 12 | AuQwEgYDVR0TAQH/BAgwBgEB/wIBATANBgkqhkiG9w0BAQsFAAOCAQEAwZ2Tu0Yu 13 | rrSVdMdoPEjT1IZd+5OhM/SLzL0ddtvTithRweLHsw2lDQYlXFqr24i3UGZJQ1sp 14 | cqSrNwswgLUQT3vWyTjmM51HEb2vMYWKmjZ+sBQYAUP1CadrN/+OTfNGnlF1+B4w 15 | IXOzh7EvQmJJnNybLe4a/aRvj1NE2n8Z898B76SVU9WbfKKz8VwLzuIPDqkKcZda 16 | lMy5yzthyztV9YjcWs2zVOUGZvGdAhDrvZuUq6mSmxrBEvR2LBOggmVf3tGRT+Ls 17 | lW7c9Lrva5zLHuqmoPP07A+vuI9a0D1X44jwGDuPWJ5RnTOQ63Uez12mKNjqleHw 18 | DnkwNanuO8dhAA== 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/certs/postgresql.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICWwIBAAKBgQDjjAaacFRR0TQ0gznNolkPBe2N2A400JL0CU3ujHhVSST4POA0 3 | WAKy55RYwejlu9Gv9lTBQLGQcHkNNVScjxbpwvCS5mRJOMF2+EdmxFtKtqlDzsi+ 4 | bE0rlJc8VbzR0G63U66JXEtrhkC+wa4eZM6crocKaeXIIRK+rh32Rd8WpwIDAQAB 5 | AoGAM5dM6/kp9P700i8qjOgRPym96Zoh5nGfz/rIE5z/r36NBkdvIg8OVZfR96nH 6 | b0b9TOMR5lsPp0sI9yivTWvX6qyvLJRWy2vvx17hXK9NxXUNTAm0PYZUTvCtcPeX 7 | RnJpzQKNZQPkFzF0uXBc4CtPK2Vz0+FGvAelrhYAxnw1dIkCQQD+9qaW5QhXjsjb 8 | Nl85CmXgxPmGROcgLQCO+omfrjf9UXrituU9Dz6auym5lDGEdMFnkzfr+wpasEy9 9 | mf5ZZOhDAkEA5HjXfVGaCtpydOt6hDon/uZsyssCK2lQ7NSuE3vP+sUsYMzIpEoy 10 | t3VWXqKbo+g9KNDTP4WEliqp1aiSIylzzQJANPeqzihQnlgEdD4MdD4rwhFJwVIp 11 | Le8Lcais1KaN7StzOwxB/XhgSibd2TbnPpw+3bSg5n5lvUdo+e62/31OHwJAU1jS 12 | I+F09KikQIr28u3UUWT2IzTT4cpVv1AHAQyV3sG3YsjSGT0IK20eyP9BEBZU2WL0 13 | 7aNjrvR5aHxKc5FXsQJABsFtyGpgI5X4xufkJZVZ+Mklz2n7iXa+XPatMAHFxAtb 14 | EEMt60rngwMjXAzBSC6OYuYogRRAY3UCacNC5VhLYQ== 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/certs/root.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEAzCCAuugAwIBAgIJANmheROCdW1NMA0GCSqGSIb3DQEBBQUAMF4xCzAJBgNV 3 | BAYTAlVTMQ8wDQYDVQQIEwZOZXZhZGExEjAQBgNVBAcTCUxhcyBWZWdhczEaMBgG 4 | A1UEChMRZ2l0aHViLmNvbS9saWIvcHExDjAMBgNVBAMTBXBxIENBMB4XDTE0MTAx 5 | MTE1MDQyOVoXDTI0MTAwODE1MDQyOVowXjELMAkGA1UEBhMCVVMxDzANBgNVBAgT 6 | Bk5ldmFkYTESMBAGA1UEBxMJTGFzIFZlZ2FzMRowGAYDVQQKExFnaXRodWIuY29t 7 | L2xpYi9wcTEOMAwGA1UEAxMFcHEgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw 8 | ggEKAoIBAQCV4PxP7ShzWBzUCThcKk3qZtOLtHmszQVtbqhvgTpm1kTRtKBdVMu0 9 | pLAHQ3JgJCnAYgH0iZxVGoMP16T3irdgsdC48+nNTFM2T0cCdkfDURGIhSFN47cb 10 | Pgy306BcDUD2q7ucW33+dlFSRuGVewocoh4BWM/vMtMvvWzdi4Ag/L/jhb+5wZxZ 11 | sWymsadOVSDePEMKOvlCa3EdVwVFV40TVyDb+iWBUivDAYsS2a3KajuJrO6MbZiE 12 | Sp2RCIkZS2zFmzWxVRi9ZhzIZhh7EVF9JAaNC3T52jhGUdlRq3YpBTMnd89iOh74 13 | 6jWXG7wSuPj3haFzyNhmJ0ZUh+2Ynoh1AgMBAAGjgcMwgcAwHQYDVR0OBBYEFFKT 14 | 7R52Cp9lT94ZZsHVIkA1y6ByMIGQBgNVHSMEgYgwgYWAFFKT7R52Cp9lT94ZZsHV 15 | IkA1y6ByoWKkYDBeMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGTmV2YWRhMRIwEAYD 16 | VQQHEwlMYXMgVmVnYXMxGjAYBgNVBAoTEWdpdGh1Yi5jb20vbGliL3BxMQ4wDAYD 17 | VQQDEwVwcSBDQYIJANmheROCdW1NMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF 18 | BQADggEBAAEhCLWkqJNMI8b4gkbmj5fqQ/4+oO83bZ3w2Oqf6eZ8I8BC4f2NOyE6 19 | tRUlq5+aU7eqC1cOAvGjO+YHN/bF/DFpwLlzvUSXt+JP/pYcUjL7v+pIvwqec9hD 20 | ndvM4iIbkD/H/OYQ3L+N3W+G1x7AcFIX+bGCb3PzYVQAjxreV6//wgKBosMGFbZo 21 | HPxT9RPMun61SViF04H5TNs0derVn1+5eiiYENeAhJzQNyZoOOUuX1X/Inx9bEPh 22 | C5vFBtSMgIytPgieRJVWAiMLYsfpIAStrHztRAbBs2DU01LmMgRvHdxgFEKinC/d 23 | UHZZQDP+6pT+zADrGhQGXe4eThaO6f0= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/go18_test.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package pq 4 | 5 | import "testing" 6 | 7 | func TestMultipleSimpleQuery(t *testing.T) { 8 | db := openTestConn(t) 9 | defer db.Close() 10 | 11 | rows, err := db.Query("select 1; set time zone default; select 2; select 3") 12 | if err != nil { 13 | t.Fatal(err) 14 | } 15 | defer rows.Close() 16 | 17 | var i int 18 | for rows.Next() { 19 | if err := rows.Scan(&i); err != nil { 20 | t.Fatal(err) 21 | } 22 | if i != 1 { 23 | t.Fatalf("expected 1, got %d", i) 24 | } 25 | } 26 | if !rows.NextResultSet() { 27 | t.Fatal("expected more result sets", rows.Err()) 28 | } 29 | for rows.Next() { 30 | if err := rows.Scan(&i); err != nil { 31 | t.Fatal(err) 32 | } 33 | if i != 2 { 34 | t.Fatalf("expected 2, got %d", i) 35 | } 36 | } 37 | 38 | // Make sure that if we ignore a result we can still query. 39 | 40 | rows, err = db.Query("select 4; select 5") 41 | if err != nil { 42 | t.Fatal(err) 43 | } 44 | defer rows.Close() 45 | 46 | for rows.Next() { 47 | if err := rows.Scan(&i); err != nil { 48 | t.Fatal(err) 49 | } 50 | if i != 4 { 51 | t.Fatalf("expected 4, got %d", i) 52 | } 53 | } 54 | if !rows.NextResultSet() { 55 | t.Fatal("expected more result sets", rows.Err()) 56 | } 57 | for rows.Next() { 58 | if err := rows.Scan(&i); err != nil { 59 | t.Fatal(err) 60 | } 61 | if i != 5 { 62 | t.Fatalf("expected 5, got %d", i) 63 | } 64 | } 65 | if rows.NextResultSet() { 66 | t.Fatal("unexpected result set") 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/issues_test.go: -------------------------------------------------------------------------------- 1 | package pq 2 | 3 | import "testing" 4 | 5 | func TestIssue494(t *testing.T) { 6 | db := openTestConn(t) 7 | defer db.Close() 8 | 9 | query := `CREATE TEMP TABLE t (i INT PRIMARY KEY)` 10 | if _, err := db.Exec(query); err != nil { 11 | t.Fatal(err) 12 | } 13 | 14 | txn, err := db.Begin() 15 | if err != nil { 16 | t.Fatal(err) 17 | } 18 | 19 | if _, err := txn.Prepare(CopyIn("t", "i")); err != nil { 20 | t.Fatal(err) 21 | } 22 | 23 | if _, err := txn.Query("SELECT 1"); err == nil { 24 | t.Fatal("expected error") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/oid/doc.go: -------------------------------------------------------------------------------- 1 | // Package oid contains OID constants 2 | // as defined by the Postgres server. 3 | package oid 4 | 5 | // Oid is a Postgres Object ID. 6 | type Oid uint32 7 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/oid/gen.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | // Generate the table of OID values 4 | // Run with 'go run gen.go'. 5 | package main 6 | 7 | import ( 8 | "database/sql" 9 | "fmt" 10 | "log" 11 | "os" 12 | "os/exec" 13 | 14 | _ "github.com/lib/pq" 15 | ) 16 | 17 | func main() { 18 | datname := os.Getenv("PGDATABASE") 19 | sslmode := os.Getenv("PGSSLMODE") 20 | 21 | if datname == "" { 22 | os.Setenv("PGDATABASE", "pqgotest") 23 | } 24 | 25 | if sslmode == "" { 26 | os.Setenv("PGSSLMODE", "disable") 27 | } 28 | 29 | db, err := sql.Open("postgres", "") 30 | if err != nil { 31 | log.Fatal(err) 32 | } 33 | cmd := exec.Command("gofmt") 34 | cmd.Stderr = os.Stderr 35 | w, err := cmd.StdinPipe() 36 | if err != nil { 37 | log.Fatal(err) 38 | } 39 | f, err := os.Create("types.go") 40 | if err != nil { 41 | log.Fatal(err) 42 | } 43 | cmd.Stdout = f 44 | err = cmd.Start() 45 | if err != nil { 46 | log.Fatal(err) 47 | } 48 | fmt.Fprintln(w, "// generated by 'go run gen.go'; do not edit") 49 | fmt.Fprintln(w, "\npackage oid") 50 | fmt.Fprintln(w, "const (") 51 | rows, err := db.Query(` 52 | SELECT typname, oid 53 | FROM pg_type WHERE oid < 10000 54 | ORDER BY oid; 55 | `) 56 | if err != nil { 57 | log.Fatal(err) 58 | } 59 | var name string 60 | var oid int 61 | for rows.Next() { 62 | err = rows.Scan(&name, &oid) 63 | if err != nil { 64 | log.Fatal(err) 65 | } 66 | fmt.Fprintf(w, "T_%s Oid = %d\n", name, oid) 67 | } 68 | if err = rows.Err(); err != nil { 69 | log.Fatal(err) 70 | } 71 | fmt.Fprintln(w, ")") 72 | w.Close() 73 | cmd.Wait() 74 | } 75 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/user_posix.go: -------------------------------------------------------------------------------- 1 | // Package pq is a pure Go Postgres driver for the database/sql package. 2 | 3 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris rumprun 4 | 5 | package pq 6 | 7 | import ( 8 | "os" 9 | "os/user" 10 | ) 11 | 12 | func userCurrent() (string, error) { 13 | u, err := user.Current() 14 | if err == nil { 15 | return u.Username, nil 16 | } 17 | 18 | name := os.Getenv("USER") 19 | if name != "" { 20 | return name, nil 21 | } 22 | 23 | return "", ErrCouldNotDetectUsername 24 | } 25 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/lib/pq/user_windows.go: -------------------------------------------------------------------------------- 1 | // Package pq is a pure Go Postgres driver for the database/sql package. 2 | package pq 3 | 4 | import ( 5 | "path/filepath" 6 | "syscall" 7 | ) 8 | 9 | // Perform Windows user name lookup identically to libpq. 10 | // 11 | // The PostgreSQL code makes use of the legacy Win32 function 12 | // GetUserName, and that function has not been imported into stock Go. 13 | // GetUserNameEx is available though, the difference being that a 14 | // wider range of names are available. To get the output to be the 15 | // same as GetUserName, only the base (or last) component of the 16 | // result is returned. 17 | func userCurrent() (string, error) { 18 | pw_name := make([]uint16, 128) 19 | pwname_size := uint32(len(pw_name)) - 1 20 | err := syscall.GetUserNameEx(syscall.NameSamCompatible, &pw_name[0], &pwname_size) 21 | if err != nil { 22 | return "", ErrCouldNotDetectUsername 23 | } 24 | s := syscall.UTF16ToString(pw_name) 25 | u := filepath.Base(s) 26 | return u, nil 27 | } 28 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-colorable/_example2/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | 7 | "github.com/mattn/go-colorable" 8 | ) 9 | 10 | func main() { 11 | stdOut := bufio.NewWriter(colorable.NewColorableStdout()) 12 | 13 | fmt.Fprint(stdOut, "\x1B[3GMove to 3rd Column\n") 14 | fmt.Fprint(stdOut, "\x1B[1;2HMove to 2nd Column on 1st Line\n") 15 | stdOut.Flush() 16 | } 17 | -------------------------------------------------------------------------------- /source/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 | // NewColorable return new instance of Writer which handle escape sequence. 11 | func NewColorable(file *os.File) io.Writer { 12 | if file == nil { 13 | panic("nil passed instead of *os.File to NewColorable()") 14 | } 15 | 16 | return file 17 | } 18 | 19 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 20 | func NewColorableStdout() io.Writer { 21 | return os.Stdout 22 | } 23 | 24 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 25 | func NewColorableStderr() io.Writer { 26 | return os.Stderr 27 | } 28 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-colorable/colorable_test.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | ) 7 | 8 | // checkEncoding checks that colorable is output encoding agnostic as long as 9 | // the encoding is a superset of ASCII. This implies that one byte not part of 10 | // an ANSI sequence must give exactly one byte in output 11 | func checkEncoding(t *testing.T, data []byte) { 12 | // Send non-UTF8 data to colorable 13 | b := bytes.NewBuffer(make([]byte, 0, 10)) 14 | if b.Len() != 0 { 15 | t.FailNow() 16 | } 17 | // TODO move colorable wrapping outside the test 18 | c := NewNonColorable(b) 19 | c.Write(data) 20 | if b.Len() != len(data) { 21 | t.Fatalf("%d bytes expected, got %d", len(data), b.Len()) 22 | } 23 | } 24 | 25 | func TestEncoding(t *testing.T) { 26 | checkEncoding(t, []byte{}) // Empty 27 | checkEncoding(t, []byte(`abc`)) // "abc" 28 | checkEncoding(t, []byte(`é`)) // "é" in UTF-8 29 | checkEncoding(t, []byte{233}) // 'é' in Latin-1 30 | } 31 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | // NonColorable hold writer but remove escape sequence. 9 | type NonColorable struct { 10 | out io.Writer 11 | lastbuf bytes.Buffer 12 | } 13 | 14 | // NewNonColorable return new instance of Writer which remove escape sequence from Writer. 15 | func NewNonColorable(w io.Writer) io.Writer { 16 | return &NonColorable{out: w} 17 | } 18 | 19 | // Write write data on console 20 | func (w *NonColorable) Write(data []byte) (n int, err error) { 21 | er := bytes.NewReader(data) 22 | var bw [1]byte 23 | loop: 24 | for { 25 | c1, err := er.ReadByte() 26 | if err != nil { 27 | break loop 28 | } 29 | if c1 != 0x1b { 30 | bw[0] = c1 31 | w.out.Write(bw[:]) 32 | continue 33 | } 34 | c2, err := er.ReadByte() 35 | if err != nil { 36 | w.lastbuf.WriteByte(c1) 37 | break loop 38 | } 39 | if c2 != 0x5b { 40 | w.lastbuf.WriteByte(c1) 41 | w.lastbuf.WriteByte(c2) 42 | continue 43 | } 44 | 45 | var buf bytes.Buffer 46 | for { 47 | c, err := er.ReadByte() 48 | if err != nil { 49 | w.lastbuf.WriteByte(c1) 50 | w.lastbuf.WriteByte(c2) 51 | w.lastbuf.Write(buf.Bytes()) 52 | break loop 53 | } 54 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 55 | break 56 | } 57 | buf.Write([]byte(string(c))) 58 | } 59 | } 60 | return len(data) - w.lastbuf.Len(), nil 61 | } 62 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | isatty for golang 4 | 5 | ## Usage 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "fmt" 12 | "github.com/mattn/go-isatty" 13 | "os" 14 | ) 15 | 16 | func main() { 17 | if isatty.IsTerminal(os.Stdout.Fd()) { 18 | fmt.Println("Is Terminal") 19 | } else { 20 | fmt.Println("Is Not Terminal") 21 | } 22 | } 23 | ``` 24 | 25 | ## Installation 26 | 27 | ``` 28 | $ go get github.com/mattn/go-isatty 29 | ``` 30 | 31 | # License 32 | 33 | MIT 34 | 35 | # Author 36 | 37 | Yasuhiro Matsumoto (a.k.a mattn) 38 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/_example/example.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mattn/go-isatty" 6 | "os" 7 | ) 8 | 9 | func main() { 10 | if isatty.IsTerminal(os.Stdout.Fd()) { 11 | fmt.Println("Is Terminal") 12 | } else { 13 | fmt.Println("Is Not Terminal") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mattn/go-isatty/isatty_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 12 | var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 13 | 14 | // IsTerminal return true if the file descriptor is terminal. 15 | func IsTerminal(fd uintptr) bool { 16 | var st uint32 17 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 18 | return r != 0 && e == 0 19 | } 20 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/ansi/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2013 Mario L. Gutierrez 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/ansi/ansi_test.go: -------------------------------------------------------------------------------- 1 | package ansi 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func TestPlain(t *testing.T) { 9 | DisableColors(true) 10 | bgColors := []string{ 11 | "", 12 | ":black", 13 | ":red", 14 | ":green", 15 | ":yellow", 16 | ":blue", 17 | ":magenta", 18 | ":cyan", 19 | ":white", 20 | } 21 | for fg := range Colors { 22 | for _, bg := range bgColors { 23 | println(padColor(fg, []string{"" + bg, "+b" + bg, "+bh" + bg, "+u" + bg})) 24 | println(padColor(fg, []string{"+uh" + bg, "+B" + bg, "+Bb" + bg /* backgrounds */, "" + bg + "+h"})) 25 | println(padColor(fg, []string{"+b" + bg + "+h", "+bh" + bg + "+h", "+u" + bg + "+h", "+uh" + bg + "+h"})) 26 | } 27 | } 28 | } 29 | 30 | func TestStyles(t *testing.T) { 31 | PrintStyles() 32 | DisableColors(false) 33 | buf := colorCode("off") 34 | if buf.String() != "" { 35 | t.Fail() 36 | } 37 | } 38 | 39 | func ExampleColorFunc() { 40 | brightGreen := ColorFunc("green+h") 41 | fmt.Println(brightGreen("lime")) 42 | } 43 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/ansi/print.go: -------------------------------------------------------------------------------- 1 | package ansi 2 | 3 | // PrintStyles prints all style combinations to the terminal. 4 | func PrintStyles() { 5 | oldPlain := plain 6 | plain = false 7 | 8 | bgColors := []string{ 9 | "", 10 | ":black", 11 | ":red", 12 | ":green", 13 | ":yellow", 14 | ":blue", 15 | ":magenta", 16 | ":cyan", 17 | ":white", 18 | } 19 | for fg := range Colors { 20 | for _, bg := range bgColors { 21 | println(padColor(fg, []string{"" + bg, "+b" + bg, "+bh" + bg, "+u" + bg})) 22 | println(padColor(fg, []string{"+uh" + bg, "+B" + bg, "+Bb" + bg /* backgrounds */, "" + bg + "+h"})) 23 | println(padColor(fg, []string{"+b" + bg + "+h", "+bh" + bg + "+h", "+u" + bg + "+h", "+uh" + bg + "+h"})) 24 | } 25 | } 26 | plain = oldPlain 27 | } 28 | 29 | func pad(s string, length int) string { 30 | for len(s) < length { 31 | s += " " 32 | } 33 | return s 34 | } 35 | 36 | func padColor(s string, styles []string) string { 37 | buffer := "" 38 | for _, style := range styles { 39 | buffer += Color(pad(s+style, 20), s+style) 40 | } 41 | return buffer 42 | } 43 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/cmd/demo/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/mgutz/logxi/v1" 8 | ) 9 | 10 | var errConfig = fmt.Errorf("file not found") 11 | var dsn = "dbname=testdb" 12 | var logger log.Logger 13 | var hostname string 14 | var configFile = "config.json" 15 | 16 | func init() { 17 | hostname, _ = os.Hostname() 18 | } 19 | 20 | func loadConfig() { 21 | logger.Error("Could not read config file", "err", errConfig) 22 | } 23 | 24 | func main() { 25 | // create loggers 26 | log.Trace("creating loggers") 27 | logger = log.New("server") 28 | modelsLogger := log.New("models") 29 | 30 | logger.Debug("Process", "hostname", hostname, "pid", os.Getpid()) 31 | modelsLogger.Info("Connecting to database...") 32 | modelsLogger.Warn("Could not connect, retrying ...", "dsn", dsn) 33 | loadConfig() 34 | } 35 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/cmd/filter/README.md: -------------------------------------------------------------------------------- 1 | # filter 2 | 3 | Filter is an example of a how to process JSON log 4 | entries using pipes in your shell. 5 | 6 | ```sh 7 | yourapp | filter 8 | ``` 9 | 10 | You can try see it in action with `godo filter` 11 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/cmd/filter/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "encoding/json" 6 | "fmt" 7 | "io" 8 | "os" 9 | 10 | "github.com/mgutz/logxi/v1" 11 | ) 12 | 13 | func sendExternal(obj map[string]interface{}) { 14 | // normally you would send this to an external service like InfluxDB 15 | // or some logging framework. Let's filter out some data. 16 | fmt.Printf("Time: %s Level: %s Message: %s\n", 17 | obj[log.KeyMap.Time], 18 | obj[log.KeyMap.Level], 19 | obj[log.KeyMap.Message], 20 | ) 21 | } 22 | 23 | func main() { 24 | r := bufio.NewReader(os.Stdin) 25 | dec := json.NewDecoder(r) 26 | for { 27 | var obj map[string]interface{} 28 | if err := dec.Decode(&obj); err == io.EOF { 29 | break 30 | } else if err != nil { 31 | log.InternalLog.Fatal("Could not decode", "err", err) 32 | } 33 | sendExternal(obj) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/cmd/reldir/README.md: -------------------------------------------------------------------------------- 1 | # reldir 2 | 3 | Used to test relative paths when logging context. 4 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/cmd/reldir/foo.go: -------------------------------------------------------------------------------- 1 | package reldir 2 | 3 | import "github.com/mgutz/logxi/v1" 4 | 5 | // Foo returns error 6 | func Foo() { 7 | log.Error("Oh bar!") 8 | } 9 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/concurrentWriter.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // ConcurrentWriter is a concurrent safe wrapper around io.Writer 9 | type ConcurrentWriter struct { 10 | writer io.Writer 11 | sync.Mutex 12 | } 13 | 14 | // NewConcurrentWriter crates a new concurrent writer wrapper around existing writer. 15 | func NewConcurrentWriter(writer io.Writer) io.Writer { 16 | return &ConcurrentWriter{writer: writer} 17 | } 18 | 19 | func (cw *ConcurrentWriter) Write(p []byte) (n int, err error) { 20 | cw.Lock() 21 | defer cw.Unlock() 22 | // This is basically the same logic as in go's log.Output() which 23 | // doesn't look at the returned number of bytes returned 24 | return cw.writer.Write(p) 25 | } 26 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/init_test.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | var testBuf bytes.Buffer 12 | 13 | var testInternalLog Logger 14 | 15 | func init() { 16 | testInternalLog = NewLogger3(&testBuf, "__logxi", NewTextFormatter("__logxi")) 17 | testInternalLog.SetLevel(LevelError) 18 | } 19 | 20 | func TestUnknownLevel(t *testing.T) { 21 | testResetEnv() 22 | os.Setenv("LOGXI", "*=oy") 23 | processEnv() 24 | buffer := testBuf.String() 25 | assert.Contains(t, buffer, "Unknown level", "should error on unknown level") 26 | } 27 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/methods.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | // Trace logs a trace statement. On terminals file and line number are logged. 4 | func Trace(msg string, args ...interface{}) { 5 | DefaultLog.Trace(msg, args...) 6 | } 7 | 8 | // Debug logs a debug statement. 9 | func Debug(msg string, args ...interface{}) { 10 | DefaultLog.Debug(msg, args...) 11 | } 12 | 13 | // Info logs an info statement. 14 | func Info(msg string, args ...interface{}) { 15 | DefaultLog.Info(msg, args...) 16 | } 17 | 18 | // Warn logs a warning statement. On terminals it logs file and line number. 19 | func Warn(msg string, args ...interface{}) { 20 | DefaultLog.Warn(msg, args...) 21 | } 22 | 23 | // Error logs an error statement with callstack. 24 | func Error(msg string, args ...interface{}) { 25 | DefaultLog.Error(msg, args...) 26 | } 27 | 28 | // Fatal logs a fatal statement. 29 | func Fatal(msg string, args ...interface{}) { 30 | DefaultLog.Fatal(msg, args...) 31 | } 32 | 33 | // IsTrace determines if this logger logs a trace statement. 34 | func IsTrace() bool { 35 | return DefaultLog.IsTrace() 36 | } 37 | 38 | // IsDebug determines if this logger logs a debug statement. 39 | func IsDebug() bool { 40 | return DefaultLog.IsDebug() 41 | } 42 | 43 | // IsInfo determines if this logger logs an info statement. 44 | func IsInfo() bool { 45 | return DefaultLog.IsInfo() 46 | } 47 | 48 | // IsWarn determines if this logger logs a warning statement. 49 | func IsWarn() bool { 50 | return DefaultLog.IsWarn() 51 | } 52 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/pool.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bytes" 5 | "sync" 6 | ) 7 | 8 | type BufferPool struct { 9 | sync.Pool 10 | } 11 | 12 | func NewBufferPool() *BufferPool { 13 | return &BufferPool{ 14 | Pool: sync.Pool{New: func() interface{} { 15 | b := bytes.NewBuffer(make([]byte, 128)) 16 | b.Reset() 17 | return b 18 | }}, 19 | } 20 | } 21 | 22 | func (bp *BufferPool) Get() *bytes.Buffer { 23 | return bp.Pool.Get().(*bytes.Buffer) 24 | } 25 | 26 | func (bp *BufferPool) Put(b *bytes.Buffer) { 27 | b.Reset() 28 | bp.Pool.Put(b) 29 | } 30 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/util.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "path/filepath" 5 | "strings" 6 | ) 7 | 8 | func expandTabs(s string, tabLen int) string { 9 | if s == "" { 10 | return s 11 | } 12 | parts := strings.Split(s, "\t") 13 | buf := pool.Get() 14 | defer pool.Put(buf) 15 | for _, part := range parts { 16 | buf.WriteString(part) 17 | buf.WriteString(strings.Repeat(" ", tabLen-len(part)%tabLen)) 18 | } 19 | return buf.String() 20 | } 21 | 22 | func maxInt(a, b int) int { 23 | if a > b { 24 | return a 25 | } 26 | return b 27 | } 28 | func minInt(a, b int) int { 29 | if a < b { 30 | return a 31 | } 32 | return b 33 | } 34 | 35 | func indexOfNonSpace(s string) int { 36 | if s == "" { 37 | return -1 38 | } 39 | for i, r := range s { 40 | if r != ' ' { 41 | return i 42 | } 43 | } 44 | return -1 45 | } 46 | 47 | var inLogxiPath = filepath.Join("mgutz", "logxi", "v"+strings.Split(Version, ".")[0]) 48 | 49 | func isLogxiCode(filename string) bool { 50 | // need to see errors in tests 51 | return strings.HasSuffix(filepath.Dir(filename), inLogxiPath) && 52 | !strings.HasSuffix(filename, "_test.go") 53 | } 54 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/logxi/v1/version.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | // Version is the version of this package 4 | const Version = "1.0.0-pre" 5 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/minimist/README.md: -------------------------------------------------------------------------------- 1 | # minimist 2 | 3 | Simple CLI args parser. 4 | 5 | Port of [minimist](https://github.com/substack/minimist) to golang 6 | 7 | ## options 8 | 9 | `--a // a == true` 10 | `--a=foo // a == "foo"` 11 | `--a foo // a == "foo"` 12 | 13 | `--no-a // a == false` 14 | `-a // a == true` 15 | `-ab // a == true, b == true` 16 | `-ab foo // a == true, b == "foo"` 17 | 18 | # license 19 | 20 | MIT 21 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/minimist/argMap.go: -------------------------------------------------------------------------------- 1 | package minimist 2 | 3 | // ArgMap is the result of parsing command-line arguments. 4 | type ArgMap map[string]interface{} 5 | 6 | // NonFlags are the rest of the args which were not parsed as flags before "--" 7 | func (am ArgMap) NonFlags() []string { 8 | return am["_"].([]string) 9 | } 10 | 11 | // Unparsed are args that came after "--" 12 | func (am ArgMap) Unparsed() []string { 13 | return am["--"].([]string) 14 | } 15 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/minimist/cmd/example/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/mgutz/minimist" 8 | ) 9 | 10 | var usage = ` 11 | example - an example os minimist 12 | 13 | Usage: 14 | -h, --help This screen 15 | --verbose Log verbosely 16 | -v, --version Print version 17 | -w, --watch Watch tasks 18 | ` 19 | 20 | func main() { 21 | argm := minimist.Parse() 22 | fmt.Printf("%q\n", os.Args) 23 | 24 | // cmd --help || cmd --h || cmd -? 25 | if argm.MayBool(false, "help", "h", "?") { 26 | fmt.Println(usage) 27 | } 28 | 29 | // cmd -v || cmd --version 30 | if argm.AsBool("v", "version") { 31 | fmt.Println("1.0") 32 | } 33 | 34 | // cmd foo -- ... 35 | // argm.SubCommand("foo", func(a *ArgMap) { 36 | // }) 37 | 38 | // argm.SubExec("talk", "echo") 39 | } 40 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/minimist/deprecated.go: -------------------------------------------------------------------------------- 1 | package minimist 2 | 3 | import "github.com/mgutz/to" 4 | 5 | // Leftover is an alias for Other and is deprecated. USE Others() instead. 6 | func (am ArgMap) Leftover() []string { 7 | return am["_"].([]string) 8 | } 9 | 10 | //// USE As* functions instead. eg AsBool, AsInt 11 | 12 | // ZeroBool tries to convert any of related aliases to bool 13 | func (am ArgMap) ZeroBool(aliases ...string) bool { 14 | for _, key := range aliases { 15 | b, err := to.Bool(am[key]) 16 | if err == nil { 17 | return b 18 | } 19 | } 20 | return false 21 | } 22 | 23 | // ZeroString should get value from path or return val. 24 | func (am ArgMap) ZeroString(aliases ...string) string { 25 | if len(aliases) == 0 { 26 | panic("Alias key(s) required") 27 | } 28 | for _, key := range aliases { 29 | s := to.String(am[key]) 30 | if len(s) > 0 { 31 | return s 32 | } 33 | } 34 | return "" 35 | } 36 | 37 | // ZeroInt should get value from path or return val. 38 | func (am ArgMap) ZeroInt(aliases ...string) int { 39 | for _, key := range aliases { 40 | i, err := to.Int64(am[key]) 41 | if err == nil { 42 | return int(i) 43 | } 44 | } 45 | return 0 46 | } 47 | 48 | // ZeroFloat should get value from path or return val. 49 | func (am ArgMap) ZeroFloat(aliases ...string) float64 { 50 | for _, key := range aliases { 51 | f, err := to.Float64(am[key]) 52 | if err == nil { 53 | return f 54 | } 55 | } 56 | return 0 57 | } 58 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/minimist/may.go: -------------------------------------------------------------------------------- 1 | package minimist 2 | 3 | import "github.com/mgutz/to" 4 | 5 | // MayBool tries to convert any of related aliases to bool 6 | func (am ArgMap) MayBool(defaultValue bool, aliases ...string) bool { 7 | for _, key := range aliases { 8 | b, err := to.Bool(am[key]) 9 | if err == nil { 10 | return b 11 | } 12 | } 13 | return defaultValue 14 | } 15 | 16 | // MayString should get value from path or return val. 17 | func (am ArgMap) MayString(defaultValue string, aliases ...string) string { 18 | if len(aliases) == 0 { 19 | panic("Alias key(s) required") 20 | } 21 | for _, key := range aliases { 22 | s := to.String(am[key]) 23 | if len(s) > 0 { 24 | return s 25 | } 26 | } 27 | return defaultValue 28 | } 29 | 30 | // MayInt should get value from path or return val. 31 | func (am ArgMap) MayInt(defaultValue int, aliases ...string) int { 32 | for _, key := range aliases { 33 | i, err := to.Int64(am[key]) 34 | if err == nil { 35 | return int(i) 36 | } 37 | } 38 | return defaultValue 39 | } 40 | 41 | // MayFloat should get value from path or return val. 42 | func (am ArgMap) MayFloat(defaultValue float64, aliases ...string) float64 { 43 | for _, key := range aliases { 44 | f, err := to.Float64(am[key]) 45 | if err == nil { 46 | return f 47 | } 48 | } 49 | return defaultValue 50 | } 51 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/str/CREDITS: -------------------------------------------------------------------------------- 1 | * [string.js](http://stringjs.com) - I contributed several 2 | functions to this project. 3 | 4 | * [bbgen.net](http://bbgen.net/blog/2011/06/string-to-argc-argv/) 5 | 6 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/str/Gododir/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mgutz/goa" 5 | f "github.com/mgutz/goa/filter" 6 | "github.com/mgutz/str" 7 | 8 | do "gopkg.in/godo.v2" 9 | "gopkg.in/godo.v2/util" 10 | ) 11 | 12 | // Project is local project. 13 | func tasks(p *do.Project) { 14 | p.Task("default", do.S{"readme"}, nil) 15 | 16 | p.Task("install", nil, func(c *do.Context) { 17 | c.Run("go get github.com/robertkrimen/godocdown/godocdown") 18 | }) 19 | 20 | p.Task("lint", nil, func(c *do.Context) { 21 | c.Run("golint .") 22 | c.Run("gofmt -w -s .") 23 | c.Run("go vet .") 24 | c.Run("go test") 25 | }) 26 | 27 | p.Task("readme", nil, func(c *do.Context) { 28 | c.Run("godocdown -output README.md") 29 | 30 | packageName, _ := util.PackageName("doc.go") 31 | 32 | // add godoc link 33 | goa.Pipe( 34 | f.Load("./README.md"), 35 | f.Str(str.ReplaceF("--", "\n[godoc](https://godoc.org/"+packageName+")\n", 1)), 36 | f.Write(), 37 | ) 38 | }).Src("**/*.go") 39 | 40 | p.Task("test", nil, func(c *do.Context) { 41 | c.Run("go test") 42 | }) 43 | } 44 | 45 | func main() { 46 | do.Godo(tasks) 47 | } 48 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/str/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Mario L. Gutierrez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/str/VERSION: -------------------------------------------------------------------------------- 1 | 1.1.0 2 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/str/doc.go: -------------------------------------------------------------------------------- 1 | // Package str is a comprehensive set of string functions to build more 2 | // Go awesomeness. Str complements Go's standard packages and does not duplicate 3 | // functionality found in `strings` or `strconv`. 4 | // 5 | // Str is based on plain functions instead of object-based methods, 6 | // consistent with Go standard string packages. 7 | // 8 | // str.Between("foo", "", "") == "foo" 9 | // 10 | // Str supports pipelining instead of chaining 11 | // 12 | // s := str.Pipe("\nabcdef\n", Clean, BetweenF("a", "f"), ChompLeftF("bc")) 13 | // 14 | // User-defined filters can be added to the pipeline by inserting a function 15 | // or closure that returns a function with this signature 16 | // 17 | // func(string) string 18 | // 19 | package str 20 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/mgutz/to/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 José Carlos Nieto, http://xiam.menteslibres.org/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/op/go-logging/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.0.0-rc1 (2016-02-11) 4 | 5 | Time flies and it has been three years since this package was first released. 6 | There have been a couple of API changes I have wanted to do for some time but 7 | I've tried to maintain backwards compatibility. Some inconsistencies in the 8 | API have started to show, proper vendor support in Go out of the box and 9 | the fact that `go vet` will give warnings -- I have decided to bump the major 10 | version. 11 | 12 | * Make eg. `Info` and `Infof` do different things. You want to change all calls 13 | to `Info` with a string format go to `Infof` etc. In many cases, `go vet` will 14 | guide you. 15 | * `Id` in `Record` is now called `ID` 16 | 17 | ## 1.0.0 (2013-02-21) 18 | 19 | Initial release 20 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/op/go-logging/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Örjan Persson. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /source/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 | // SetBackend 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 | -------------------------------------------------------------------------------- /source/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.Debugf("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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/op/go-logging/examples/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/github.com/op/go-logging/examples/example.png -------------------------------------------------------------------------------- /source/vendor/src/github.com/op/go-logging/multi_test.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 | import "testing" 8 | 9 | func TestMultiLogger(t *testing.T) { 10 | log1 := NewMemoryBackend(8) 11 | log2 := NewMemoryBackend(8) 12 | SetBackend(MultiLogger(log1, log2)) 13 | 14 | log := MustGetLogger("test") 15 | log.Debug("log") 16 | 17 | if "log" != MemoryRecordN(log1, 0).Formatted(0) { 18 | t.Errorf("log1: %v", MemoryRecordN(log1, 0).Formatted(0)) 19 | } 20 | if "log" != MemoryRecordN(log2, 0).Formatted(0) { 21 | t.Errorf("log2: %v", MemoryRecordN(log2, 0).Formatted(0)) 22 | } 23 | } 24 | 25 | func TestMultiLoggerLevel(t *testing.T) { 26 | log1 := NewMemoryBackend(8) 27 | log2 := NewMemoryBackend(8) 28 | 29 | leveled1 := AddModuleLevel(log1) 30 | leveled2 := AddModuleLevel(log2) 31 | 32 | multi := MultiLogger(leveled1, leveled2) 33 | multi.SetLevel(ERROR, "test") 34 | SetBackend(multi) 35 | 36 | log := MustGetLogger("test") 37 | log.Notice("log") 38 | 39 | if nil != MemoryRecordN(log1, 0) || nil != MemoryRecordN(log2, 0) { 40 | t.Errorf("unexpected log record") 41 | } 42 | 43 | leveled1.SetLevel(DEBUG, "test") 44 | log.Notice("log") 45 | if "log" != MemoryRecordN(log1, 0).Formatted(0) { 46 | t.Errorf("log1 not received") 47 | } 48 | if nil != MemoryRecordN(log2, 0) { 49 | t.Errorf("log2 received") 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/pmylund/go-cache/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | This is a list of people who have contributed code to go-cache. They, or their 2 | employers, are the copyright holders of the contributed code. Contributed code 3 | is subject to the license restrictions listed in LICENSE (as they were when the 4 | code was contributed.) 5 | 6 | Dustin Sallings 7 | Jason Mooberry 8 | Sergey Shepelev 9 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/pmylund/go-cache/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2016 Patrick Mylund Nielsen and the go-cache contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/robfig/cron/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Rob Figueiredo 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/robfig/cron/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](http://godoc.org/github.com/robfig/cron?status.png)](http://godoc.org/github.com/robfig/cron) 2 | [![Build Status](https://travis-ci.org/robfig/cron.svg?branch=master)](https://travis-ci.org/robfig/cron) 3 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/robfig/cron/constantdelay.go: -------------------------------------------------------------------------------- 1 | package cron 2 | 3 | import "time" 4 | 5 | // ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes". 6 | // It does not support jobs more frequent than once a second. 7 | type ConstantDelaySchedule struct { 8 | Delay time.Duration 9 | } 10 | 11 | // Every returns a crontab Schedule that activates once every duration. 12 | // Delays of less than a second are not supported (will round up to 1 second). 13 | // Any fields less than a Second are truncated. 14 | func Every(duration time.Duration) ConstantDelaySchedule { 15 | if duration < time.Second { 16 | duration = time.Second 17 | } 18 | return ConstantDelaySchedule{ 19 | Delay: duration - time.Duration(duration.Nanoseconds())%time.Second, 20 | } 21 | } 22 | 23 | // Next returns the next time this should be run. 24 | // This rounds so that the next activation time will be on the second. 25 | func (schedule ConstantDelaySchedule) Next(t time.Time) time.Time { 26 | return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond) 27 | } 28 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2016 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Contributors 2 | ============ 3 | 4 | These people have contributed to goptions's design and implementation: 5 | 6 | * Andreas Krennmair 7 | * GDG Berlin Golang 8 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013, voxelbrain UG, Germany 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the voxelbrain UG nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL voxelbrain UG BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/circle.yml: -------------------------------------------------------------------------------- 1 | test: 2 | override: 3 | - go list -f "{{range .TestImports}}{{.}} {{end}}" . | xargs -r go get 4 | - go test 5 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/examples/readme_example.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/voxelbrain/goptions" 5 | "os" 6 | "time" 7 | ) 8 | 9 | func main() { 10 | options := struct { 11 | Server string `goptions:"-s, --server, obligatory, description='Server to connect to'"` 12 | Password string `goptions:"-p, --password, description='Don\\'t prompt for password'"` 13 | Timeout time.Duration `goptions:"-t, --timeout, description='Connection timeout in seconds'"` 14 | Help goptions.Help `goptions:"-h, --help, description='Show this help'"` 15 | 16 | goptions.Verbs 17 | Execute struct { 18 | Command string `goptions:"--command, mutexgroup='input', description='Command to exectute', obligatory"` 19 | Script *os.File `goptions:"--script, mutexgroup='input', description='Script to exectute', rdonly"` 20 | } `goptions:"execute"` 21 | Delete struct { 22 | Path string `goptions:"-n, --name, obligatory, description='Name of the entity to be deleted'"` 23 | Force bool `goptions:"-f, --force, description='Force removal'"` 24 | } `goptions:"delete"` 25 | }{ // Default values goes here 26 | Timeout: 10 * time.Second, 27 | } 28 | goptions.ParseAndFail(&options) 29 | } 30 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/marshaler.go: -------------------------------------------------------------------------------- 1 | package goptions 2 | 3 | type Marshaler interface { 4 | MarshalGoption(s string) error 5 | } 6 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/mutexgroup.go: -------------------------------------------------------------------------------- 1 | package goptions 2 | 3 | // A MutexGroup holds a set of flags which are mutually exclusive and cannot 4 | // be specified at the same time. 5 | type MutexGroup []*Flag 6 | 7 | // IsObligatory returns true if exactly one of the flags in the MutexGroup has 8 | // to be specified 9 | func (mg MutexGroup) IsObligatory() bool { 10 | for _, flag := range mg { 11 | if flag.Obligatory { 12 | return true 13 | } 14 | } 15 | return false 16 | } 17 | 18 | func (mg MutexGroup) WasSpecified() bool { 19 | for _, flag := range mg { 20 | if flag.WasSpecified { 21 | return true 22 | } 23 | } 24 | return false 25 | } 26 | 27 | // IsValid checks if the flags in the MutexGroup describe a valid state. 28 | // I.e. At most one has been specified or – if it is an obligatory MutexGroup – 29 | // exactly one has been specified. 30 | func (mg MutexGroup) IsValid() bool { 31 | c := 0 32 | for _, flag := range mg { 33 | if flag.WasSpecified { 34 | c++ 35 | } 36 | } 37 | return c <= 1 && (!mg.IsObligatory() || c == 1) 38 | } 39 | 40 | // Names is a convenience function to return the array of names of the flags 41 | // in the MutexGroup. 42 | func (mg MutexGroup) Names() []string { 43 | r := make([]string, len(mg)) 44 | for i, flag := range mg { 45 | r[i] = flag.Name() 46 | } 47 | return r 48 | } 49 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/voxelbrain/goptions/special_types.go: -------------------------------------------------------------------------------- 1 | package goptions 2 | 3 | // Help Defines the common help flag. It is handled separately as it will cause 4 | // Parse() to return ErrHelpRequest. 5 | type Help bool 6 | 7 | // Verbs marks the point in the struct where the verbs start. Its value will be 8 | // the name of the selected verb. 9 | type Verbs string 10 | 11 | // A remainder catches all excessive arguments. If both a verb and 12 | // the containing options struct have a remainder field, only the latter one 13 | // will be used. 14 | type Remainder []string 15 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/woanware/goutil/README.md: -------------------------------------------------------------------------------- 1 | goutil 2 | ====== 3 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/woanware/goutil/datetime.go: -------------------------------------------------------------------------------- 1 | package goutil 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // 8 | func ParseTimestampWithFormat(data string, layout string) time.Time { 9 | parsedTimestamp, err := time.Parse(layout, data) 10 | if err != nil { 11 | var temp time.Time 12 | return temp 13 | } 14 | 15 | return parsedTimestamp 16 | } 17 | 18 | // Determines the number of days between two dates 19 | func DiffDays(date1 time.Time, date2 time.Time) int { 20 | return int(date2.Sub(date1) / (24 * time.Hour)) 21 | } 22 | 23 | // Converts go Time var to an RFC3339 compliant string 24 | func ConvertInt64ToRfc3339String(data int64) string { 25 | var temp time.Time 26 | if data == 0 { 27 | temp = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC) 28 | } else { 29 | temp = time.Unix(int64(data), 0) 30 | } 31 | return temp.Format(time.RFC3339) 32 | } 33 | 34 | // 35 | func InTimeSpan(start, end, check time.Time) bool { 36 | return check.After(start) && check.Before(end) 37 | } 38 | -------------------------------------------------------------------------------- /source/vendor/src/github.com/woanware/goutil/strings.go: -------------------------------------------------------------------------------- 1 | package goutil 2 | 3 | import ( 4 | "strings" 5 | "fmt" 6 | "crypto/md5" 7 | "encoding/hex" 8 | "io" 9 | ) 10 | 11 | // Emulates the python partition function 12 | func Partition(data string, separator string) (pre string, post string) { 13 | index := strings.Index(data, separator) 14 | if index == -1 { 15 | return "", "" 16 | } 17 | 18 | return data[:index], data[index+1:] 19 | } 20 | 21 | // 22 | func GetSeparator(s string) rune { 23 | var sep string 24 | s = `"` + s + `"` 25 | fmt.Sscanf(s, "%q", &sep) 26 | 27 | return ([]rune(sep))[0] 28 | } 29 | 30 | // Removes the leading/trailing quotes 31 | func RemoveQuotes(data string) string { 32 | data = strings.TrimSpace(data) 33 | if len(data) == 0 { 34 | return "" 35 | } 36 | 37 | if data == "\"\"" { 38 | return "" 39 | } 40 | 41 | if data[:1] == "\"" { 42 | data = data[1:len(data) - 1] 43 | } 44 | 45 | if data[len(data)-1:] == "\"" { 46 | data = data[:len(data)-1] 47 | } 48 | 49 | return data 50 | } 51 | 52 | // MD5 hashes a string 53 | func Md5HashString (data string) string { 54 | hasher := md5.New() 55 | io.WriteString(hasher, data) 56 | return hex.EncodeToString(hasher.Sum(nil)) 57 | } 58 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "syscall" 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | const ioctlWriteTermios = syscall.TIOCSETA 13 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | // These constants are declared here, rather than importing 8 | // them from the syscall package as some syscall packages, even 9 | // on linux, for example gccgo, do not declare them. 10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 12 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !plan9,go1.7 6 | 7 | package ctxhttp 8 | 9 | import ( 10 | "io" 11 | "net/http" 12 | "net/http/httptest" 13 | "testing" 14 | 15 | "context" 16 | ) 17 | 18 | func TestGo17Context(t *testing.T) { 19 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 20 | io.WriteString(w, "ok") 21 | })) 22 | ctx := context.Background() 23 | resp, err := Get(ctx, http.DefaultClient, ts.URL) 24 | if resp == nil || err != nil { 25 | t.Fatalf("error received from client: %v %v", err, resp) 26 | } 27 | resp.Body.Close() 28 | } 29 | -------------------------------------------------------------------------------- /source/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 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/charmap/charmap_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package charmap 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/text/encoding" 11 | "golang.org/x/text/encoding/internal" 12 | "golang.org/x/text/transform" 13 | ) 14 | 15 | func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 16 | return "Decode", e.NewDecoder(), nil 17 | } 18 | func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 19 | return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement 20 | } 21 | 22 | func TestNonRepertoire(t *testing.T) { 23 | testCases := []struct { 24 | init func(e encoding.Encoding) (string, transform.Transformer, error) 25 | e encoding.Encoding 26 | src, want string 27 | }{ 28 | {dec, Windows1252, "\x81", "\ufffd"}, 29 | 30 | {enc, Windows1252, "갂", ""}, 31 | {enc, Windows1252, "a갂", "a"}, 32 | {enc, Windows1252, "\u00E9갂", "\xE9"}, 33 | } 34 | for _, tc := range testCases { 35 | dir, tr, wantErr := tc.init(tc.e) 36 | 37 | dst, _, err := transform.String(tr, tc.src) 38 | if err != wantErr { 39 | t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr) 40 | } 41 | if got := string(dst); got != tc.want { 42 | t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package encoding_test 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | "os" 11 | "strings" 12 | 13 | "golang.org/x/text/encoding" 14 | "golang.org/x/text/encoding/charmap" 15 | "golang.org/x/text/encoding/unicode" 16 | "golang.org/x/text/transform" 17 | ) 18 | 19 | func ExampleDecodeWindows1252() { 20 | sr := strings.NewReader("Gar\xe7on !") 21 | tr := charmap.Windows1252.NewDecoder().Reader(sr) 22 | io.Copy(os.Stdout, tr) 23 | // Output: Garçon ! 24 | } 25 | 26 | func ExampleUTF8Validator() { 27 | for i := 0; i < 2; i++ { 28 | var transformer transform.Transformer 29 | transformer = unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewEncoder() 30 | if i == 1 { 31 | transformer = transform.Chain(encoding.UTF8Validator, transformer) 32 | } 33 | dst := make([]byte, 256) 34 | src := []byte("abc\xffxyz") // src is invalid UTF-8. 35 | nDst, nSrc, err := transformer.Transform(dst, src, true) 36 | fmt.Printf("i=%d: produced %q, consumed %q, error %v\n", 37 | i, dst[:nDst], src[:nSrc], err) 38 | } 39 | // Output: 40 | // i=0: produced "\x00a\x00b\x00c\xff\xfd\x00x\x00y\x00z", consumed "abc\xffxyz", error 41 | // i=1: produced "\x00a\x00b\x00c", consumed "abc", error encoding: invalid UTF-8 42 | } 43 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/ianaindex/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ianaindex_test 6 | 7 | import ( 8 | "fmt" 9 | 10 | "golang.org/x/text/encoding/charmap" 11 | "golang.org/x/text/encoding/ianaindex" 12 | ) 13 | 14 | func ExampleIndex() { 15 | fmt.Println(ianaindex.MIME.Name(charmap.ISO8859_7)) 16 | 17 | fmt.Println(ianaindex.IANA.Name(charmap.ISO8859_7)) 18 | 19 | e, _ := ianaindex.IANA.Get("cp437") 20 | fmt.Println(ianaindex.IANA.Name(e)) 21 | 22 | // TODO: Output: 23 | // ISO-8859-7 24 | // ISO8859_7:1987 25 | // IBM437 26 | } 27 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/japanese/all.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package japanese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{EUCJP, ISO2022JP, ShiftJIS} 13 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/korean/all_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package korean 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/text/encoding" 11 | "golang.org/x/text/encoding/internal" 12 | "golang.org/x/text/transform" 13 | ) 14 | 15 | func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 16 | return "Decode", e.NewDecoder(), nil 17 | } 18 | func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 19 | return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement 20 | } 21 | 22 | func TestNonRepertoire(t *testing.T) { 23 | testCases := []struct { 24 | init func(e encoding.Encoding) (string, transform.Transformer, error) 25 | e encoding.Encoding 26 | src, want string 27 | }{ 28 | {dec, EUCKR, "\xfe\xfe", "\ufffd"}, 29 | // {dec, EUCKR, "א", "\ufffd"}, // TODO: why is this different? 30 | 31 | {enc, EUCKR, "א", ""}, 32 | {enc, EUCKR, "aא", "a"}, 33 | {enc, EUCKR, "\uac00א", "\xb0\xa1"}, 34 | // TODO: should we also handle Jamo? 35 | } 36 | for _, tc := range testCases { 37 | dir, tr, wantErr := tc.init(tc.e) 38 | 39 | dst, _, err := transform.String(tr, tc.src) 40 | if err != wantErr { 41 | t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr) 42 | } 43 | if got := string(dst); got != tc.want { 44 | t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want) 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/simplifiedchinese/all.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package simplifiedchinese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{GB18030, GBK, HZGB2312} 13 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/candide-gb18030.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/candide-gb18030.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/candide-utf-16le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/candide-utf-16le.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/candide-utf-32be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/candide-utf-32be.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/candide-windows-1252.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/candide-windows-1252.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/encoding/traditionalchinese/all_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package traditionalchinese 6 | 7 | import ( 8 | "testing" 9 | 10 | "golang.org/x/text/encoding" 11 | "golang.org/x/text/encoding/internal" 12 | "golang.org/x/text/transform" 13 | ) 14 | 15 | func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 16 | return "Decode", e.NewDecoder(), nil 17 | } 18 | func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) { 19 | return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement 20 | } 21 | 22 | func TestNonRepertoire(t *testing.T) { 23 | testCases := []struct { 24 | init func(e encoding.Encoding) (string, transform.Transformer, error) 25 | e encoding.Encoding 26 | src, want string 27 | }{ 28 | {dec, Big5, "\x81\x40", "\ufffd"}, 29 | 30 | {enc, Big5, "갂", ""}, 31 | {enc, Big5, "a갂", "a"}, 32 | {enc, Big5, "\u43f0갂", "\x87@"}, 33 | } 34 | for _, tc := range testCases { 35 | dir, tr, wantErr := tc.init(tc.e) 36 | 37 | dst, _, err := transform.String(tr, tc.src) 38 | if err != wantErr { 39 | t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr) 40 | } 41 | if got := string(dst); got != tc.want { 42 | t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/runes/example_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 runes_test 6 | 7 | import ( 8 | "fmt" 9 | "unicode" 10 | 11 | "golang.org/x/text/runes" 12 | "golang.org/x/text/transform" 13 | "golang.org/x/text/unicode/norm" 14 | "golang.org/x/text/width" 15 | ) 16 | 17 | func ExampleRemove() { 18 | t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC) 19 | s, _, _ := transform.String(t, "résumé") 20 | fmt.Println(s) 21 | 22 | // Output: 23 | // resume 24 | } 25 | 26 | func ExampleMap() { 27 | replaceHyphens := runes.Map(func(r rune) rune { 28 | if unicode.Is(unicode.Hyphen, r) { 29 | return '|' 30 | } 31 | return r 32 | }) 33 | s, _, _ := transform.String(replaceHyphens, "a-b‐c⸗d﹣e") 34 | fmt.Println(s) 35 | 36 | // Output: 37 | // a|b|c|d|e 38 | } 39 | 40 | func ExampleIn() { 41 | // Convert Latin characters to their canonical form, while keeping other 42 | // width distinctions. 43 | t := runes.If(runes.In(unicode.Latin), width.Fold, nil) 44 | s, _, _ := transform.String(t, "アルアノリウ tech / アルアノリウ tech") 45 | fmt.Println(s) 46 | 47 | // Output: 48 | // アルアノリウ tech / アルアノリウ tech 49 | } 50 | 51 | func ExampleIf() { 52 | // Widen everything but ASCII. 53 | isASCII := func(r rune) bool { return r <= unicode.MaxASCII } 54 | t := runes.If(runes.Predicate(isASCII), nil, width.Widen) 55 | s, _, _ := transform.String(t, "アルアノリウ tech / 中國 / 5₩") 56 | fmt.Println(s) 57 | 58 | // Output: 59 | // アルアノリウ tech / 中國 / 5₩ 60 | } 61 | -------------------------------------------------------------------------------- /source/vendor/src/golang.org/x/text/transform/examples_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package transform_test 6 | 7 | import ( 8 | "fmt" 9 | "unicode" 10 | 11 | "golang.org/x/text/transform" 12 | "golang.org/x/text/unicode/norm" 13 | ) 14 | 15 | func ExampleRemoveFunc() { 16 | input := []byte(`tschüß; до свидания`) 17 | 18 | b := make([]byte, len(input)) 19 | 20 | t := transform.RemoveFunc(unicode.IsSpace) 21 | n, _, _ := t.Transform(b, input, true) 22 | fmt.Println(string(b[:n])) 23 | 24 | t = transform.RemoveFunc(func(r rune) bool { 25 | return !unicode.Is(unicode.Latin, r) 26 | }) 27 | n, _, _ = t.Transform(b, input, true) 28 | fmt.Println(string(b[:n])) 29 | 30 | n, _, _ = t.Transform(b, norm.NFD.Bytes(input), true) 31 | fmt.Println(string(b[:n])) 32 | 33 | // Output: 34 | // tschüß;досвидания 35 | // tschüß 36 | // tschuß 37 | } 38 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/go-playground/validator.v8/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dean Karn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/go-playground/validator.v8/examples/custom/custom.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "database/sql" 5 | "database/sql/driver" 6 | "fmt" 7 | "reflect" 8 | 9 | "gopkg.in/go-playground/validator.v8" 10 | ) 11 | 12 | // DbBackedUser User struct 13 | type DbBackedUser struct { 14 | Name sql.NullString `validate:"required"` 15 | Age sql.NullInt64 `validate:"required"` 16 | } 17 | 18 | func main() { 19 | 20 | config := &validator.Config{TagName: "validate"} 21 | 22 | validate := validator.New(config) 23 | 24 | // register all sql.Null* types to use the ValidateValuer CustomTypeFunc 25 | validate.RegisterCustomTypeFunc(ValidateValuer, sql.NullString{}, sql.NullInt64{}, sql.NullBool{}, sql.NullFloat64{}) 26 | 27 | x := DbBackedUser{Name: sql.NullString{String: "", Valid: true}, Age: sql.NullInt64{Int64: 0, Valid: false}} 28 | errs := validate.Struct(x) 29 | 30 | if errs != nil { 31 | fmt.Printf("Errs:\n%+v\n", errs) 32 | } 33 | } 34 | 35 | // ValidateValuer implements validator.CustomTypeFunc 36 | func ValidateValuer(field reflect.Value) interface{} { 37 | if valuer, ok := field.Interface().(driver.Valuer); ok { 38 | val, err := valuer.Value() 39 | if err == nil { 40 | return val 41 | } 42 | // handle the error how you want 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/go-playground/validator.v8/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/go-playground/validator.v8/logo.png -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/CHANGES-V2.md: -------------------------------------------------------------------------------- 1 | v2.0.4 / 2016-01-14 2 | =================== 3 | 4 | * remove commented code 5 | * Context.Start: improve rebuild time on watch by building changed file's package only instead of using -a flag 6 | 7 | v2.0.3 / 2015-12-10 8 | =================== 9 | 10 | * update README 11 | * fix godoenv parsing on rebuild 12 | [x] Tasks have Src -> Dest to more efficiently watch and rebuild 13 | 14 | [x] Run dependencies in Parallel or Series 15 | 16 | [x] Godo will search up dir tree for nearest Gododir/main.go 17 | 18 | [x] Namespaces to better manage or import tasks 19 | 20 | [x] Optimize watch algorithm 21 | 22 | [x] Allow exec commands to be teed, print or captured 23 | 24 | [x] More efficient file watcher 25 | 26 | [x] Externalize glob 27 | 28 | [x] Deprecated 29 | 30 | In{}, 31 | D{} 32 | W{} 33 | c.Args.ZeroString -> c.Args.AsString 34 | 35 | 36 | [x] Set environment variables via key=value pairs 37 | 38 | [x] Watches Godofile (Gododir/main.go) automatically (buggy) 39 | 40 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Mario L. Gutierrez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build get 2 | 3 | build: 4 | @cd cmd/godo && go install -a 5 | 6 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/VERSION.go: -------------------------------------------------------------------------------- 1 | package godo 2 | 3 | // Version is the current version 4 | var Version = "2.0.9" 5 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/book/README.md: -------------------------------------------------------------------------------- 1 | # GODO 2 | 3 | Godo is a task runner and file watcher for the Go programming language. 4 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/book/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](README.md) 4 | * [Installation](installation/README.md) 5 | * [Getting Started](getting_started/README.md) 6 | * [main.go location](getting_started/locating_maingo.md) 7 | * [Tasks](tasks/README.md) 8 | 9 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/book/getting_started/locating_maingo.md: -------------------------------------------------------------------------------- 1 | # Locating main.go 2 | 3 | Godo compiles and runs a file at the relative path `Gododir/main.go`. If the path does not exist at the current directory, parent directories are searched. 4 | 5 | For example, given this directory structure: 6 | 7 | ``` 8 | mgutz/ 9 | Gododir/ 10 | main.go 11 | project1/ 12 | Gododir/ 13 | main.go 14 | project2 15 | 16 | ``` 17 | 18 | * Running `godo` inside of project1 uses `project1/Gododir/main.go`. 19 | * Running `godo` inside of project2 uses `mgutz/Gododir/main.go` 20 | 21 | 22 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/book/installation/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | To install or update **godo**, run the following command from a terminal 4 | 5 | ```go 6 | go get -u gopkg.in/godo.v2 7 | ``` 8 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/book/tasks/README.md: -------------------------------------------------------------------------------- 1 | # Tasks 2 | 3 | A task is a named unit of work which can be executed in series or parallel. Define smaller tasks to form larger tasks. 4 | 5 | ```go 6 | 7 | var S = do.S, M = do.M, Context = do.Context 8 | 9 | func tasks(p *do.Project) { 10 | p.Task("assets", nil, func(c *Context) { 11 | c.Run("webpack") 12 | }) 13 | 14 | project.Task("build", S{"build"}, func(c *Context) { 15 | c.Run("go run main.go", M{"$in": "cmd/app"}) 16 | }) 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/cmd/example/handler.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func handler(w http.ResponseWriter, r *http.Request) { 9 | fmt.Fprintf(w, "Hi there, I lub %s!", r.URL.Path[1:]) 10 | } 11 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/cmd/example/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "net/http" 4 | 5 | func main() { 6 | http.HandleFunc("/", handler) 7 | http.ListenAndServe(":8013", nil) 8 | } 9 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package godo is a task runner, file watcher in the spirit of Rake, Gulp ... 2 | // 3 | // To install 4 | // 5 | // go get -u gopkg.in/godo.v2/cmd/godo 6 | package godo 7 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/fileWrapper.go: -------------------------------------------------------------------------------- 1 | package godo 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "os" 7 | 8 | "github.com/mgutz/ansi" 9 | ) 10 | 11 | type fileWrapper struct { 12 | file *os.File 13 | buf *bytes.Buffer 14 | readLines string 15 | 16 | recorder *bytes.Buffer 17 | 18 | // Adds color to stdout & stderr if terminal supports it 19 | colorStart string 20 | } 21 | 22 | func newFileWrapper(file *os.File, recorder *bytes.Buffer, color string) *fileWrapper { 23 | streamer := &fileWrapper{ 24 | file: file, 25 | buf: bytes.NewBufferString(""), 26 | recorder: recorder, 27 | colorStart: color, 28 | } 29 | 30 | return streamer 31 | } 32 | 33 | func (l *fileWrapper) Write(p []byte) (n int, err error) { 34 | if n, err = l.recorder.Write(p); err != nil { 35 | return 36 | } 37 | 38 | err = l.out(string(p)) 39 | return 40 | } 41 | 42 | func (l *fileWrapper) WriteString(s string) (n int, err error) { 43 | if n, err = l.recorder.WriteString(s); err != nil { 44 | return 45 | } 46 | 47 | err = l.out(s) 48 | return 49 | } 50 | 51 | func (l *fileWrapper) Close() error { 52 | l.buf = bytes.NewBuffer([]byte("")) 53 | return nil 54 | } 55 | 56 | func (l *fileWrapper) out(str string) (err error) { 57 | 58 | if l.colorStart != "" { 59 | fmt.Fprint(l.file, l.colorStart) 60 | fmt.Fprint(l.file, str) 61 | fmt.Fprint(l.file, ansi.Reset) 62 | } else { 63 | fmt.Fprint(l.file, str) 64 | } 65 | 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/fileAsset.go: -------------------------------------------------------------------------------- 1 | package glob 2 | 3 | import "os" 4 | 5 | // FileAsset contains file information and path from globbing. 6 | type FileAsset struct { 7 | os.FileInfo 8 | // Path to asset 9 | Path string 10 | } 11 | 12 | // Stat updates the stat of this asset. 13 | func (fa *FileAsset) Stat() (*os.FileInfo, error) { 14 | fi, err := os.Stat(fa.Path) 15 | if err != nil { 16 | return nil, err 17 | } 18 | fa.FileInfo = fi 19 | return &fa.FileInfo, nil 20 | } 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/foo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo -n FOOBAR 3 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/foo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test/foo.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub/subsub1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub/subsub1.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub/subsub2.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub/subsub2.html -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub1.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test/sub/sub2.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test2/main.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test2/main.css -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/test2/main.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/glob/test2/main.js -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/glob/watchCriteria_test.go: -------------------------------------------------------------------------------- 1 | package glob 2 | 3 | import ( 4 | "strings" 5 | "testing" 6 | ) 7 | 8 | func TestEffectiveCriteria(t *testing.T) { 9 | result, _ := EffectiveCriteria("xtest/*.txt", "xtest2/**/*.html", "xtest/*.js", "!xtest/*.html") 10 | 11 | if len(result.Roots()) != 2 { 12 | t.Error("expected 2 items in result set") 13 | } 14 | 15 | success := 0 16 | for _, c := range result.Items { 17 | if strings.HasSuffix(c.Root, "/xtest") { 18 | success++ 19 | } 20 | if strings.HasSuffix(c.Root, "/xtest2") { 21 | success++ 22 | } 23 | } 24 | 25 | if success != 2 { 26 | t.Error("should calc effective criteria") 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/handler.go: -------------------------------------------------------------------------------- 1 | package godo 2 | 3 | // Handler is the interface which all task handlers eventually implement. 4 | type Handler interface { 5 | Handle(*Context) 6 | } 7 | 8 | // // HandlerFunc is Handler adapter. 9 | // type handlerFunc func() error 10 | 11 | // // Handle implements Handler. 12 | // func (f handlerFunc) Handle(*Context) error { 13 | // return f() 14 | // } 15 | 16 | // // VoidHandlerFunc is a Handler adapter. 17 | // type voidHandlerFunc func() 18 | 19 | // // Handle implements Handler. 20 | // func (v voidHandlerFunc) Handle(*Context) error { 21 | // v() 22 | // return nil 23 | // } 24 | 25 | // // ContextHandlerFunc is a Handler adapter. 26 | // type contextHandlerFunc func(*Context) error 27 | 28 | // // Handle implements Handler. 29 | // func (c contextHandlerFunc) Handle(ctx *Context) error { 30 | // return c(ctx) 31 | // } 32 | 33 | // HandlerFunc is a Handler adapter. 34 | type HandlerFunc func(*Context) 35 | 36 | // Handle implements Handler. 37 | func (f HandlerFunc) Handle(ctx *Context) { 38 | f(ctx) 39 | } 40 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/bar.txt: -------------------------------------------------------------------------------- 1 | bar 2 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/foo.cmd: -------------------------------------------------------------------------------- 1 | @echo FOOBAR -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/foo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo -n FOOBAR 3 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/foo.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/sub/foo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/test/sub/foo.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/sub/sub/subsub1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/test/sub/sub/subsub1.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/sub/sub/subsub2.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/test/sub/sub/subsub2.html -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/sub/sub1.txt: -------------------------------------------------------------------------------- 1 | sfd 2 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/sub/sub2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/test/sub/sub2.txt -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/test/templates/1.go.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsi-group/autorun-logger-server/030ba0d31d0e37552f18cb2d7daf350cd47bdb09/source/vendor/src/gopkg.in/godo.v2/test/templates/1.go.html -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/util/doc.go: -------------------------------------------------------------------------------- 1 | // Package util contains general purpose utility and logging functions. 2 | package util 3 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/util/prompt.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | 8 | "github.com/howeyc/gopass" 9 | ) 10 | 11 | // Prompt prompts user for input with default value. 12 | func Prompt(prompt string) string { 13 | reader := bufio.NewReader(os.Stdin) 14 | fmt.Print(prompt) 15 | text, _ := reader.ReadString('\n') 16 | return text 17 | } 18 | 19 | // PromptPassword prompts user for password input. 20 | func PromptPassword(prompt string) string { 21 | fmt.Printf(prompt) 22 | b, err := gopass.GetPasswd() 23 | if err != nil { 24 | fmt.Println(err.Error()) 25 | return "" 26 | } 27 | return string(b) 28 | } 29 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/waitgroup.go: -------------------------------------------------------------------------------- 1 | package godo 2 | 3 | import "sync" 4 | 5 | // WaitGroupN is a custom wait group that tracks the number added 6 | // so it can be stopped. 7 | type WaitGroupN struct { 8 | sync.WaitGroup 9 | sync.Mutex 10 | N int 11 | } 12 | 13 | // Add adds to counter. 14 | func (wg *WaitGroupN) Add(n int) { 15 | wg.Lock() 16 | wg.N += n 17 | wg.Unlock() 18 | wg.WaitGroup.Add(n) 19 | } 20 | 21 | // Done removes from counter. 22 | func (wg *WaitGroupN) Done() { 23 | wg.Lock() 24 | wg.N-- 25 | wg.Unlock() 26 | 27 | wg.WaitGroup.Done() 28 | } 29 | 30 | // Stop calls done on remaining counter. 31 | func (wg *WaitGroupN) Stop() { 32 | wg.Lock() 33 | for i := 0; i < wg.N; i++ { 34 | wg.WaitGroup.Done() 35 | } 36 | wg.N = 0 37 | wg.Unlock() 38 | } 39 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/watcher/fileEvent.go: -------------------------------------------------------------------------------- 1 | package watcher 2 | 3 | import "fmt" 4 | 5 | //"log" 6 | 7 | const ( 8 | // NONE means no event, initial state. 9 | NONE = iota 10 | // CREATED means file was created. 11 | CREATED 12 | // DELETED means file was deleted. 13 | DELETED 14 | // MODIFIED means file was modified. 15 | MODIFIED 16 | // PERM means changed permissions 17 | PERM 18 | // NOEXIST means file does not exist. 19 | NOEXIST 20 | // NOPERM means no permissions for the file (see const block comment). 21 | NOPERM 22 | // INVALID means any type of error not represented above. 23 | INVALID 24 | ) 25 | 26 | // FileEvent is a wrapper around github.com/howeyc/fsnotify.FileEvent 27 | type FileEvent struct { 28 | Event int 29 | Path string 30 | UnixNano int64 31 | } 32 | 33 | // newFileEvent creates a new file event. 34 | func newFileEvent(op int, path string, unixNano int64) *FileEvent { 35 | //log.Printf("to channel %+v\n", originEvent) 36 | return &FileEvent{Event: op, Path: path, UnixNano: unixNano} 37 | } 38 | 39 | // String returns an eye friendly version of this event. 40 | func (fe *FileEvent) String() string { 41 | var status string 42 | switch fe.Event { 43 | case CREATED: 44 | status = "was created" 45 | case DELETED: 46 | status = "was deleted" 47 | case MODIFIED: 48 | status = "was modified" 49 | case PERM: 50 | status = "permissions changed" 51 | case NOEXIST: 52 | status = "does not exist" 53 | case NOPERM: 54 | status = "is not accessible (permission)" 55 | case INVALID: 56 | status = "is invalid" 57 | } 58 | return fmt.Sprintf("%s %s", fe.Path, status) 59 | } 60 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/watcher/fswatch/ISSUES: -------------------------------------------------------------------------------- 1 | * directory deletions not recognised as events 2 | * wi should use filepath.Abs 3 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/watcher/fswatch/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Kyle Isom 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/godo.v2/watcher/fswatch/fswatch.go: -------------------------------------------------------------------------------- 1 | package fswatch 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // These values represent the events fswatch knows about. fswatch uses a 8 | // stat(2) call to look up file information; a file will only have a NOPERM 9 | // event if the parent directory has no search permission (i.e. parent 10 | // directory doesn't have executable permissions for the current user). 11 | const ( 12 | NONE = iota // No event, initial state. 13 | CREATED // File was created. 14 | DELETED // File was deleted. 15 | MODIFIED // File was modified. 16 | PERM // Changed permissions 17 | NOEXIST // File does not exist. 18 | NOPERM // No permissions for the file (see const block comment). 19 | INVALID // Any type of error not represented above. 20 | ) 21 | 22 | // NotificationBufLen is the number of notifications that should be buffered 23 | // in the channel. 24 | var NotificationBufLen = 16 25 | 26 | // WatchDelay is the duration between path scans. It defaults to 100ms. 27 | var WatchDelay time.Duration 28 | 29 | func init() { 30 | del, err := time.ParseDuration("100ms") 31 | if err != nil { 32 | panic("couldn't set up fswatch: " + err.Error()) 33 | } 34 | WatchDelay = del 35 | } 36 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | ## [2.0.0] - 2015-09-02 6 | 7 | - Mailer has been removed. It has been replaced by Dialer and Sender. 8 | - `File` type and the `CreateFile` and `OpenFile` functions have been removed. 9 | - `Message.Attach` and `Message.Embed` have a new signature. 10 | - `Message.GetBodyWriter` has been removed. Use `Message.AddAlternativeWriter` 11 | instead. 12 | - `Message.Export` has been removed. `Message.WriteTo` can be used instead. 13 | - `Message.DelHeader` has been removed. 14 | - The `Bcc` header field is no longer sent. It is far more simpler and 15 | efficient: the same message is sent to all recipients instead of sending a 16 | different email to each Bcc address. 17 | - LoginAuth has been removed. `NewPlainDialer` now implements the LOGIN 18 | authentication mechanism when needed. 19 | - Go 1.2 is now required instead of Go 1.3. No external dependency are used when 20 | using Go 1.5. 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Thank you for contributing to Gomail! Here are a few guidelines: 2 | 3 | ## Bugs 4 | 5 | If you think you found a bug, create an issue and supply the minimum amount 6 | of code triggering the bug so it can be reproduced. 7 | 8 | 9 | ## Fixing a bug 10 | 11 | If you want to fix a bug, you can send a pull request. It should contains a 12 | new test or update an existing one to cover that bug. 13 | 14 | 15 | ## New feature proposal 16 | 17 | If you think Gomail lacks a feature, you can open an issue or send a pull 18 | request. I want to keep Gomail code and API as simple as possible so please 19 | describe your needs so we can discuss whether this feature should be added to 20 | Gomail or not. 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Alexandre Cesaro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/auth.go: -------------------------------------------------------------------------------- 1 | package gomail 2 | 3 | import ( 4 | "bytes" 5 | "errors" 6 | "fmt" 7 | "net/smtp" 8 | ) 9 | 10 | // loginAuth is an smtp.Auth that implements the LOGIN authentication mechanism. 11 | type loginAuth struct { 12 | username string 13 | password string 14 | host string 15 | } 16 | 17 | func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) { 18 | if !server.TLS { 19 | advertised := false 20 | for _, mechanism := range server.Auth { 21 | if mechanism == "LOGIN" { 22 | advertised = true 23 | break 24 | } 25 | } 26 | if !advertised { 27 | return "", nil, errors.New("gomail: unencrypted connection") 28 | } 29 | } 30 | if server.Name != a.host { 31 | return "", nil, errors.New("gomail: wrong host name") 32 | } 33 | return "LOGIN", nil, nil 34 | } 35 | 36 | func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) { 37 | if !more { 38 | return nil, nil 39 | } 40 | 41 | switch { 42 | case bytes.Equal(fromServer, []byte("Username:")): 43 | return []byte(a.username), nil 44 | case bytes.Equal(fromServer, []byte("Password:")): 45 | return []byte(a.password), nil 46 | default: 47 | return nil, fmt.Errorf("gomail: unexpected server challenge: %s", fromServer) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package gomail provides a simple interface to compose emails and to mail them 2 | // efficiently. 3 | // 4 | // More info on Github: https://github.com/go-gomail/gomail 5 | package gomail 6 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/mime.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package gomail 4 | 5 | import ( 6 | "mime" 7 | "mime/quotedprintable" 8 | "strings" 9 | ) 10 | 11 | var newQPWriter = quotedprintable.NewWriter 12 | 13 | type mimeEncoder struct { 14 | mime.WordEncoder 15 | } 16 | 17 | var ( 18 | bEncoding = mimeEncoder{mime.BEncoding} 19 | qEncoding = mimeEncoder{mime.QEncoding} 20 | lastIndexByte = strings.LastIndexByte 21 | ) 22 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/gomail.v2/mime_go14.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package gomail 4 | 5 | import "gopkg.in/alexcesaro/quotedprintable.v3" 6 | 7 | var newQPWriter = quotedprintable.NewWriter 8 | 9 | type mimeEncoder struct { 10 | quotedprintable.WordEncoder 11 | } 12 | 13 | var ( 14 | bEncoding = mimeEncoder{quotedprintable.BEncoding} 15 | qEncoding = mimeEncoder{quotedprintable.QEncoding} 16 | lastIndexByte = func(s string, c byte) int { 17 | for i := len(s) - 1; i >= 0; i-- { 18 | 19 | if s[i] == c { 20 | return i 21 | } 22 | } 23 | return -1 24 | } 25 | ) 26 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/Gododir/generate.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "io/ioutil" 5 | 6 | do "gopkg.in/godo.v2" 7 | "gopkg.in/godo.v2/util" 8 | ) 9 | 10 | var builderTemplate = ` 11 | package dat 12 | 13 | //// DO NOT EDIT, auto-generated: godo builder-boilerplate 14 | 15 | {{ range $idx, $builder := .builders }} 16 | // Interpolate interpolates this builders sql. 17 | func (b *{{$builder}}) Interpolate() (string, []interface{}, error) { 18 | return interpolate(b) 19 | } 20 | 21 | // IsInterpolated determines if this builder will interpolate when 22 | // Interpolate() is called. 23 | func (b *{{$builder}}) IsInterpolated() bool { 24 | return b.isInterpolated 25 | } 26 | 27 | // SetIsInterpolated sets whether this builder should interpolate. 28 | func (b *{{$builder}}) SetIsInterpolated(enable bool) *{{$builder}} { 29 | b.isInterpolated = enable 30 | return b 31 | } 32 | {{ end }} 33 | ` 34 | 35 | func generateTasks(p *do.Project) { 36 | p.Task("builder-boilerplate", nil, func(c *do.Context) { 37 | context := do.M{ 38 | "builders": []string{"CallBuilder", "DeleteBuilder", "InsectBuilder", 39 | "InsertBuilder", "RawBuilder", "SelectBuilder", "SelectDocBuilder", 40 | "UpdateBuilder", "UpsertBuilder"}, 41 | } 42 | 43 | s, err := util.StrTemplate(builderTemplate, context) 44 | c.Check(err, "Unalbe ") 45 | 46 | ioutil.WriteFile("builders_generated.go", []byte(s), 0644) 47 | c.Run("go fmt builders_generated.go") 48 | }).Desc("Generates builder boilerplate code") 49 | } 50 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Mario Gutierrez 4 | With Portions Copyright (c) 2014 Jonathan Novak, Tyler Smith 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/call.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | // CallBuilder is a store procedure call builder. 4 | type CallBuilder struct { 5 | Execer 6 | 7 | args []interface{} 8 | isInterpolated bool 9 | sproc string 10 | } 11 | 12 | // NewCallBuilder creates a new CallBuilder for the given sproc name and args. 13 | func NewCallBuilder(sproc string, args ...interface{}) *CallBuilder { 14 | if sproc == "" { 15 | logger.Error("Invalid sproc name", "name", sproc) 16 | return nil 17 | } 18 | return &CallBuilder{sproc: sproc, args: args, isInterpolated: EnableInterpolation} 19 | } 20 | 21 | // ToSQL serializes CallBuilder to a SQL string returning 22 | // valid SQL with placeholders an a slice of query arguments. 23 | func (b *CallBuilder) ToSQL() (string, []interface{}) { 24 | buf := bufPool.Get() 25 | defer bufPool.Put(buf) 26 | 27 | buf.WriteString("SELECT * FROM ") 28 | buf.WriteString(b.sproc) 29 | 30 | length := len(b.args) 31 | if length > 0 { 32 | buildPlaceholders(buf, 1, length) 33 | return buf.String(), b.args 34 | } 35 | buf.WriteString("()") 36 | return buf.String(), nil 37 | } 38 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/call_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/stretchr/testify.v1/assert" 7 | ) 8 | 9 | func TestCallSql(t *testing.T) { 10 | sql, args := Call("foo", 1, "two").ToSQL() 11 | assert.Equal(t, "SELECT * FROM foo($1,$2)", sql) 12 | assert.Exactly(t, []interface{}{1, "two"}, args) 13 | } 14 | 15 | func TestCallNoArgsSql(t *testing.T) { 16 | sql, args := Call("foo").ToSQL() 17 | assert.Equal(t, "SELECT * FROM foo()", sql) 18 | assert.Nil(t, args) 19 | } 20 | 21 | func TestCallInterpolate(t *testing.T) { 22 | sql, args, err := Call("foo", 1).SetIsInterpolated(true).Interpolate() 23 | assert.NoError(t, err) 24 | assert.Equal(t, "SELECT * FROM foo(1)", sql) 25 | assert.Exactly(t, []interface{}(nil), args) 26 | 27 | sql, args, err = Call("foo", 1).Interpolate() 28 | assert.NoError(t, err) 29 | assert.Equal(t, "SELECT * FROM foo($1)", sql) 30 | assert.Exactly(t, []interface{}{1}, args) 31 | } 32 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/common/buffer.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "bytes" 5 | "sync" 6 | ) 7 | 8 | // BufferWriter a common interface between bytes.Buffer and bufio.Writer 9 | type BufferWriter interface { 10 | Write(p []byte) (nn int, err error) 11 | WriteRune(r rune) (n int, err error) 12 | WriteString(s string) (n int, err error) 13 | } 14 | 15 | // BufferPool is sync pool for *bytes.Buffer 16 | type BufferPool struct { 17 | sync.Pool 18 | } 19 | 20 | // NewBufferPool creates a buffer pool. 21 | func NewBufferPool() *BufferPool { 22 | return &BufferPool{ 23 | Pool: sync.Pool{New: func() interface{} { 24 | b := bytes.NewBuffer(make([]byte, 128)) 25 | b.Reset() 26 | return b 27 | }}, 28 | } 29 | } 30 | 31 | // Get checks out a buffer which must be put back in. 32 | func (bp *BufferPool) Get() *bytes.Buffer { 33 | return bp.Pool.Get().(*bytes.Buffer) 34 | } 35 | 36 | // Put reurns a buffer which was previously checked out. 37 | func (bp *BufferPool) Put(b *bytes.Buffer) { 38 | b.Reset() 39 | bp.Pool.Put(b) 40 | } 41 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/common/common.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import "math/rand" 4 | 5 | var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") 6 | var lenLetters = len(letters) 7 | 8 | // RandomString returns a random string of length n. 9 | func RandomString(n int) string { 10 | b := make([]rune, n) 11 | for i := range b { 12 | b[i] = letters[rand.Intn(lenLetters)] 13 | } 14 | return string(b) 15 | } 16 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/delete_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/stretchr/testify.v1/assert" 7 | ) 8 | 9 | func BenchmarkDeleteSql(b *testing.B) { 10 | b.ResetTimer() 11 | 12 | for i := 0; i < b.N; i++ { 13 | DeleteFrom("alpha").Where("a = $1", "b").ToSQL() 14 | } 15 | } 16 | 17 | func TestDeleteAllToSql(t *testing.T) { 18 | sql, _ := DeleteFrom("a").ToSQL() 19 | 20 | assert.Equal(t, sql, "DELETE FROM a") 21 | } 22 | 23 | func TestDeleteSingleToSql(t *testing.T) { 24 | sql, args := DeleteFrom("a").Where("id = $1", 1).ToSQL() 25 | 26 | assert.Equal(t, sql, "DELETE FROM a WHERE (id = $1)") 27 | assert.Equal(t, args, []interface{}{1}) 28 | } 29 | 30 | func TestDeleteTenStaringFromTwentyToSql(t *testing.T) { 31 | sql, _ := DeleteFrom("a").ToSQL() 32 | 33 | assert.Equal(t, sql, "DELETE FROM a") 34 | } 35 | 36 | func TestDeleteWhereExprSql(t *testing.T) { 37 | expr := Expr("id=$1", 100) 38 | sql, args := DeleteFrom("a").Where("foo = $1", "bar").Where(expr).ToSQL() 39 | assert.Equal(t, sql, `DELETE FROM a WHERE (foo = $1) AND (id=$2)`) 40 | assert.Exactly(t, args, []interface{}{"bar", 100}) 41 | } 42 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/dialect.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "time" 5 | 6 | "gopkg.in/mgutz/dat.v1/common" 7 | ) 8 | 9 | // Dialect is the active SQLDialect. 10 | var Dialect SQLDialect 11 | 12 | // SQLDialect represents a vendor specific SQL dialect. 13 | type SQLDialect interface { 14 | // WriteStringLiteral writes a string literal. 15 | WriteStringLiteral(buf common.BufferWriter, value string) 16 | // WriteIdentifier writes a quoted identifer such as a column or table. 17 | WriteIdentifier(buf common.BufferWriter, column string) 18 | // WriteFormattedTime writes a time formatted for the database 19 | WriteFormattedTime(buf common.BufferWriter, t time.Time) 20 | } 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/errors.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | var ( 8 | // ErrNotFound ... 9 | ErrNotFound = errors.New("not found") 10 | // ErrNotUTF8 ... 11 | ErrNotUTF8 = errors.New("invalid UTF-8") 12 | // ErrInvalidSliceLength ... 13 | ErrInvalidSliceLength = errors.New("length of slice is 0. length must be >= 1") 14 | // ErrInvalidSliceValue ... 15 | ErrInvalidSliceValue = errors.New("trying to interpolate invalid slice value into query") 16 | // ErrInvalidValue ... 17 | ErrInvalidValue = errors.New("trying to interpolate invalid value into query") 18 | // ErrArgumentMismatch ... 19 | ErrArgumentMismatch = errors.New("mismatch between ? (placeholders) and arguments") 20 | // ErrTimedout occurs when a query times out. 21 | ErrTimedout = errors.New("query timed out") 22 | // ErrInvalidOperation occurs when an invalid operation occurs like cancelling 23 | // an operation without a procPID. 24 | ErrInvalidOperation = errors.New("invalid operation") 25 | ) 26 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/expression.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import "gopkg.in/mgutz/dat.v1/common" 4 | 5 | // Expression holds a sub expression. 6 | type Expression struct { 7 | Sql string 8 | Args []interface{} 9 | } 10 | 11 | // Expr is a SQL expression with placeholders, and a slice of args to replace them with 12 | func Expr(sql string, values ...interface{}) *Expression { 13 | return &Expression{Sql: sql, Args: values} 14 | } 15 | 16 | // WriteRelativeArgs writes the args to buf adjusting the placeholder to start at pos. 17 | func (exp *Expression) WriteRelativeArgs(buf common.BufferWriter, args *[]interface{}, pos *int64) { 18 | remapPlaceholders(buf, exp.Sql, *pos) 19 | *args = append(*args, exp.Args...) 20 | *pos += int64(len(exp.Args)) 21 | } 22 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/fixtures/data.sql: -------------------------------------------------------------------------------- 1 | --@sproc=Add 2 | CREATE FUNCTION add() RETURNS text AS $$ 3 | BEGIN 4 | return 'Hello world!'; 5 | END; 6 | $$ LANGUAGE plpgsql; 7 | 8 | --@sproc=Subtract 9 | CREATE FUNCTION subtract() RETURNS text AS $$ 10 | BEGIN 11 | return 'Hello world!'; 12 | END; 13 | $$ LANGUAGE plpgsql; 14 | 15 | --@key=BuildFoobar 16 | INSERT INTO user_matches values(s, name) 17 | VALUES ('foo', 'bar'); 18 | 19 | --@key=InsertUsers 20 | INSERT INTO users 21 | VALUES ($1, $2); 22 | 23 | --@key=foobar 24 | 25 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/glide.yaml: -------------------------------------------------------------------------------- 1 | package: gopkg.in/mgutz/dat.v1 2 | import: 3 | - package: github.com/cenkalti/backoff 4 | - package: github.com/garyburd/redigo 5 | subpackages: 6 | - redis 7 | - package: github.com/jmoiron/sqlx 8 | - package: github.com/lib/pq 9 | - package: github.com/mgutz/ansi 10 | - package: github.com/mgutz/jo 11 | subpackages: 12 | - v1 13 | - package: github.com/mgutz/logxi 14 | subpackages: 15 | - v1 16 | - package: github.com/mgutz/str 17 | - package: github.com/pmylund/go-cache 18 | - package: github.com/satori/go.uuid 19 | - package: gopkg.in/godo.v2 20 | subpackages: 21 | - util 22 | - package: gopkg.in/stretchr/testify.v1 23 | subpackages: 24 | - assert 25 | 26 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/init_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "testing" 7 | 8 | "gopkg.in/mgutz/dat.v1/postgres" 9 | "gopkg.in/stretchr/testify.v1/assert" 10 | ) 11 | 12 | func init() { 13 | Dialect = postgres.New() 14 | } 15 | 16 | func quoteSQL(sqlFmt string, cols ...string) string { 17 | args := make([]interface{}, len(cols)) 18 | 19 | for i := range cols { 20 | args[i] = quoteColumn(cols[i]) 21 | } 22 | 23 | return fmt.Sprintf(sqlFmt, args...) 24 | } 25 | 26 | func quoteColumn(column string) string { 27 | var buffer bytes.Buffer 28 | Dialect.WriteIdentifier(&buffer, column) 29 | return buffer.String() 30 | } 31 | 32 | func checkSliceEqual(t *testing.T, expected, actual []interface{}, msgAndArgs ...interface{}) bool { 33 | if fmt.Sprintf("%v", expected) != fmt.Sprintf("%v", actual) { 34 | return assert.Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ 35 | " != %#v (actual)", expected, actual), msgAndArgs...) 36 | } 37 | 38 | return true 39 | } 40 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/issues_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | "gopkg.in/stretchr/testify.v1/assert" 8 | ) 9 | 10 | func TestIssue26(t *testing.T) { 11 | 12 | type Model struct { 13 | ID int64 `json:"id" db:"id"` 14 | CreatedAt time.Time `json:"createdAt" db:"created_at"` 15 | UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` 16 | } 17 | 18 | type Customer struct { 19 | Model 20 | First string `json:"first" db:"first"` 21 | Last string `json:"last" db:"last"` 22 | } 23 | 24 | customer := Customer{} 25 | sql, args := 26 | Update("customers"). 27 | SetBlacklist(customer, "id", "created_at", "updated_at"). 28 | Where("id = $1", customer.ID). 29 | Returning("updated_at").ToSQL() 30 | 31 | assert.Equal(t, sql, `UPDATE "customers" SET "first" = $1, "last" = $2 WHERE (id = $3) RETURNING "updated_at"`) 32 | assert.Exactly(t, args, []interface{}{"", "", int64(0)}) 33 | } 34 | 35 | func TestIssue29(t *testing.T) { 36 | sql, args := Select("a").From("people").Where("email = $1", "foo@acme.com").OrderBy("people.name <-> $1", "foo").ToSQL() 37 | assert.Equal(t, sql, `SELECT a FROM people WHERE (email = $1) ORDER BY people.name <-> $2`) 38 | assert.Exactly(t, args, []interface{}{"foo@acme.com", "foo"}) 39 | 40 | sql2, _, err := Interpolate(sql, args) 41 | assert.NoError(t, err) 42 | assert.Equal(t, stripWS(`SELECT a FROM people WHERE (email = 'foo@acme.com') ORDER BY people.name <-> 'foo'`), stripWS(sql2)) 43 | } 44 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/kvs/init.go: -------------------------------------------------------------------------------- 1 | package kvs 2 | 3 | import ( 4 | "github.com/mgutz/logxi/v1" 5 | ) 6 | 7 | var logger log.Logger 8 | 9 | func init() { 10 | logger = log.New("dat.cache") 11 | } 12 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/kvs/interfaces.go: -------------------------------------------------------------------------------- 1 | package kvs 2 | 3 | import ( 4 | "errors" 5 | "hash/fnv" 6 | "strconv" 7 | "time" 8 | ) 9 | 10 | // KeyValueStore represents simple key value storage. 11 | type KeyValueStore interface { 12 | Set(key, value string, ttl time.Duration) error 13 | Get(key string) (string, error) 14 | Del(key string) error 15 | FlushDB() error 16 | } 17 | 18 | // TTLNever means do not expire a key 19 | const TTLNever time.Duration = -1 20 | 21 | // NanosecondsPerMillisecond is used to convert between ns and ms. 22 | const NanosecondsPerMillisecond = 1000000 23 | 24 | // ErrNotFound is returned when an entry is not found in memory database. 25 | var ErrNotFound = errors.New("Key not found") 26 | 27 | // Hash returns the hash value of a string. The returned value is useful 28 | // as a key. 29 | func Hash(s string) string { 30 | h := fnv.New32a() 31 | h.Write([]byte(s)) 32 | return strconv.FormatUint(uint64(h.Sum32()), 16) 33 | } 34 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/list_helpers.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "gopkg.in/mgutz/dat.v1/common" 5 | ) 6 | 7 | var bufPool = common.NewBufferPool() 8 | 9 | func writeIdentifiers(buf common.BufferWriter, columns []string, join string) { 10 | for i, column := range columns { 11 | if i > 0 { 12 | buf.WriteString(join) 13 | } 14 | Dialect.WriteIdentifier(buf, column) 15 | } 16 | } 17 | 18 | func writeIdentifier(buf common.BufferWriter, name string) { 19 | Dialect.WriteIdentifier(buf, name) 20 | } 21 | 22 | func buildPlaceholders(buf common.BufferWriter, start, length int) { 23 | // Build the placeholder like "($1,$2,$3)" 24 | buf.WriteRune('(') 25 | for i := start; i < start+length; i++ { 26 | if i > start { 27 | buf.WriteRune(',') 28 | } 29 | writePlaceholder(buf, i) 30 | } 31 | buf.WriteRune(')') 32 | } 33 | 34 | // joinPlaceholders returns $1, $2 ... , $n 35 | func writePlaceholders(buf common.BufferWriter, length int, join string, offset int) { 36 | for i := 0; i < length; i++ { 37 | if i > 0 { 38 | buf.WriteString(join) 39 | } 40 | writePlaceholder(buf, i+offset) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/raw.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | // RawBuilder builds SQL from raw SQL. 4 | type RawBuilder struct { 5 | Execer 6 | 7 | isInterpolated bool 8 | sql string 9 | args []interface{} 10 | } 11 | 12 | // NewRawBuilder creates a new RawBuilder for the given SQL string and arguments 13 | func NewRawBuilder(sql string, args ...interface{}) *RawBuilder { 14 | return &RawBuilder{sql: sql, args: args, isInterpolated: EnableInterpolation} 15 | } 16 | 17 | // ToSQL implements builder interface 18 | func (b *RawBuilder) ToSQL() (string, []interface{}) { 19 | return b.sql, b.args 20 | } 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/benchmark.sql: -------------------------------------------------------------------------------- 1 | --@create_table 2 | CREATE TABLE IF NOT EXISTS TABLE benches ( 3 | id SERIAL PRIMARY KEY, 4 | amount money, 5 | store hstore, 6 | image bytea, 7 | name text, 8 | is_ok boolean, 9 | created_at timestamptz default now() 10 | ); 11 | 12 | --@clear_table 13 | DELETE FROM benches; 14 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/benchmark_init_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import "gopkg.in/mgutz/dat.v1" 4 | 5 | func benchReset() { 6 | var sql = ` 7 | DROP TABLE IF EXISTS benches; 8 | CREATE TABLE benches ( 9 | id SERIAL PRIMARY KEY, 10 | amount decimal, 11 | image bytea, 12 | is_ok boolean, 13 | name text, 14 | n integer, 15 | created_at timestamptz default now() 16 | ); 17 | DELETE FROM benches; 18 | ` 19 | err := execMulti(sql) 20 | if err != nil { 21 | panic(err) 22 | } 23 | return 24 | } 25 | 26 | // execMulti executes grouped SQL statements in a string delimited by a marker. 27 | // The marker is "^GO$" which means GO on a line by itself. 28 | func execMulti(sql string) error { 29 | statements, err := dat.SQLSliceFromString(sql) 30 | if err != nil { 31 | return err 32 | } 33 | // TODO this should be in transaction 34 | for _, sq := range statements { 35 | _, err := testDB.SQL(sq).Exec() 36 | if err != nil { 37 | return err 38 | } 39 | } 40 | return nil 41 | } 42 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/connection.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import "gopkg.in/mgutz/dat.v1" 4 | 5 | // Connection is a queryable connection and represents a DB or Tx. 6 | type Connection interface { 7 | Begin() (*Tx, error) 8 | Call(sproc string, args ...interface{}) *dat.CallBuilder 9 | DeleteFrom(table string) *dat.DeleteBuilder 10 | Exec(cmd string, args ...interface{}) (*dat.Result, error) 11 | ExecBuilder(b dat.Builder) error 12 | ExecMulti(commands ...*dat.Expression) (int, error) 13 | InsertInto(table string) *dat.InsertBuilder 14 | Insect(table string) *dat.InsectBuilder 15 | Select(columns ...string) *dat.SelectBuilder 16 | SelectDoc(columns ...string) *dat.SelectDocBuilder 17 | SQL(sql string, args ...interface{}) *dat.RawBuilder 18 | Update(table string) *dat.UpdateBuilder 19 | Upsert(table string) *dat.UpsertBuilder 20 | } 21 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/connection_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/mgutz/dat.v1" 7 | "gopkg.in/stretchr/testify.v1/assert" 8 | ) 9 | 10 | func TestConnectionExec(t *testing.T) { 11 | installFixtures() 12 | 13 | id := 0 14 | str := "" 15 | err := testDB.InsertInto("people"). 16 | Columns("name", "foo"). 17 | Values("conn1", "---"). 18 | Returning("id", "foo"). 19 | QueryScalar(&id, &str) 20 | 21 | assert.NoError(t, err) 22 | assert.True(t, id > 0) 23 | assert.Equal(t, "---", str) 24 | 25 | dat.EnableInterpolation = true 26 | _, err = testDB.Update("people"). 27 | Set("foo", dat.DEFAULT). 28 | Returning("foo"). 29 | Exec() 30 | dat.EnableInterpolation = false 31 | assert.NoError(t, err) 32 | } 33 | 34 | func TestEscapeSequences(t *testing.T) { 35 | installFixtures() 36 | 37 | dat.EnableInterpolation = true 38 | id := 0 39 | str := "" 40 | expect := "I said, \"a's \\ \\\b\f\n\r\t\x1a\"你好'; DELETE FROM people" 41 | 42 | err := testDB.InsertInto("people"). 43 | Columns("name", "foo"). 44 | Values("conn1", expect). 45 | Returning("id", "foo"). 46 | QueryScalar(&id, &str) 47 | 48 | assert.NoError(t, err) 49 | assert.True(t, id > 0) 50 | assert.Equal(t, expect, str) 51 | dat.EnableInterpolation = false 52 | } 53 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/db_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/stretchr/testify.v1/assert" 7 | ) 8 | 9 | func TestVersion(t *testing.T) { 10 | // require at least 9.3+ for testing 11 | assert.True(t, testDB.Version > 90300) 12 | } 13 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/fixtures/sprocs.sql: -------------------------------------------------------------------------------- 1 | --@sproc 2 | CREATE FUNCTION add() RETURNS text AS $$ 3 | BEGIN 4 | return 'Hello world!'; 5 | END; 6 | $$ LANGUAGE plpgsql; 7 | 8 | --@sproc 9 | CREATE FUNCTION subtract() RETURNS text AS $$ 10 | BEGIN 11 | return 'Hello world!'; 12 | END; 13 | $$ LANGUAGE plpgsql; 14 | 15 | --@key:"foobar" 16 | INSERT INTO user_matches values(s, name) 17 | VALUES ('foo', 'bar'); 18 | 19 | --@key:"other" 20 | INSERT INTO user_matches values(s, name) 21 | VALUES ('foo', 'bar'); 22 | 23 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/init.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "database/sql" 5 | "time" 6 | 7 | "github.com/cenkalti/backoff" 8 | "github.com/mgutz/logxi/v1" 9 | "gopkg.in/mgutz/dat.v1" 10 | "gopkg.in/mgutz/dat.v1/kvs" 11 | "gopkg.in/mgutz/dat.v1/postgres" 12 | ) 13 | 14 | var logger log.Logger 15 | 16 | // LogQueriesThreshold is the threshold for logging "slow" queries 17 | var LogQueriesThreshold time.Duration 18 | 19 | // LogErrNoRows tells runner to log `sql.ErrNoRows` 20 | var LogErrNoRows bool 21 | 22 | func init() { 23 | dat.Dialect = postgres.New() 24 | logger = log.New("dat:sqlx") 25 | } 26 | 27 | // Cache caches query results. 28 | var Cache kvs.KeyValueStore 29 | 30 | // SetCache sets this runner's cache. The default cache is in-memory 31 | // based. See cache.MemoryKeyValueStore. 32 | func SetCache(store kvs.KeyValueStore) { 33 | Cache = store 34 | } 35 | 36 | // MustPing pings a database with an exponential backoff. The 37 | // function panics if the database cannot be pinged after 15 minutes 38 | func MustPing(db *sql.DB) { 39 | var err error 40 | b := backoff.NewExponentialBackOff() 41 | ticker := backoff.NewTicker(b) 42 | 43 | // Ticks will continue to arrive when the previous operation is still running, 44 | // so operations that take a while to fail could run in quick succession. 45 | for range ticker.C { 46 | if err = db.Ping(); err != nil { 47 | logger.Info("pinging database...", err.Error()) 48 | continue 49 | } 50 | 51 | ticker.Stop() 52 | return 53 | } 54 | 55 | panic("Could not ping database!") 56 | } 57 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/init_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "bytes" 5 | "database/sql" 6 | "fmt" 7 | "os" 8 | "time" 9 | 10 | "github.com/mgutz/logxi/v1" 11 | 12 | "gopkg.in/mgutz/dat.v1" 13 | "gopkg.in/mgutz/dat.v1/kvs" 14 | "gopkg.in/mgutz/dat.v1/postgres" 15 | ) 16 | 17 | var testDB *DB 18 | var sqlDB *sql.DB 19 | 20 | func init() { 21 | dat.Dialect = postgres.New() 22 | sqlDB = realDb() 23 | testDB = NewDB(sqlDB, "postgres") 24 | dat.Strict = false 25 | log.Suppress(true) 26 | 27 | Cache = kvs.NewMemoryKeyValueStore(1 * time.Second) 28 | //Cache, _ = kvs.NewDefaultRedisStore() 29 | } 30 | 31 | func beginTxWithFixtures() *Tx { 32 | installFixtures() 33 | c, err := testDB.Begin() 34 | if err != nil { 35 | panic(err) 36 | } 37 | return c 38 | } 39 | 40 | func quoteColumn(column string) string { 41 | var buffer bytes.Buffer 42 | dat.Dialect.WriteIdentifier(&buffer, column) 43 | return buffer.String() 44 | } 45 | 46 | func quoteSQL(sqlFmt string, cols ...string) string { 47 | args := make([]interface{}, len(cols)) 48 | 49 | for i := range cols { 50 | args[i] = quoteColumn(cols[i]) 51 | } 52 | 53 | return fmt.Sprintf(sqlFmt, args...) 54 | } 55 | 56 | func realDb() *sql.DB { 57 | driver := os.Getenv("DAT_DRIVER") 58 | if driver == "" { 59 | logger.Fatal("env DAT_DRIVER is not set") 60 | } 61 | 62 | dsn := os.Getenv("DAT_DSN") 63 | if dsn == "" { 64 | logger.Fatal("env DAT_DSN is not set") 65 | } 66 | 67 | db, err := sql.Open(driver, dsn) 68 | if err != nil { 69 | logger.Fatal("Database error ", "err", err) 70 | } 71 | 72 | return db 73 | } 74 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/json_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/mgutz/dat.v1" 7 | "gopkg.in/stretchr/testify.v1/assert" 8 | ) 9 | 10 | func TestRealJSON(t *testing.T) { 11 | j, _ := dat.NewJSON([]int{1, 2, 3}) 12 | var num int 13 | var err error 14 | if testDB.Version > 90400 { 15 | err = testDB.SQL("select $1::json->1", j).QueryScalar(&num) 16 | } else { 17 | err = testDB.SQL("select $1->1", j).QueryScalar(&num) 18 | } 19 | 20 | assert.NoError(t, err) 21 | assert.Equal(t, 2, num) 22 | } 23 | 24 | func TestRealJSONInterpolated(t *testing.T) { 25 | j, _ := dat.NewJSON([]int{1, 2, 3}) 26 | var num int 27 | var err error 28 | if testDB.Version > 90400 { 29 | err = testDB.SQL("select $1::json->1", j).SetIsInterpolated(true).QueryScalar(&num) 30 | } else { 31 | err = testDB.SQL("select $1->1", j).SetIsInterpolated(true).QueryScalar(&num) 32 | } 33 | assert.NoError(t, err) 34 | assert.Equal(t, 2, num) 35 | } 36 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/query_object_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/stretchr/testify.v1/assert" 7 | 8 | "github.com/mgutz/jo/v1" 9 | ) 10 | 11 | func TestQueryObject(t *testing.T) { 12 | s := beginTxWithFixtures() 13 | defer s.AutoRollback() 14 | 15 | var people jo.Object 16 | err := s. 17 | Select("id", "name", "email"). 18 | From("people"). 19 | OrderBy("id ASC"). 20 | QueryObject(&people) 21 | 22 | assert.NoError(t, err) 23 | assert.Equal(t, len(people.AsSlice(".")), 6) 24 | 25 | // Make sure that the Ids are set. It's possible (maybe?) that different DBs set ids differently so 26 | // don't assume they're 1 and 2. 27 | assert.True(t, people.MustInt64("[0].id") > 0) 28 | assert.True(t, people.MustInt64("[1].id") > people.MustInt64("[0].id")) 29 | 30 | mario, _ := people.At("[0]") 31 | john, _ := people.At("[1]") 32 | assert.Equal(t, mario.MustString("name"), "Mario") 33 | assert.Equal(t, mario.MustString("email"), "mario@acme.com") 34 | assert.Equal(t, john.MustString("name"), "John") 35 | assert.Equal(t, john.MustString("email"), "john@acme.com") 36 | } 37 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/sqlx-runner/upsert_test.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/mgutz/dat.v1" 7 | "gopkg.in/stretchr/testify.v1/assert" 8 | ) 9 | 10 | func TestUpsertReal(t *testing.T) { 11 | // Insert by specifying values 12 | s := beginTxWithFixtures() 13 | defer s.AutoRollback() 14 | 15 | var id int64 16 | err := s.Upsert("people"). 17 | Columns("name", "email"). 18 | Values("mario", "mgutz@mgutz.com"). 19 | Where("name = $1", "mario"). 20 | Returning("id"). 21 | QueryScalar(&id) 22 | assert.NoError(t, err) 23 | assert.True(t, id > 0) 24 | 25 | var id2 int64 26 | err = s.Upsert("people"). 27 | Columns("name", "email"). 28 | Values("mario", "mario@foo.com"). 29 | Where("name = $1", "mario"). 30 | Returning("id"). 31 | QueryScalar(&id2) 32 | assert.NoError(t, err) 33 | assert.Equal(t, id, id2) 34 | 35 | // Insert by specifying a record (ptr to struct) 36 | person := Person{Name: "Barack"} 37 | person.Email.Valid = true 38 | person.Email.String = "obama1@whitehouse.gov" 39 | 40 | err = s. 41 | Upsert("people"). 42 | Columns("name", "email"). 43 | Record(&person). 44 | Where("name = $1", "Barack"). 45 | Returning("id", "created_at"). 46 | QueryStruct(&person) 47 | assert.NoError(t, err) 48 | assert.True(t, person.ID > 0) 49 | assert.NotEqual(t, person.CreatedAt, dat.NullTime{}) 50 | } 51 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/struct_mapping.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | "github.com/mgutz/str" 7 | 8 | "gopkg.in/mgutz/dat.v1/reflectx" 9 | ) 10 | 11 | var fieldMapper = reflectx.NewMapperTagFunc("db", nil, nil) 12 | 13 | // reflectFields gets a cached field information about record 14 | func reflectFields(rec interface{}) *reflectx.StructMap { 15 | val := reflect.Indirect(reflect.ValueOf(rec)) 16 | vtype := val.Type() 17 | return fieldMapper.TypeMap(vtype) 18 | } 19 | 20 | // ValuesFor ... 21 | func valuesFor(recordType reflect.Type, record reflect.Value, columns []string) ([]interface{}, error) { 22 | vals := fieldMapper.FieldsByName(record, columns) 23 | values := make([]interface{}, len(columns)) 24 | for i, val := range vals { 25 | if !val.IsValid() { 26 | return nil, fmt.Errorf("Could not find struct tag in type %s: `db:\"%s\"`", recordType.Name(), columns[i]) 27 | } 28 | values[i] = val.Interface() 29 | } 30 | return values, nil 31 | } 32 | 33 | func reflectColumns(v interface{}) []string { 34 | cols := []string{} 35 | for _, name := range reflectFields(v).DeclaredNames { 36 | cols = append(cols, name) 37 | } 38 | return cols 39 | } 40 | 41 | func reflectExcludeColumns(v interface{}, blacklist []string) []string { 42 | cols := []string{} 43 | for _, name := range reflectFields(v).DeclaredNames { 44 | if str.SliceContains(blacklist, name) { 45 | continue 46 | } 47 | cols = append(cols, name) 48 | } 49 | 50 | return cols 51 | } 52 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/struct_mapping_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/stretchr/testify.v1/assert" 7 | ) 8 | 9 | func TestEmbeddedStructMapping(t *testing.T) { 10 | type Realm struct { 11 | RealmUUID string `db:"realm_uuid"` 12 | } 13 | type Group struct { 14 | GroupUUID string `db:"group_uuid"` 15 | *Realm 16 | } 17 | 18 | g := &Group{Realm: &Realm{"11"}, GroupUUID: "22"} 19 | 20 | sql, args := InsertInto("groups").Columns("group_uuid", "realm_uuid").Record(g).ToSQL() 21 | expected := ` 22 | INSERT INTO groups ("group_uuid", "realm_uuid") 23 | VALUES ($1, $2) 24 | ` 25 | assert.Equal(t, stripWS(expected), stripWS(sql)) 26 | assert.Exactly(t, []interface{}{"22", "11"}, args) 27 | } 28 | 29 | func TestEmbeddedStructInvalidColumns(t *testing.T) { 30 | type Realm struct { 31 | RealmUUID string 32 | } 33 | type Group struct { 34 | GroupUUID string `db:"group_uuid"` 35 | *Realm 36 | } 37 | 38 | g := &Group{Realm: &Realm{"11"}, GroupUUID: "22"} 39 | 40 | assert.Panics(t, func() { 41 | // realm_uuid must be explicitly defined 42 | InsertInto("groups").Columns("group_uuid", "realm_uuid").Record(g).ToSQL() 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/mgutz/dat.v1/types_test.go: -------------------------------------------------------------------------------- 1 | package dat 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | "github.com/lib/pq" 8 | 9 | "gopkg.in/stretchr/testify.v1/assert" 10 | ) 11 | 12 | func TestNullStringFrom(t *testing.T) { 13 | v := "foo" 14 | n := NullStringFrom(v) 15 | 16 | assert.True(t, n.Valid) 17 | assert.Equal(t, n.String, v) 18 | } 19 | 20 | func TestNullFloat64From(t *testing.T) { 21 | v := 42.2 22 | n := NullFloat64From(v) 23 | 24 | assert.True(t, n.Valid) 25 | assert.Equal(t, n.Float64, v) 26 | } 27 | 28 | func TestNullInt64From(t *testing.T) { 29 | v := int64(400) 30 | n := NullInt64From(v) 31 | 32 | assert.True(t, n.Valid) 33 | assert.Equal(t, n.Int64, v) 34 | } 35 | 36 | func TestNullTimeFrom(t *testing.T) { 37 | v := time.Now() 38 | n := NullTimeFrom(v) 39 | 40 | assert.True(t, n.Valid) 41 | assert.Equal(t, n.Time, v) 42 | } 43 | 44 | func TestNullBoolFrom(t *testing.T) { 45 | v := false 46 | n := NullBoolFrom(v) 47 | 48 | assert.True(t, n.Valid) 49 | assert.Equal(t, n.Bool, v) 50 | } 51 | 52 | func TestInvalidNullTime(t *testing.T) { 53 | n := NullTime{pq.NullTime{Valid: false}} 54 | 55 | assert.False(t, n.Valid) 56 | var when time.Time 57 | assert.Equal(t, n.Time, when) 58 | } 59 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/yaml.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /source/vendor/src/gopkg.in/yaml.v2/suite_test.go: -------------------------------------------------------------------------------- 1 | package yaml_test 2 | 3 | import ( 4 | . "gopkg.in/check.v1" 5 | "testing" 6 | ) 7 | 8 | func Test(t *testing.T) { TestingT(t) } 9 | 10 | type S struct{} 11 | 12 | var _ = Suite(&S{}) 13 | --------------------------------------------------------------------------------