├── LICENSE ├── README.md ├── bin ├── assets │ ├── UI │ │ ├── 0x00.png │ │ ├── 0x01.png │ │ ├── 0x02.png │ │ ├── 0x03.png │ │ ├── 0x04.png │ │ ├── 0x05.png │ │ ├── 0x06.png │ │ ├── 0x07.png │ │ ├── 0x08.png │ │ ├── 0x09.png │ │ ├── 0x11.png │ │ ├── 0x12.png │ │ ├── 0x13.png │ │ ├── 0x14.png │ │ ├── 0x15.png │ │ ├── 0x16.png │ │ ├── 0x17.png │ │ ├── 0x18.png │ │ ├── 0x19.png │ │ ├── 0x21.png │ │ ├── 0x22.png │ │ ├── 0x23.png │ │ ├── 0x24.png │ │ ├── 0x25.png │ │ ├── 0x26.png │ │ ├── 0x27.png │ │ ├── 0x28.png │ │ ├── 0x29.png │ │ ├── 0x41.png │ │ ├── 0x42.png │ │ ├── 0x43.png │ │ ├── 0x44.png │ │ ├── 0x51.png │ │ ├── 0x52.png │ │ └── 0x53.png │ ├── benchmark.html │ ├── index.html │ ├── index_change.html │ ├── monitot_charts.html │ ├── printroominfo.html │ └── script │ │ ├── echarts.min.js │ │ ├── jquery-3.2.0.min.js │ │ └── response_charts.js ├── config.toml ├── csv │ ├── accounts.csv │ ├── robot.csv │ ├── shop.csv │ └── test_patterns.csv ├── ctrl ├── hu.go ├── sync └── upx.exe ├── build-linux.bat ├── build-linux.sh ├── protocol ├── coin.proto ├── conf.proto ├── error.proto ├── generate ├── generate.bat ├── generate.sh ├── login.proto ├── postbox.proto ├── protoc-gen-go.exe ├── protoc.exe ├── readme.txt ├── room.proto ├── socialroom.proto ├── sys.proto ├── user.proto └── vo.proto └── src ├── cheat ├── cheat.go └── statics │ └── data.go ├── code.google.com └── p │ ├── go.tools │ ├── astutil │ │ ├── enclosing.go │ │ ├── enclosing_test.go │ │ ├── imports.go │ │ └── imports_test.go │ ├── blog │ │ ├── atom │ │ │ └── atom.go │ │ └── blog.go │ ├── call │ │ ├── call.go │ │ └── util.go │ ├── cmd │ │ ├── cover │ │ │ ├── cover.go │ │ │ ├── cover_test.go │ │ │ ├── doc.go │ │ │ ├── func.go │ │ │ ├── html.go │ │ │ └── testdata │ │ │ │ ├── main.go │ │ │ │ └── test.go │ │ ├── godoc │ │ │ ├── README.godoc-app │ │ │ ├── appinit.go │ │ │ ├── blog.go │ │ │ ├── codewalk.go │ │ │ ├── doc.go │ │ │ ├── godoc_test.go │ │ │ ├── handlers.go │ │ │ ├── main.go │ │ │ ├── play.go │ │ │ ├── remotesearch.go │ │ │ └── setup-godoc-app.bash │ │ ├── gotype │ │ │ ├── doc.go │ │ │ └── gotype.go │ │ ├── html2article │ │ │ └── conv.go │ │ ├── oracle │ │ │ ├── emacs-test.bash │ │ │ ├── main.go │ │ │ ├── oracle.el │ │ │ └── oracle.vim │ │ ├── ssadump │ │ │ └── main.go │ │ └── vet │ │ │ ├── asmdecl.go │ │ │ ├── assign.go │ │ │ ├── atomic.go │ │ │ ├── buildtag.go │ │ │ ├── composite.go │ │ │ ├── copylock.go │ │ │ ├── deadcode.go │ │ │ ├── doc.go │ │ │ ├── main.go │ │ │ ├── method.go │ │ │ ├── nilfunc.go │ │ │ ├── print.go │ │ │ ├── rangeloop.go │ │ │ ├── shadow.go │ │ │ ├── structtag.go │ │ │ ├── testdata │ │ │ ├── asm.go │ │ │ ├── asm1.s │ │ │ ├── asm2.s │ │ │ ├── asm3.s │ │ │ ├── asm4.s │ │ │ ├── assign.go │ │ │ ├── atomic.go │ │ │ ├── buildtag.go │ │ │ ├── buildtag_bad.go │ │ │ ├── composite.go │ │ │ ├── copylock.go │ │ │ ├── deadcode.go │ │ │ ├── method.go │ │ │ ├── nilfunc.go │ │ │ ├── print.go │ │ │ ├── rangeloop.go │ │ │ ├── shadow.go │ │ │ └── structtag.go │ │ │ ├── types.go │ │ │ ├── vet_test.go │ │ │ └── whitelist │ │ │ └── whitelist.go │ ├── cover │ │ └── profile.go │ ├── dashboard │ │ ├── README │ │ ├── app │ │ │ ├── app.yaml │ │ │ ├── build │ │ │ │ ├── build.go │ │ │ │ ├── dash.go │ │ │ │ ├── handler.go │ │ │ │ ├── init.go │ │ │ │ ├── key.go │ │ │ │ ├── notify.go │ │ │ │ ├── notify.txt │ │ │ │ ├── test.go │ │ │ │ ├── ui.go │ │ │ │ └── ui.html │ │ │ ├── cache │ │ │ │ └── cache.go │ │ │ ├── index.yaml │ │ │ └── static │ │ │ │ ├── status_alert.gif │ │ │ │ └── status_good.gif │ │ └── builder │ │ │ ├── Makefile │ │ │ ├── doc.go │ │ │ ├── env.go │ │ │ ├── exec.go │ │ │ ├── http.go │ │ │ ├── main.go │ │ │ └── vcs.go │ ├── go │ │ ├── exact │ │ │ ├── exact.go │ │ │ └── exact_test.go │ │ ├── gcimporter │ │ │ ├── exportdata.go │ │ │ ├── gcimporter.go │ │ │ ├── gcimporter_test.go │ │ │ └── testdata │ │ │ │ └── exports.go │ │ ├── types │ │ │ ├── api.go │ │ │ ├── api_test.go │ │ │ ├── assignments.go │ │ │ ├── builtins.go │ │ │ ├── builtins_test.go │ │ │ ├── call.go │ │ │ ├── check.go │ │ │ ├── check_test.go │ │ │ ├── conversions.go │ │ │ ├── errors.go │ │ │ ├── eval.go │ │ │ ├── eval_test.go │ │ │ ├── expr.go │ │ │ ├── exprstring.go │ │ │ ├── exprstring_test.go │ │ │ ├── go11.go │ │ │ ├── go12.go │ │ │ ├── hilbert_test.go │ │ │ ├── issues_test.go │ │ │ ├── labels.go │ │ │ ├── lookup.go │ │ │ ├── methodset.go │ │ │ ├── objects.go │ │ │ ├── objset.go │ │ │ ├── operand.go │ │ │ ├── package.go │ │ │ ├── predicates.go │ │ │ ├── resolver.go │ │ │ ├── resolver_test.go │ │ │ ├── return.go │ │ │ ├── scope.go │ │ │ ├── selection.go │ │ │ ├── self_test.go │ │ │ ├── sizes.go │ │ │ ├── stdlib_test.go │ │ │ ├── stmt.go │ │ │ ├── testdata │ │ │ │ ├── builtins.src │ │ │ │ ├── const0.src │ │ │ │ ├── const1.src │ │ │ │ ├── constdecl.src │ │ │ │ ├── conversions.src │ │ │ │ ├── cycles.src │ │ │ │ ├── cycles1.src │ │ │ │ ├── cycles2.src │ │ │ │ ├── cycles3.src │ │ │ │ ├── cycles4.src │ │ │ │ ├── decls0.src │ │ │ │ ├── decls1.src │ │ │ │ ├── decls2a.src │ │ │ │ ├── decls2b.src │ │ │ │ ├── decls3.src │ │ │ │ ├── errors.src │ │ │ │ ├── expr0.src │ │ │ │ ├── expr1.src │ │ │ │ ├── expr2.src │ │ │ │ ├── expr3.src │ │ │ │ ├── gotos.src │ │ │ │ ├── importdecl0a.src │ │ │ │ ├── importdecl0b.src │ │ │ │ ├── init0.src │ │ │ │ ├── init1.src │ │ │ │ ├── labels.src │ │ │ │ ├── methodsets.src │ │ │ │ ├── shifts.src │ │ │ │ ├── stmt0.src │ │ │ │ ├── stmt1.src │ │ │ │ └── vardecl.src │ │ │ ├── token_test.go │ │ │ ├── typemap │ │ │ │ ├── typemap.go │ │ │ │ └── typemap_test.go │ │ │ ├── types.go │ │ │ ├── typestring.go │ │ │ ├── typestring_test.go │ │ │ ├── typexpr.go │ │ │ └── universe.go │ │ └── vcs │ │ │ ├── discovery.go │ │ │ ├── env.go │ │ │ ├── http.go │ │ │ ├── vcs.go │ │ │ └── vcs_test.go │ ├── godoc │ │ ├── cmdline.go │ │ ├── cmdline_test.go │ │ ├── corpus.go │ │ ├── dirtrees.go │ │ ├── format.go │ │ ├── godoc.go │ │ ├── godoc_test.go │ │ ├── index.go │ │ ├── index_test.go │ │ ├── linkify.go │ │ ├── meta.go │ │ ├── page.go │ │ ├── parser.go │ │ ├── pres.go │ │ ├── redirect │ │ │ └── redirect.go │ │ ├── search.go │ │ ├── server.go │ │ ├── snippet.go │ │ ├── spec.go │ │ ├── spot.go │ │ ├── static │ │ │ ├── bake.go │ │ │ ├── bake.sh │ │ │ ├── codewalk.html │ │ │ ├── codewalkdir.html │ │ │ ├── dirlist.html │ │ │ ├── doc.go │ │ │ ├── error.html │ │ │ ├── example.html │ │ │ ├── godoc.html │ │ │ ├── godocs.js │ │ │ ├── jquery.js │ │ │ ├── opensearch.xml │ │ │ ├── package.html │ │ │ ├── package.txt │ │ │ ├── play.js │ │ │ ├── playground.js │ │ │ ├── search.html │ │ │ ├── search.txt │ │ │ ├── static.go │ │ │ └── style.css │ │ ├── tab.go │ │ ├── template.go │ │ ├── util │ │ │ ├── throttle.go │ │ │ └── util.go │ │ └── vfs │ │ │ ├── httpfs │ │ │ └── httpfs.go │ │ │ ├── mapfs │ │ │ ├── mapfs.go │ │ │ └── mapfs_test.go │ │ │ ├── namespace.go │ │ │ ├── os.go │ │ │ ├── vfs.go │ │ │ └── zipfs │ │ │ └── zipfs.go │ ├── importer │ │ ├── importer.go │ │ ├── importer_test.go │ │ ├── pkginfo.go │ │ ├── source_test.go │ │ ├── testdata │ │ │ ├── a.go │ │ │ └── b.go │ │ └── util.go │ ├── oracle │ │ ├── TODO │ │ ├── callees.go │ │ ├── callers.go │ │ ├── callgraph.go │ │ ├── callstack.go │ │ ├── definition.go │ │ ├── describe.go │ │ ├── freevars.go │ │ ├── implements.go │ │ ├── oracle.go │ │ ├── oracle_test.go │ │ ├── peers.go │ │ ├── pointsto.go │ │ ├── pos.go │ │ ├── referrers.go │ │ ├── serial │ │ │ └── serial.go │ │ ├── testdata │ │ │ └── src │ │ │ │ ├── lib │ │ │ │ └── lib.go │ │ │ │ └── main │ │ │ │ ├── callgraph-json.go │ │ │ │ ├── callgraph-json.golden │ │ │ │ ├── callgraph.go │ │ │ │ ├── callgraph.golden │ │ │ │ ├── callgraph2.go │ │ │ │ ├── callgraph2.golden │ │ │ │ ├── calls-json.go │ │ │ │ ├── calls-json.golden │ │ │ │ ├── calls.go │ │ │ │ ├── calls.golden │ │ │ │ ├── describe-json.go │ │ │ │ ├── describe-json.golden │ │ │ │ ├── describe.go │ │ │ │ ├── describe.golden │ │ │ │ ├── freevars.go │ │ │ │ ├── freevars.golden │ │ │ │ ├── implements-json.go │ │ │ │ ├── implements-json.golden │ │ │ │ ├── implements.go │ │ │ │ ├── implements.golden │ │ │ │ ├── imports.go │ │ │ │ ├── imports.golden │ │ │ │ ├── multi.go │ │ │ │ ├── peers-json.go │ │ │ │ ├── peers-json.golden │ │ │ │ ├── peers.go │ │ │ │ ├── peers.golden │ │ │ │ ├── pointsto-json.go │ │ │ │ ├── pointsto-json.golden │ │ │ │ ├── pointsto.go │ │ │ │ ├── pointsto.golden │ │ │ │ ├── referrers-json.go │ │ │ │ ├── referrers-json.golden │ │ │ │ ├── reflection.go │ │ │ │ ├── reflection.golden │ │ │ │ ├── what-json.go │ │ │ │ ├── what-json.golden │ │ │ │ ├── what.go │ │ │ │ └── what.golden │ │ └── what.go │ ├── playground │ │ ├── appengine.go │ │ ├── common.go │ │ ├── local.go │ │ └── socket │ │ │ └── socket.go │ ├── pointer │ │ ├── TODO │ │ ├── analysis.go │ │ ├── api.go │ │ ├── callgraph.go │ │ ├── doc.go │ │ ├── example_test.go │ │ ├── gen.go │ │ ├── intrinsics.go │ │ ├── labels.go │ │ ├── pointer_test.go │ │ ├── print.go │ │ ├── reflect.go │ │ ├── solve.go │ │ ├── testdata │ │ │ ├── a_test.go │ │ │ ├── another.go │ │ │ ├── arrayreflect.go │ │ │ ├── arrays.go │ │ │ ├── channels.go │ │ │ ├── chanreflect.go │ │ │ ├── chanreflect1.go │ │ │ ├── context.go │ │ │ ├── conv.go │ │ │ ├── finalizer.go │ │ │ ├── flow.go │ │ │ ├── fmtexcerpt.go │ │ │ ├── func.go │ │ │ ├── funcreflect.go │ │ │ ├── hello.go │ │ │ ├── interfaces.go │ │ │ ├── mapreflect.go │ │ │ ├── maps.go │ │ │ ├── panic.go │ │ │ ├── recur.go │ │ │ ├── reflect.go │ │ │ ├── rtti.go │ │ │ ├── structreflect.go │ │ │ └── structs.go │ │ └── util.go │ ├── present │ │ ├── args.go │ │ ├── code.go │ │ ├── doc.go │ │ ├── html.go │ │ ├── iframe.go │ │ ├── image.go │ │ ├── link.go │ │ ├── link_test.go │ │ ├── parse.go │ │ ├── style.go │ │ └── style_test.go │ └── ssa │ │ ├── blockopt.go │ │ ├── builder.go │ │ ├── builder_test.go │ │ ├── const.go │ │ ├── create.go │ │ ├── doc.go │ │ ├── dom.go │ │ ├── emit.go │ │ ├── example_test.go │ │ ├── func.go │ │ ├── interp │ │ ├── external.go │ │ ├── external_plan9.go │ │ ├── external_unix.go │ │ ├── external_windows.go │ │ ├── interp.go │ │ ├── interp_test.go │ │ ├── map.go │ │ ├── ops.go │ │ ├── reflect.go │ │ ├── testdata │ │ │ ├── a_test.go │ │ │ ├── b_test.go │ │ │ ├── boundmeth.go │ │ │ ├── coverage.go │ │ │ ├── fieldprom.go │ │ │ ├── ifaceconv.go │ │ │ ├── ifaceprom.go │ │ │ ├── initorder.go │ │ │ ├── methprom.go │ │ │ ├── mrvchain.go │ │ │ └── recover.go │ │ └── value.go │ │ ├── lift.go │ │ ├── lvalue.go │ │ ├── print.go │ │ ├── promote.go │ │ ├── sanity.go │ │ ├── source.go │ │ ├── source_test.go │ │ ├── ssa.go │ │ ├── ssautil │ │ ├── switch.go │ │ ├── switch_test.go │ │ ├── testdata │ │ │ └── switches.go │ │ └── visit.go │ │ ├── stdlib_test.go │ │ ├── testdata │ │ ├── objlookup.go │ │ └── valueforexpr.go │ │ ├── testmain.go │ │ └── util.go │ └── goprotobuf │ ├── proto │ ├── Makefile │ ├── all_test.go │ ├── clone.go │ ├── clone_test.go │ ├── decode.go │ ├── encode.go │ ├── equal.go │ ├── equal_test.go │ ├── extensions.go │ ├── lib.go │ ├── message_set.go │ ├── pointer_reflect.go │ ├── pointer_unsafe.go │ ├── properties.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 │ └── protoc-gen-go │ ├── Makefile │ ├── descriptor │ ├── Makefile │ ├── descriptor.pb.go │ └── descriptor.pb.golden │ ├── doc.go │ ├── generator │ ├── Makefile │ ├── generator.go │ └── name_test.go │ ├── main.go │ ├── plugin │ ├── Makefile │ ├── plugin.pb.go │ └── plugin.pb.golden │ └── testdata │ ├── Makefile │ ├── extension_base.proto │ ├── extension_extra.proto │ ├── extension_test.go │ ├── extension_user.proto │ ├── golden_test.go │ ├── imp.pb.go.golden │ ├── imp.proto │ ├── imp2.proto │ ├── imp3.proto │ ├── main_test.go │ ├── multi │ ├── multi1.proto │ ├── multi2.proto │ └── multi3.proto │ └── my_test │ ├── test.pb.go │ ├── test.pb.go.golden │ └── test.proto ├── config └── config.go ├── game ├── algorithm │ ├── algo_test.go │ ├── algorithm.go │ ├── cards.go │ ├── define.go │ ├── dirtycard.go │ ├── encodecard.go │ ├── exist_chow.go │ ├── exist_hu.go │ ├── exist_kong.go │ ├── hu_13bukao.go │ ├── hu_3n2.go │ ├── hu_7pair.go │ ├── hu_bao_tou.go │ ├── hu_n_cai_n_ke.go │ ├── hu_pengpeng.go │ ├── hu_qingluanfeng.go │ ├── score_calc.go │ └── sort.go ├── csv │ ├── pattern_test.go │ └── shop_csv.go ├── data │ ├── data_active.go │ ├── data_card_record.go │ ├── data_gen_id.go │ ├── data_resource_change.go │ ├── data_statistics.go │ ├── database.go │ ├── game_record_private.go │ ├── statistics_test.go │ └── user.go ├── interfacer │ ├── iconn.go │ ├── iplayer.go │ ├── iproto.go │ └── iroom.go ├── players │ └── players.go ├── request │ ├── chat.go │ ├── config.go │ ├── http_login.go │ ├── login.go │ ├── ping.go │ ├── record.go │ ├── regist.go │ └── userdata.go ├── resource │ └── resource.go ├── room │ ├── data.go │ ├── deal.go │ ├── desk.go │ ├── deskdata.go │ ├── discard.go │ ├── dismiss.go │ ├── draw.go │ ├── enter.go │ ├── he.go │ ├── maizi.go │ ├── operate.go │ ├── player.go │ ├── ready.go │ ├── record.go │ ├── res.go │ ├── rooms.go │ └── settle.go └── roomrequest │ ├── dismiss.go │ ├── ready.go │ ├── req_create_room.go │ ├── req_discard.go │ ├── req_entry_room.go │ ├── req_hu.go │ ├── req_maizi.go │ └── req_operate.go ├── github.com ├── 89hmdys │ └── toast │ │ ├── LICENSE │ │ ├── README.md │ │ ├── aes_test.go │ │ ├── change.log │ │ ├── cipher │ │ ├── cipher.go │ │ ├── ecb.go │ │ ├── mode.go │ │ └── padding.go │ │ ├── crypto │ │ ├── aes_test.go │ │ ├── des_test.go │ │ ├── factory.go │ │ ├── rsa_private_key.pem │ │ ├── rsa_public_key.pem │ │ └── rsa_test.go │ │ └── rsa │ │ ├── cipher.go │ │ ├── key.go │ │ ├── mode.go │ │ └── padding.go ├── BurntSushi │ └── toml │ │ ├── COMPATIBLE │ │ ├── COPYING │ │ ├── Makefile │ │ ├── README.md │ │ ├── decode.go │ │ ├── decode_meta.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── encoding_types.go │ │ ├── encoding_types_1.1.go │ │ ├── lex.go │ │ ├── parse.go │ │ ├── session.vim │ │ ├── type_check.go │ │ └── type_fields.go ├── dgrijalva │ └── jwt-go │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── MIGRATION_GUIDE.md │ │ ├── README.md │ │ ├── VERSION_HISTORY.md │ │ ├── claims.go │ │ ├── cmd │ │ └── jwt │ │ │ ├── README.md │ │ │ └── app.go │ │ ├── doc.go │ │ ├── ecdsa.go │ │ ├── ecdsa_test.go │ │ ├── ecdsa_utils.go │ │ ├── errors.go │ │ ├── example_test.go │ │ ├── hmac.go │ │ ├── hmac_example_test.go │ │ ├── hmac_test.go │ │ ├── http_example_test.go │ │ ├── map_claims.go │ │ ├── none.go │ │ ├── none_test.go │ │ ├── parser.go │ │ ├── parser_test.go │ │ ├── request │ │ ├── doc.go │ │ ├── extractor.go │ │ ├── extractor_example_test.go │ │ ├── extractor_test.go │ │ ├── oauth2.go │ │ ├── request.go │ │ └── request_test.go │ │ ├── rsa.go │ │ ├── rsa_pss.go │ │ ├── rsa_pss_test.go │ │ ├── rsa_test.go │ │ ├── rsa_utils.go │ │ ├── signing_method.go │ │ ├── test │ │ ├── ec256-private.pem │ │ ├── ec256-public.pem │ │ ├── ec384-private.pem │ │ ├── ec384-public.pem │ │ ├── ec512-private.pem │ │ ├── ec512-public.pem │ │ ├── helpers.go │ │ ├── hmacTestKey │ │ ├── sample_key │ │ └── sample_key.pub │ │ └── token.go ├── golang │ └── glog │ │ ├── LICENSE │ │ ├── README │ │ ├── glog.go │ │ ├── glog_file.go │ │ └── glog_test.go ├── gorilla │ ├── context │ │ ├── LICENSE │ │ ├── README.md │ │ ├── context.go │ │ ├── context_test.go │ │ └── doc.go │ ├── mux │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bench_test.go │ │ ├── doc.go │ │ ├── mux.go │ │ ├── mux_test.go │ │ ├── old_test.go │ │ ├── regexp.go │ │ └── route.go │ └── websocket │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bench_test.go │ │ ├── client.go │ │ ├── client_server_test.go │ │ ├── client_test.go │ │ ├── compression.go │ │ ├── compression_test.go │ │ ├── conn.go │ │ ├── conn_read.go │ │ ├── conn_read_legacy.go │ │ ├── conn_test.go │ │ ├── doc.go │ │ ├── example_test.go │ │ ├── examples │ │ ├── autobahn │ │ │ ├── README.md │ │ │ ├── fuzzingclient.json │ │ │ └── server.go │ │ ├── chat │ │ │ ├── README.md │ │ │ ├── client.go │ │ │ ├── conn.go │ │ │ ├── home.html │ │ │ ├── hub.go │ │ │ └── main.go │ │ ├── command │ │ │ ├── README.md │ │ │ ├── home.html │ │ │ └── main.go │ │ ├── echo │ │ │ ├── README.md │ │ │ ├── client.go │ │ │ └── server.go │ │ └── filewatch │ │ │ ├── README.md │ │ │ └── main.go │ │ ├── json.go │ │ ├── json_test.go │ │ ├── server.go │ │ ├── server_test.go │ │ ├── util.go │ │ └── util_test.go ├── labstack │ ├── echo │ │ ├── .editorconfig │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _fixture │ │ │ ├── certs │ │ │ │ ├── cert.pem │ │ │ │ └── key.pem │ │ │ ├── favicon.ico │ │ │ ├── folder │ │ │ │ └── index.html │ │ │ ├── images │ │ │ │ └── walle.png │ │ │ └── index.html │ │ ├── binder.go │ │ ├── binder_test.go │ │ ├── context.go │ │ ├── context_test.go │ │ ├── echo.go │ │ ├── echo_test.go │ │ ├── glide.lock │ │ ├── glide.yaml │ │ ├── group.go │ │ ├── group_test.go │ │ ├── logger.go │ │ ├── middleware │ │ │ ├── basic_auth.go │ │ │ ├── basic_auth_test.go │ │ │ ├── body_limit.go │ │ │ ├── body_limit_test.go │ │ │ ├── compress.go │ │ │ ├── compress_test.go │ │ │ ├── cors.go │ │ │ ├── cors_test.go │ │ │ ├── csrf.go │ │ │ ├── csrf_test.go │ │ │ ├── jwt.go │ │ │ ├── jwt_test.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── method_override.go │ │ │ ├── method_override_test.go │ │ │ ├── middleware.go │ │ │ ├── recover.go │ │ │ ├── recover_test.go │ │ │ ├── redirect.go │ │ │ ├── redirect_test.go │ │ │ ├── secure.go │ │ │ ├── secure_test.go │ │ │ ├── slash.go │ │ │ └── slash_test.go │ │ ├── recipe │ │ │ ├── cors │ │ │ │ └── server.go │ │ │ ├── crud │ │ │ │ └── server.go │ │ │ ├── embed-resources │ │ │ │ ├── app │ │ │ │ │ ├── index.html │ │ │ │ │ └── main.js │ │ │ │ └── server.go │ │ │ ├── file-upload │ │ │ │ ├── multiple │ │ │ │ │ ├── public │ │ │ │ │ │ └── index.html │ │ │ │ │ └── server.go │ │ │ │ └── single │ │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ │ └── server.go │ │ │ ├── google-app-engine │ │ │ │ ├── Dockerfile │ │ │ │ ├── app-engine.go │ │ │ │ ├── app-engine.yaml │ │ │ │ ├── app-managed.go │ │ │ │ ├── app-managed.yaml │ │ │ │ ├── app-standalone.go │ │ │ │ ├── app.go │ │ │ │ ├── public │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── index.html │ │ │ │ │ └── scripts │ │ │ │ │ │ └── main.js │ │ │ │ ├── templates │ │ │ │ │ └── welcome.html │ │ │ │ ├── users.go │ │ │ │ └── welcome.go │ │ │ ├── graceful-shutdown │ │ │ │ └── server.go │ │ │ ├── hello-world │ │ │ │ └── server.go │ │ │ ├── http2 │ │ │ │ ├── cert.pem │ │ │ │ ├── key.pem │ │ │ │ └── server.go │ │ │ ├── jsonp │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── server.go │ │ │ ├── jwt │ │ │ │ ├── custom-claims │ │ │ │ │ └── server.go │ │ │ │ └── map-claims │ │ │ │ │ └── server.go │ │ │ ├── middleware │ │ │ │ └── server.go │ │ │ ├── streaming-response │ │ │ │ └── server.go │ │ │ ├── subdomains │ │ │ │ └── server.go │ │ │ └── websocket │ │ │ │ ├── gorilla │ │ │ │ └── server.go │ │ │ │ ├── net │ │ │ │ └── server.go │ │ │ │ └── public │ │ │ │ └── index.html │ │ ├── response.go │ │ ├── router.go │ │ ├── router_test.go │ │ └── website │ │ │ ├── Makefile │ │ │ ├── config.json │ │ │ ├── content │ │ │ ├── godoc │ │ │ │ ├── echo.md │ │ │ │ └── middleware.md │ │ │ ├── guide.md │ │ │ ├── guide │ │ │ │ ├── context.md │ │ │ │ ├── cookies.md │ │ │ │ ├── customization.md │ │ │ │ ├── error-handling.md │ │ │ │ ├── faq.md │ │ │ │ ├── installation.md │ │ │ │ ├── migration.md │ │ │ │ ├── request.md │ │ │ │ ├── routing.md │ │ │ │ ├── static-files.md │ │ │ │ ├── templates.md │ │ │ │ └── testing.md │ │ │ ├── middleware.md │ │ │ ├── middleware │ │ │ │ ├── basic-auth.md │ │ │ │ ├── body-limit.md │ │ │ │ ├── cors.md │ │ │ │ ├── csrf.md │ │ │ │ ├── gzip.md │ │ │ │ ├── jwt.md │ │ │ │ ├── logger.md │ │ │ │ ├── method-override.md │ │ │ │ ├── recover.md │ │ │ │ ├── redirect.md │ │ │ │ ├── secure.md │ │ │ │ └── trailing-slash.md │ │ │ ├── recipes.md │ │ │ ├── recipes │ │ │ │ ├── cors.md │ │ │ │ ├── crud.md │ │ │ │ ├── embed-resources.md │ │ │ │ ├── file-upload.md │ │ │ │ ├── google-app-engine.md │ │ │ │ ├── graceful-shutdown.md │ │ │ │ ├── hello-world.md │ │ │ │ ├── http2.md │ │ │ │ ├── jsonp.md │ │ │ │ ├── jwt.md │ │ │ │ ├── middleware.md │ │ │ │ ├── streaming-response.md │ │ │ │ ├── subdomains.md │ │ │ │ └── websocket.md │ │ │ └── support-echo.md │ │ │ ├── data │ │ │ └── index.toml │ │ │ ├── layouts │ │ │ ├── _default │ │ │ │ └── single.html │ │ │ ├── index.html │ │ │ ├── partials │ │ │ │ ├── ad.html │ │ │ │ ├── connect.html │ │ │ │ ├── footer.html │ │ │ │ ├── head.html │ │ │ │ ├── navbar.html │ │ │ │ ├── notice.html │ │ │ │ ├── search.html │ │ │ │ ├── share.html │ │ │ │ └── sidenav.html │ │ │ └── shortcodes │ │ │ │ ├── embed.html │ │ │ │ └── source.html │ │ │ └── static │ │ │ ├── images │ │ │ ├── echo_terminal.png │ │ │ └── logo.png │ │ │ ├── robots.txt │ │ │ ├── scripts │ │ │ └── main.js │ │ │ └── styles │ │ │ └── main.css │ └── gommon │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bytes │ │ ├── README.md │ │ ├── bytes.go │ │ └── bytes_test.go │ │ ├── color │ │ ├── README.md │ │ ├── color.go │ │ └── color_test.go │ │ ├── glide.lock │ │ ├── glide.yaml │ │ ├── gommon.go │ │ ├── log │ │ ├── README.md │ │ ├── color.go │ │ ├── log.go │ │ ├── log_test.go │ │ └── white.go │ │ └── random │ │ ├── random.go │ │ └── random_test.go ├── mattn │ ├── go-colorable │ │ ├── README.md │ │ ├── colorable_others.go │ │ └── colorable_windows.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.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 ├── rsc │ └── letsencrypt │ │ ├── LICENSE │ │ ├── README │ │ ├── lets.go │ │ └── vendor │ │ ├── github.com │ │ └── xenolf │ │ │ └── lego │ │ │ ├── LICENSE │ │ │ └── acme │ │ │ ├── challenges.go │ │ │ ├── client.go │ │ │ ├── client_test.go │ │ │ ├── crypto.go │ │ │ ├── crypto_test.go │ │ │ ├── error.go │ │ │ ├── http.go │ │ │ ├── http_challenge.go │ │ │ ├── http_challenge_server.go │ │ │ ├── http_challenge_test.go │ │ │ ├── http_test.go │ │ │ ├── jws.go │ │ │ ├── messages.go │ │ │ ├── provider.go │ │ │ ├── tls_sni_challenge.go │ │ │ ├── tls_sni_challenge_server.go │ │ │ ├── tls_sni_challenge_test.go │ │ │ ├── utils.go │ │ │ └── utils_test.go │ │ └── vendor.json ├── tylerb │ └── graceful │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── graceful.go │ │ ├── graceful_test.go │ │ ├── http2_test.go │ │ ├── keepalive_listener.go │ │ ├── limit_listen.go │ │ ├── signal.go │ │ ├── signal_appengine.go │ │ ├── test-fixtures │ │ ├── cert.crt │ │ └── key.pem │ │ └── tests │ │ └── main.go └── valyala │ └── fasttemplate │ ├── LICENSE │ ├── README.md │ ├── example_test.go │ ├── template.go │ ├── template_test.go │ └── timing_test.go ├── golang.org └── x │ ├── crypto │ └── ocsp │ │ ├── ocsp.go │ │ └── ocsp_test.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 │ │ ├── encoding.go │ │ ├── encoding_test.go │ │ ├── example_test.go │ │ ├── ianaindex │ │ │ ├── example_test.go │ │ │ └── ianaindex.go │ │ ├── internal │ │ │ ├── identifier │ │ │ │ ├── gen.go │ │ │ │ ├── identifier.go │ │ │ │ └── mib.go │ │ │ └── internal.go │ │ └── simplifiedchinese │ │ │ ├── all.go │ │ │ ├── all_test.go │ │ │ ├── gbk.go │ │ │ ├── hzgb2312.go │ │ │ ├── maketables.go │ │ │ └── tables.go │ └── transform │ │ ├── examples_test.go │ │ ├── transform.go │ │ └── transform_test.go │ └── time │ └── rate │ ├── rate.go │ └── rate_test.go ├── gopkg.in ├── mgo.v2 │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── auth.go │ ├── auth_test.go │ ├── bson │ │ ├── LICENSE │ │ ├── bson.go │ │ ├── bson_test.go │ │ ├── decimal.go │ │ ├── decimal_test.go │ │ ├── decode.go │ │ ├── encode.go │ │ ├── json.go │ │ ├── json_test.go │ │ ├── specdata │ │ │ └── update.sh │ │ └── specdata_test.go │ ├── bulk.go │ ├── bulk_test.go │ ├── cluster.go │ ├── cluster_test.go │ ├── dbtest │ │ ├── dbserver.go │ │ ├── dbserver_test.go │ │ └── export_test.go │ ├── doc.go │ ├── export_test.go │ ├── gridfs.go │ ├── gridfs_test.go │ ├── harness │ │ ├── certs │ │ │ ├── client.crt │ │ │ ├── client.key │ │ │ ├── client.pem │ │ │ ├── client.req │ │ │ ├── server.crt │ │ │ ├── server.key │ │ │ └── server.pem │ │ ├── daemons │ │ │ ├── .env │ │ │ ├── cfg1 │ │ │ │ ├── db │ │ │ │ │ ├── .empty │ │ │ │ │ ├── journal │ │ │ │ │ │ └── tempLatencyTest │ │ │ │ │ └── mongod.lock │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── cfg2 │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── cfg3 │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── db1 │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── db2 │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── db3 │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs1a │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs1b │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs1c │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs2a │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs2b │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs2c │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs3a │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs3b │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs3c │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── rs4a │ │ │ │ ├── db │ │ │ │ │ └── .empty │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── s1 │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ ├── s2 │ │ │ │ ├── log │ │ │ │ │ └── run │ │ │ │ └── run │ │ │ └── s3 │ │ │ │ ├── log │ │ │ │ └── run │ │ │ │ └── run │ │ ├── mongojs │ │ │ ├── dropall.js │ │ │ ├── init.js │ │ │ └── wait.js │ │ └── setup.sh │ ├── internal │ │ ├── json │ │ │ ├── LICENSE │ │ │ ├── bench_test.go │ │ │ ├── decode.go │ │ │ ├── decode_test.go │ │ │ ├── encode.go │ │ │ ├── encode_test.go │ │ │ ├── example_test.go │ │ │ ├── extension.go │ │ │ ├── extension_test.go │ │ │ ├── fold.go │ │ │ ├── fold_test.go │ │ │ ├── indent.go │ │ │ ├── number_test.go │ │ │ ├── scanner.go │ │ │ ├── scanner_test.go │ │ │ ├── stream.go │ │ │ ├── stream_test.go │ │ │ ├── tagkey_test.go │ │ │ ├── tags.go │ │ │ ├── tags_test.go │ │ │ └── testdata │ │ │ │ └── code.json.gz │ │ ├── sasl │ │ │ ├── sasl.c │ │ │ ├── sasl.go │ │ │ ├── sasl_windows.c │ │ │ ├── sasl_windows.go │ │ │ ├── sasl_windows.h │ │ │ ├── sspi_windows.c │ │ │ └── sspi_windows.h │ │ └── scram │ │ │ ├── scram.go │ │ │ └── scram_test.go │ ├── log.go │ ├── queue.go │ ├── queue_test.go │ ├── raceoff.go │ ├── raceon.go │ ├── saslimpl.go │ ├── saslstub.go │ ├── server.go │ ├── session.go │ ├── session_test.go │ ├── socket.go │ ├── stats.go │ ├── suite_test.go │ ├── syscall_test.go │ ├── syscall_windows_test.go │ └── txn │ │ ├── chaos.go │ │ ├── debug.go │ │ ├── dockey_test.go │ │ ├── flusher.go │ │ ├── output.txt │ │ ├── sim_test.go │ │ ├── tarjan.go │ │ ├── tarjan_test.go │ │ ├── txn.go │ │ └── txn_test.go └── square │ └── go-jose.v1 │ ├── .gitcookies.sh.enc │ ├── .travis.yml │ ├── BUG-BOUNTY.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── asymmetric.go │ ├── asymmetric_test.go │ ├── cipher │ ├── cbc_hmac.go │ ├── cbc_hmac_test.go │ ├── concat_kdf.go │ ├── concat_kdf_test.go │ ├── ecdh_es.go │ ├── ecdh_es_test.go │ ├── key_wrap.go │ └── key_wrap_test.go │ ├── crypter.go │ ├── crypter_test.go │ ├── doc.go │ ├── doc_test.go │ ├── encoding.go │ ├── encoding_test.go │ ├── jose-util │ ├── README.md │ ├── jose-util.t │ └── main.go │ ├── json │ ├── LICENSE │ ├── README.md │ ├── bench_test.go │ ├── decode.go │ ├── decode_test.go │ ├── encode.go │ ├── encode_test.go │ ├── indent.go │ ├── number_test.go │ ├── scanner.go │ ├── scanner_test.go │ ├── stream.go │ ├── stream_test.go │ ├── tagkey_test.go │ ├── tags.go │ ├── tags_test.go │ └── testdata │ │ └── code.json.gz │ ├── json_fork_test.go │ ├── jwe.go │ ├── jwe_test.go │ ├── jwk.go │ ├── jwk_test.go │ ├── jws.go │ ├── jws_test.go │ ├── shared.go │ ├── signing.go │ ├── signing_test.go │ ├── symmetric.go │ ├── symmetric_test.go │ ├── utils.go │ └── utils_test.go ├── interfacer ├── iconn.go ├── iplayer.go ├── iproto.go └── iroom.go ├── lib ├── csv │ ├── bench_test.go │ ├── cfield.go │ ├── csv.go │ ├── csv_test.go │ ├── decode.go │ ├── decode_test.go │ ├── encode.go │ ├── encode_test.go │ ├── example_marshal_test.go │ └── example_test.go ├── event │ ├── event.go │ └── event_test.go ├── imageserver │ ├── file.go │ └── imageserver.go ├── iplocation │ ├── iplocation.go │ └── iplocation_test.go ├── rpc │ ├── rpc.go │ └── rpc_test.go ├── socket │ ├── connection.go │ ├── hub.go │ ├── net.go │ ├── packet.go │ ├── proxy.go │ └── proxy_test.go └── utils │ ├── aes.go │ ├── array.go │ ├── array_test.go │ ├── debug.go │ ├── helper.go │ ├── list.go │ ├── map.go │ ├── map_list_test.go │ ├── queue.go │ ├── random.go │ ├── structandmap.go │ ├── timer_queue.go │ ├── utils.go │ ├── utils_test.go │ └── xxtea.go ├── protocol ├── coin.pb.go ├── conf.pb.go ├── error.pb.go ├── login.pb.go ├── postbox.pb.go ├── room.pb.go ├── socialroom.pb.go ├── sys.pb.go ├── user.pb.go └── vo.pb.go ├── robot.go ├── robots ├── data_robot.go ├── recv.go ├── robot.go ├── robots.go └── sender.go └── server.go /README.md: -------------------------------------------------------------------------------- 1 | golang实现的浙江兰溪麻将服务器 2 | -------------------------------------------------------------------------------- /bin/assets/UI/0x00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x00.png -------------------------------------------------------------------------------- /bin/assets/UI/0x01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x01.png -------------------------------------------------------------------------------- /bin/assets/UI/0x02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x02.png -------------------------------------------------------------------------------- /bin/assets/UI/0x03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x03.png -------------------------------------------------------------------------------- /bin/assets/UI/0x04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x04.png -------------------------------------------------------------------------------- /bin/assets/UI/0x05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x05.png -------------------------------------------------------------------------------- /bin/assets/UI/0x06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x06.png -------------------------------------------------------------------------------- /bin/assets/UI/0x07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x07.png -------------------------------------------------------------------------------- /bin/assets/UI/0x08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x08.png -------------------------------------------------------------------------------- /bin/assets/UI/0x09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x09.png -------------------------------------------------------------------------------- /bin/assets/UI/0x11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x11.png -------------------------------------------------------------------------------- /bin/assets/UI/0x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x12.png -------------------------------------------------------------------------------- /bin/assets/UI/0x13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x13.png -------------------------------------------------------------------------------- /bin/assets/UI/0x14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x14.png -------------------------------------------------------------------------------- /bin/assets/UI/0x15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x15.png -------------------------------------------------------------------------------- /bin/assets/UI/0x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x16.png -------------------------------------------------------------------------------- /bin/assets/UI/0x17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x17.png -------------------------------------------------------------------------------- /bin/assets/UI/0x18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x18.png -------------------------------------------------------------------------------- /bin/assets/UI/0x19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x19.png -------------------------------------------------------------------------------- /bin/assets/UI/0x21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x21.png -------------------------------------------------------------------------------- /bin/assets/UI/0x22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x22.png -------------------------------------------------------------------------------- /bin/assets/UI/0x23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x23.png -------------------------------------------------------------------------------- /bin/assets/UI/0x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x24.png -------------------------------------------------------------------------------- /bin/assets/UI/0x25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x25.png -------------------------------------------------------------------------------- /bin/assets/UI/0x26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x26.png -------------------------------------------------------------------------------- /bin/assets/UI/0x27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x27.png -------------------------------------------------------------------------------- /bin/assets/UI/0x28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x28.png -------------------------------------------------------------------------------- /bin/assets/UI/0x29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x29.png -------------------------------------------------------------------------------- /bin/assets/UI/0x41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x41.png -------------------------------------------------------------------------------- /bin/assets/UI/0x42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x42.png -------------------------------------------------------------------------------- /bin/assets/UI/0x43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x43.png -------------------------------------------------------------------------------- /bin/assets/UI/0x44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x44.png -------------------------------------------------------------------------------- /bin/assets/UI/0x51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x51.png -------------------------------------------------------------------------------- /bin/assets/UI/0x52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x52.png -------------------------------------------------------------------------------- /bin/assets/UI/0x53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/assets/UI/0x53.png -------------------------------------------------------------------------------- /bin/config.toml: -------------------------------------------------------------------------------- 1 | # 游戏配置 2 | 3 | # ____ __ _ 4 | # / ___|___ _ __ / _(_) __ _ 5 | # | | / _ \| '_ \| |_| |/ _` | 6 | # | |__| (_) | | | | _| | (_| | 7 | # \____\___/|_| |_|_| |_|\__, | 8 | # |___/ 9 | 10 | Operate_timeout=10 # 玩家牌局出牌碰牌等操作超时,单位秒 11 | Trusteeship_timeout=1 # 玩家托管出牌超时,单位秒 12 | 13 | Db_addr="120.77.175.1:27017" # 数据库地址 14 | Server_port=":8005" # 逻辑服端口 15 | Server_ip="127.0.0.1" # 本逻辑服的IP地址 16 | Oprof_port=":9005" 17 | Web_port=":8086" 18 | Pay_port=":7005" 19 | Pay_wx_pattern="/mahjong/wxpay/notice" 20 | Share_addr="http://yiiyu.cn/lanxi/wechat/download" 21 | 22 | Server_id=9 # 本逻辑服的唯一编号 23 | Version="1.0.1" 24 | AdminPort = ":7229" # 管理接口 25 | 26 | # 可选买子数量 27 | SelectMaiziCt = [0,1,2,3,4,5,6,7,8,9,10] 28 | # 可选牌局数量 29 | SelectGameCountCt = [8,16,1000] 30 | 31 | # 房卡价格 32 | Price = [1,2] 33 | # 底分 34 | Ante = 2 35 | -------------------------------------------------------------------------------- /bin/csv/shop.csv: -------------------------------------------------------------------------------- 1 | id,propid,number,paymenttype,price,original,hot 2 | 1,4,12,1,6,60,0 3 | 2,4,58,1,18,120,0 4 | 3,4,148,1,38,300,1 5 | 4,4,418,1,88,980,0 6 | 5,4,888,1,168,2980,0 7 | 6,1,12000,2,10,10000,0 8 | 7,1,63000,2,50,60000,0 9 | 8,1,260000,2,200,200000,1 10 | 9,1,672000,2,500,600000,0 11 | 10,1,1380000,2,1000,1200000,0 12 | 11,14,7,2,70,7,0 13 | 12,14,30,2,300,30,0 14 | 13,14,90,2,900,90,0 15 | 14,4,1998,1,328,2980,0 16 | -------------------------------------------------------------------------------- /bin/csv/test_patterns.csv: -------------------------------------------------------------------------------- 1 | cards,value,fan,name 2 | "1, 1 ,3, 3, 6, 6, 40, 40, 41 ,41, 65 ,65 ,66, 66",128,, 3 | -------------------------------------------------------------------------------- /bin/upx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/bin/upx.exe -------------------------------------------------------------------------------- /build-linux.bat: -------------------------------------------------------------------------------- 1 | set GOPATH=E:\lanxi-mahjong-server\trunk 2 | set GOARCH=amd64 3 | set GOOS=linux 4 | cd bin 5 | 6 | go build -o server -ldflags "-X main.VERSION=1.0.4 -X 'main.BUILD_TIME=`date`' -s -w" ../src/server.go 7 | go build -o robot -ldflags "-w -s" ../src/robot.go 8 | 9 | 10 | pause 11 | 12 | 13 | -------------------------------------------------------------------------------- /build-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export GOPATH=`pwd` 3 | export GOARCH=amd64 4 | export GOOS=linux 5 | cd bin 6 | 7 | go build -o server -ldflags "-X main.VERSION=1.0.4 -X 'main.BUILD_TIME=`date`' -s -w" ../src/server.go 8 | go build -o robot -ldflags "-w -s" ../src/robot.go 9 | 10 | upx -9 server 11 | upx -9 robot 12 | 13 | read -p "Press any key to continue." var 14 | 15 | 16 | -------------------------------------------------------------------------------- /protocol/coin.proto: -------------------------------------------------------------------------------- 1 | // 约定:首字母为C是客户端请求协议,首字母为S是服务器返回协议,其他为嵌套结构体 2 | package protocol; 3 | // 更新玩家的金币等经济资源,当玩家的经济资源任何时候有变动,服务器主动推送 4 | message SResource 5 | { 6 | optional uint32 code = 1 [default = 5000];//协议号 7 | repeated ResVo list = 2; 8 | } 9 | 10 | message ResVo 11 | { 12 | required uint32 id= 2; // 变动的资源唯一ID,一定物品道具表的唯一id,4:房卡 13 | required int32 count= 3; // 变动后的资源数量,即玩家当前资源数量 14 | 15 | } 16 | 17 | // 获取虚拟货币 18 | message CGetCurrency 19 | { 20 | optional uint32 code = 1 [default = 5001];//协议号 21 | } 22 | 23 | message SGetCurrency 24 | { 25 | optional uint32 code = 1 [default = 5001];//协议号 26 | required uint32 coin = 2;// 金币 27 | required uint32 diamond = 3;//钻石 28 | required uint32 exchange = 4;//兑换券 29 | required uint32 ticket = 5;//入场券 30 | required uint32 roomcard = 6;//房卡 31 | } 32 | -------------------------------------------------------------------------------- /protocol/conf.proto: -------------------------------------------------------------------------------- 1 | // 约定:首字母为C是客户端请求协议,首字母为S是服务器返回协议,其他为嵌套结构体 2 | // 全局属性 3 | package protocol; 4 | import "vo.proto"; 5 | 6 | // 获取游戏全局配置数据 7 | message CConfig 8 | { 9 | optional uint32 code = 1 [default = 4000];//协议号 10 | } 11 | message SConfig 12 | { 13 | optional uint32 code = 1 [default=4000];//协议号 14 | repeated RoomAttrube room= 2; //房间属性 15 | required SysConfig sys= 4; // 16 | optional uint32 error= 6 [default = 0]; // 错误码 17 | } 18 | // 系统配置 19 | message SysConfig { 20 | required string imageserver= 1; // 玩家头像图片服务器地址和端口 21 | required uint32 discardtimeout= 2; // 出牌超时时长(单位/秒) 22 | required string version= 3; // 版本号 23 | required string feedbackserver= 4; // 反馈截图服务器地址和端口 24 | required string shareaddr= 5; // 分享地址 25 | } 26 | -------------------------------------------------------------------------------- /protocol/generate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | protoc --go_out=../src/protocol *.proto 3 | -------------------------------------------------------------------------------- /protocol/generate.bat: -------------------------------------------------------------------------------- 1 | 2 | protoc --go_out=../src/protocol ./*.proto 3 | pause 4 | -------------------------------------------------------------------------------- /protocol/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./protoc --go_out=../src/protocol ./*.proto 3 | read -p "Press any key to continue." var 4 | -------------------------------------------------------------------------------- /protocol/protoc-gen-go.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/protocol/protoc-gen-go.exe -------------------------------------------------------------------------------- /protocol/protoc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/protocol/protoc.exe -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/cover/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Cover is a program for analyzing the coverage profiles generated by 7 | 'go test -coverprofile=cover.out'. 8 | 9 | Cover is also used by 'go test -cover' to rewrite the source code with 10 | annotations to track which parts of each function are executed. 11 | It operates on one Go source file at a time, computing approximate 12 | lib block information by studying the source. It is thus more portable 13 | than binary-rewriting coverage tools, but also a little less capable. 14 | For instance, it does not probe inside && and || expressions, and can 15 | be mildly confused by single statements with multiple function literals. 16 | 17 | For usage information, please see: 18 | go help testflag 19 | go tool cover -help 20 | */ 21 | package main 22 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/structtag.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 | // This file contains the test for canonical struct tags. 6 | 7 | package main 8 | 9 | import ( 10 | "go/ast" 11 | "reflect" 12 | "strconv" 13 | ) 14 | 15 | // checkField checks a struct field tag. 16 | func (f *File) checkCanonicalFieldTag(field *ast.Field) { 17 | if !vet("structtags") { 18 | return 19 | } 20 | if field.Tag == nil { 21 | return 22 | } 23 | 24 | tag, err := strconv.Unquote(field.Tag.Value) 25 | if err != nil { 26 | f.Badf(field.Pos(), "unable to read struct tag %s", field.Tag.Value) 27 | return 28 | } 29 | 30 | // Check tag for validity by appending 31 | // new key:value to end and checking that 32 | // the tag parsing code can find it. 33 | if reflect.StructTag(tag+` _gofix:"_magic"`).Get("_gofix") != "_magic" { 34 | f.Badf(field.Pos(), "struct field tag %s not compatible with reflect.StructTag.Get", field.Tag.Value) 35 | return 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/asm.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 ignore 6 | 7 | // This file contains declarations to test the assembly in test_asm.s. 8 | 9 | package testdata 10 | 11 | func arg1(x int8, y uint8) 12 | func arg2(x int16, y uint16) 13 | func arg4(x int32, y uint32) 14 | func arg8(x int64, y uint64) 15 | func argint(x int, y uint) 16 | func argptr(x *byte, y *byte, c chan int, m map[int]int, f func()) 17 | func argstring(x, y string) 18 | func argslice(x, y []string) 19 | func argiface(x interface{}, y interface { 20 | m() 21 | }) 22 | func returnint() int 23 | func returnbyte(x int) byte 24 | func returnnamed(x byte) (r1 int, r2 int16, r3 string, r4 byte) 25 | 26 | func noprof(x int) 27 | func dupok(x int) 28 | func nosplit(x int) 29 | func rodata(x int) 30 | func noptr(x int) 31 | func wrapper(x int) 32 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/asm4.s: -------------------------------------------------------------------------------- 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 amd64 6 | // +build vet_test 7 | 8 | // Test cases for symbolic NOSPLIT etc. on TEXT symbols. 9 | 10 | TEXT ·noprof(SB),NOPROF,$0-8 11 | RET 12 | 13 | TEXT ·dupok(SB),DUPOK,$0-8 14 | RET 15 | 16 | TEXT ·nosplit(SB),NOSPLIT,$0 17 | RET 18 | 19 | TEXT ·rodata(SB),RODATA,$0-8 20 | RET 21 | 22 | TEXT ·noptr(SB),NOPTR|NOSPLIT,$0 23 | RET 24 | 25 | TEXT ·wrapper(SB),WRAPPER,$0-8 26 | RET 27 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/assign.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 | // This file contains tests for the useless-assignment checker. 6 | 7 | package testdata 8 | 9 | type ST struct { 10 | x int 11 | } 12 | 13 | func (s *ST) SetX(x int) { 14 | // Accidental self-assignment; it should be "s.x = x" 15 | x = x // ERROR "self-assignment of x to x" 16 | // Another mistake 17 | s.x = s.x // ERROR "self-assignment of s.x to s.x" 18 | } 19 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/buildtag.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 | // This file contains tests for the buildtag checker. 6 | 7 | // +builder // ERROR "possible malformed \+build comment" 8 | // +build !ignore 9 | 10 | package testdata 11 | 12 | // +build toolate // ERROR "build comment appears too late in file" 13 | 14 | var _ = 3 15 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/buildtag_bad.go: -------------------------------------------------------------------------------- 1 | // This file contains misplaced or malformed build constraints. 2 | // The Go tool will skip it, because the constraints are invalid. 3 | // It serves only to test the tag checker during make test. 4 | 5 | // Mention +build // ERROR "possible malformed \+build comment" 6 | 7 | // +build !!bang // ERROR "invalid double negative in build constraint" 8 | // +build @#$ // ERROR "invalid non-alphanumeric build constraint" 9 | 10 | // +build toolate // ERROR "build comment appears too late in file" 11 | package bad 12 | 13 | // This is package 'bad' rather than 'main' so the erroneous build 14 | // tag doesn't end up looking like a package doc for the vet command 15 | // when examined by godoc. 16 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/method.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 | // This file contains tests for the canonical method checker. 6 | 7 | // This file contains the code to check canonical methods. 8 | 9 | package testdata 10 | 11 | import ( 12 | "fmt" 13 | ) 14 | 15 | type MethodTest int 16 | 17 | func (t *MethodTest) Scan(x fmt.ScanState, c byte) { // ERROR "should have signature Scan" 18 | } 19 | 20 | type MethodTestInterface interface { 21 | ReadByte() byte // ERROR "should have signature ReadByte" 22 | } 23 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/nilfunc.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 testdata 6 | 7 | func F() {} 8 | 9 | type T struct { 10 | F func() 11 | } 12 | 13 | func (T) M() {} 14 | 15 | var Fv = F 16 | 17 | func Comparison() { 18 | var t T 19 | var fn func() 20 | if fn == nil || Fv == nil || t.F == nil { 21 | // no error; these func vars or fields may be nil 22 | } 23 | if F == nil { // ERROR "comparison of function F == nil is always false" 24 | panic("can't happen") 25 | } 26 | if t.M == nil { // ERROR "comparison of function M == nil is always false" 27 | panic("can't happen") 28 | } 29 | if F != nil { // ERROR "comparison of function F != nil is always true" 30 | if t.M != nil { // ERROR "comparison of function M != nil is always true" 31 | return 32 | } 33 | } 34 | panic("can't happen") 35 | } 36 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/cmd/vet/testdata/structtag.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 | // This file contains tests for the structtag checker. 6 | 7 | // This file contains the test for canonical struct tags. 8 | 9 | package testdata 10 | 11 | type StructTagTest struct { 12 | X int "hello" // ERROR "not compatible with reflect.StructTag.Get" 13 | } 14 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/README: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 | The files in this directory constitute the continuous builder: 6 | 7 | app/: an AppEngine server 8 | builder/: gobuilder, a Go continuous build client 9 | 10 | If you wish to run a Go builder, please email golang-dev@googlegroups.com 11 | 12 | To run a builder: 13 | 14 | * Write the key ~gobuild/.gobuildkey 15 | You need to get it from someone who knows the key. 16 | You may also use a filename of the form .gobuildkey-$BUILDER if you 17 | wish to run builders for multiple targets. 18 | 19 | * Append your username and password googlecode.com credentials from 20 | https://code.google.com/hosting/settings 21 | to the buildkey file in the format "Username\nPassword\n". 22 | (This is for uploading tarballs to the project downloads section, 23 | and is an optional step.) 24 | 25 | * Build and run gobuilder (see its documentation for command-line options). 26 | 27 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/app.yaml: -------------------------------------------------------------------------------- 1 | # Update with 2 | # google_appengine/appcfg.py [-V test-build] update . 3 | # 4 | # Using -V test-build will run as test-build.golang.org. 5 | 6 | application: golang-org 7 | version: build 8 | runtime: go 9 | api_version: go1 10 | 11 | handlers: 12 | - url: /static 13 | static_dir: static 14 | - url: /(|gccgo/)log/.+ 15 | script: _go_app 16 | - url: /(|gccgo/)(|commit|packages|result|tag|todo) 17 | script: _go_app 18 | - url: /(|gccgo/)(init|buildtest|key|_ah/queue/go/delay) 19 | script: _go_app 20 | login: admin -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/build/init.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package build 8 | 9 | import ( 10 | "fmt" 11 | "net/http" 12 | 13 | "appengine" 14 | "appengine/datastore" 15 | "cache" 16 | ) 17 | 18 | func initHandler(w http.ResponseWriter, r *http.Request) { 19 | d := dashboardForRequest(r) 20 | c := d.Context(appengine.NewContext(r)) 21 | defer cache.Tick(c) 22 | for _, p := range d.Packages { 23 | err := datastore.Get(c, p.Key(c), new(Package)) 24 | if _, ok := err.(*datastore.ErrFieldMismatch); ok { 25 | // Some fields have been removed, so it's okay to ignore this error. 26 | err = nil 27 | } 28 | if err == nil { 29 | continue 30 | } else if err != datastore.ErrNoSuchEntity { 31 | logErr(w, r, err) 32 | return 33 | } 34 | if _, err := datastore.Put(c, p.Key(c), p); err != nil { 35 | logErr(w, r, err) 36 | return 37 | } 38 | } 39 | fmt.Fprint(w, "OK") 40 | } 41 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/build/notify.txt: -------------------------------------------------------------------------------- 1 | Change {{shortHash .Commit.Hash}} broke the {{.Builder}} build: 2 | http://{{.Hostname}}/log/{{.Result.LogHash}} 3 | 4 | {{.Commit.Desc}} 5 | 6 | http://code.google.com/p/go/source/detail?r={{shortHash .Commit.Hash}} 7 | 8 | $ tail -200 < log 9 | {{printf "%s" .Log.Text | tail 200}} 10 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/index.yaml: -------------------------------------------------------------------------------- 1 | indexes: 2 | 3 | - kind: Commit 4 | ancestor: yes 5 | properties: 6 | - name: Num 7 | direction: desc 8 | 9 | - kind: Commit 10 | ancestor: yes 11 | properties: 12 | - name: Time 13 | direction: desc 14 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/static/status_alert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/code.google.com/p/go.tools/dashboard/app/static/status_alert.gif -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/app/static/status_good.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/code.google.com/p/go.tools/dashboard/app/static/status_good.gif -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/dashboard/builder/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2009 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 | builder: $(shell ls *.go) 6 | go build -o $@ $^ 7 | 8 | clean: 9 | rm -f builder 10 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/go11.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 !go1.2 6 | 7 | package types 8 | 9 | import "go/ast" 10 | 11 | func slice3(x *ast.SliceExpr) bool { 12 | return false 13 | } 14 | 15 | func sliceMax(x *ast.SliceExpr) ast.Expr { 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/go12.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 go1.2 6 | 7 | package types 8 | 9 | import "go/ast" 10 | 11 | func slice3(x *ast.SliceExpr) bool { 12 | return x.Slice3 13 | } 14 | 15 | func sliceMax(x *ast.SliceExpr) ast.Expr { 16 | return x.Max 17 | } 18 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/objset.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 | // This file implements objsets. 6 | // 7 | // An objset is similar to a Scope but objset elements 8 | // are identified by their unique id, instead of their 9 | // object name. 10 | 11 | package types 12 | 13 | // An objset is a set of objects identified by their unique id. 14 | // The zero value for objset is a ready-to-use empty objset. 15 | type objset map[string]Object // initialized lazily 16 | 17 | // insert attempts to insert an object obj into objset s. 18 | // If s already contains an alternative object alt with 19 | // the same name, insert leaves s unchanged and returns alt. 20 | // Otherwise it inserts obj and returns nil. 21 | func (s *objset) insert(obj Object) Object { 22 | id := obj.Id() 23 | if alt := (*s)[id]; alt != nil { 24 | return alt 25 | } 26 | if *s == nil { 27 | *s = make(map[string]Object) 28 | } 29 | (*s)[id] = obj 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/testdata/cycles2.src: -------------------------------------------------------------------------------- 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 p 6 | 7 | // Test case for issue 5090 8 | 9 | type t interface { 10 | f(u) 11 | } 12 | 13 | type u interface { 14 | t 15 | } 16 | 17 | func _() { 18 | var t t 19 | var u u 20 | 21 | t.f(t) 22 | t.f(u) 23 | 24 | u.f(t) 25 | u.f(u) 26 | } 27 | 28 | 29 | // Test case for issue 6589. 30 | 31 | type A interface { 32 | a() interface { 33 | AB 34 | } 35 | } 36 | 37 | type B interface { 38 | a() interface { 39 | AB 40 | } 41 | } 42 | 43 | type AB interface { 44 | a() interface { 45 | A 46 | B /* ERROR a redeclared */ 47 | } 48 | b() interface { 49 | A 50 | B /* ERROR a redeclared */ 51 | } 52 | } 53 | 54 | var x AB 55 | var y interface { 56 | A 57 | B /* ERROR a redeclared */ 58 | } 59 | var _ = x /* ERROR cannot compare */ == y 60 | 61 | 62 | // Test case for issue 6638. 63 | 64 | type T /* ERROR cycle */ interface { 65 | m() [T /* ERROR no field or method */ (nil).m()[0]]int 66 | } 67 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/testdata/cycles3.src: -------------------------------------------------------------------------------- 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 p 6 | 7 | import "unsafe" 8 | 9 | var ( 10 | _ A = A(nil).a().b().c().d().e().f() 11 | _ A = A(nil).b().c().d().e().f() 12 | _ A = A(nil).c().d().e().f() 13 | _ A = A(nil).d().e().f() 14 | _ A = A(nil).e().f() 15 | _ A = A(nil).f() 16 | _ A = A(nil) 17 | ) 18 | 19 | type ( 20 | A interface { 21 | a() B 22 | B 23 | } 24 | 25 | B interface { 26 | b() C 27 | C 28 | } 29 | 30 | C interface { 31 | c() D 32 | D 33 | } 34 | 35 | D interface { 36 | d() E 37 | E 38 | } 39 | 40 | E interface { 41 | e() F 42 | F 43 | } 44 | 45 | F interface { 46 | f() A 47 | } 48 | ) 49 | 50 | type ( 51 | U /* ERROR illegal cycle */ interface { 52 | V 53 | } 54 | 55 | V interface { 56 | v() [unsafe.Sizeof(u)]int 57 | } 58 | ) 59 | 60 | var u U 61 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/go/types/testdata/expr1.src: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // binary expressions 6 | 7 | package expr1 8 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/bake.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2013 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | 6 | set -e 7 | 8 | STATIC=" 9 | codewalk.html 10 | codewalkdir.html 11 | dirlist.html 12 | error.html 13 | example.html 14 | godoc.html 15 | godocs.js 16 | jquery.js 17 | opensearch.xml 18 | package.html 19 | package.txt 20 | play.js 21 | playground.js 22 | search.html 23 | search.txt 24 | style.css 25 | " 26 | 27 | go run bake.go $STATIC | gofmt > static.go 28 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/codewalkdir.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | {{range .}} 9 | 10 | {{$name_html := html .Name}} 11 | 12 | 13 | 14 | 15 | {{end}} 16 |
{{$name_html}} {{html .Title}}
17 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/dirlist.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {{range .}} 20 | 21 | {{$name_html := fileInfoName . | html}} 22 | 23 | 24 | 25 | 26 | 27 | 28 | {{end}} 29 | 30 |
File Bytes Modified
..
{{$name_html}}{{html .Size}}{{fileInfoTime . | html}}
31 |

32 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package static exports a map of static file content that supports the godoc 6 | // user interface. The map should be used with the mapfs package, see 7 | // code.google.com/p/godoc/vfs/mapfs. 8 | package static 9 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/error.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

8 | {{html .}} 9 |

10 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/example.html: -------------------------------------------------------------------------------- 1 |
2 | 5 |
6 |

Example{{example_suffix .Name}}

7 | {{with .Doc}}

{{html .}}

{{end}} 8 | {{$output := .Output}} 9 | {{with .Play}} 10 |
11 |
12 |
{{html $output}}
13 |
14 | Run 15 | Format 16 | 17 |
18 |
19 | {{else}} 20 |

Code:

21 |
{{.Code}}
22 | {{with .Output}} 23 |

Output:

24 |
{{html .}}
25 | {{end}} 26 | {{end}} 27 |
28 |
29 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/godoc/static/opensearch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | godoc 4 | The Go Programming Language 5 | go golang 6 | 7 | 8 | /favicon.ico 9 | UTF-8 10 | UTF-8 11 | 12 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/importer/testdata/a.go: -------------------------------------------------------------------------------- 1 | package P 2 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/importer/testdata/b.go: -------------------------------------------------------------------------------- 1 | package P 2 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/lib/lib.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | type Type int 4 | 5 | func (Type) Method(x *int) *int { 6 | return x 7 | } 8 | 9 | func Func() { 10 | } 11 | 12 | const Const = 3 13 | 14 | var Var = 0 15 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/callgraph-json.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of call-graph queries, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See callgraph-json.golden for expected query results. 6 | 7 | func A() {} 8 | 9 | func B() {} 10 | 11 | // call is not (yet) treated context-sensitively. 12 | func call(f func()) { 13 | f() 14 | } 15 | 16 | // nop *is* treated context-sensitively. 17 | func nop() {} 18 | 19 | func call2(f func()) { 20 | f() 21 | f() 22 | } 23 | 24 | func main() { 25 | call(A) 26 | call(B) 27 | 28 | nop() 29 | nop() 30 | 31 | call2(func() { 32 | // called twice from main.call2, 33 | // but call2 is not context sensitive (yet). 34 | }) 35 | 36 | print("builtin") 37 | _ = string("type conversion") 38 | call(nil) 39 | if false { 40 | main() 41 | } 42 | var nilFunc func() 43 | nilFunc() 44 | var i interface { 45 | f() 46 | } 47 | i.f() 48 | } 49 | 50 | func deadcode() { 51 | main() 52 | } 53 | 54 | // @callgraph callgraph "^" 55 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/callgraph.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of call-graph queries. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See callgraph.golden for expected query results. 6 | 7 | func A() {} 8 | 9 | func B() {} 10 | 11 | // call is not (yet) treated context-sensitively. 12 | func call(f func()) { 13 | f() 14 | } 15 | 16 | // nop *is* treated context-sensitively. 17 | func nop() {} 18 | 19 | func call2(f func()) { 20 | f() 21 | f() 22 | } 23 | 24 | func main() { 25 | call(A) 26 | call(B) 27 | 28 | nop() 29 | nop() 30 | 31 | call2(func() { 32 | // called twice from main.call2, 33 | // but call2 is not context sensitive (yet). 34 | }) 35 | 36 | print("builtin") 37 | _ = string("type conversion") 38 | call(nil) 39 | if false { 40 | main() 41 | } 42 | var nilFunc func() 43 | nilFunc() 44 | var i interface { 45 | f() 46 | } 47 | i.f() 48 | } 49 | 50 | func deadcode() { 51 | main() 52 | } 53 | 54 | // @callgraph callgraph "^" 55 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/callgraph.golden: -------------------------------------------------------------------------------- 1 | -------- @callgraph callgraph -------- 2 | 3 | Below is a call graph of the entire program. 4 | The numbered nodes form a spanning tree. 5 | Non-numbered nodes indicate back- or cross-edges to the node whose 6 | number follows in parentheses. 7 | 8 | 0 9 | 1 main.init 10 | 2 main.main 11 | 3 main.call 12 | 4 main.A 13 | 5 main.B 14 | 6 main.call2 15 | 7 func@31.8 16 | 8 main.nop 17 | 18 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/callgraph2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of call-graph queries. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See callgraph2.golden for expected query results. 6 | 7 | // (Regression test for pointer analysis: programs that use reflection 8 | // create some cgnodes before the root of the callgraph.) 9 | import _ "reflect" 10 | 11 | func f() {} 12 | func main() { 13 | f() 14 | } 15 | 16 | // @callgraph callgraph "^" 17 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/callgraph2.golden: -------------------------------------------------------------------------------- 1 | -------- @callgraph callgraph -------- 2 | 3 | Below is a call graph of the entire program. 4 | The numbered nodes form a spanning tree. 5 | Non-numbered nodes indicate back- or cross-edges to the node whose 6 | number follows in parentheses. 7 | 8 | 0 9 | 1 main.init 10 | 2 reflect.init 11 | 3 main.main 12 | 4 main.f 13 | 14 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/calls-json.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of call-graph queries, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See calls-json.golden for expected query results. 6 | 7 | func call(f func()) { 8 | f() // @callees @callees-f "f" 9 | } 10 | 11 | func main() { 12 | call(func() { 13 | // @callers callers-main.anon "^" 14 | // @callstack callstack-main.anon "^" 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/calls-json.golden: -------------------------------------------------------------------------------- 1 | -------- @callees @callees-f -------- 2 | { 3 | "mode": "callees", 4 | "callees": { 5 | "pos": "testdata/src/main/calls-json.go:8:3", 6 | "desc": "dynamic function call", 7 | "callees": [ 8 | { 9 | "name": "func@12.7", 10 | "pos": "testdata/src/main/calls-json.go:12:7" 11 | } 12 | ] 13 | } 14 | }-------- @callstack callstack-main.anon -------- 15 | { 16 | "mode": "callstack", 17 | "callstack": { 18 | "pos": "testdata/src/main/calls-json.go:12:7", 19 | "target": "func@12.7", 20 | "callers": [ 21 | { 22 | "pos": "testdata/src/main/calls-json.go:8:3", 23 | "desc": "dynamic function call", 24 | "caller": "main.call" 25 | }, 26 | { 27 | "pos": "testdata/src/main/calls-json.go:12:6", 28 | "desc": "static function call", 29 | "caller": "main.main" 30 | } 31 | ] 32 | } 33 | } -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/describe-json.go: -------------------------------------------------------------------------------- 1 | package describe // @describe pkgdecl "describe" 2 | 3 | // Tests of 'describe' query, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See describe-json.golden for expected query results. 6 | 7 | func main() { // 8 | var s struct{ x [3]int } 9 | p := &s.x[0] // @describe desc-val-p "p" 10 | _ = p 11 | 12 | var i I = C(0) 13 | if i == nil { 14 | i = new(D) 15 | } 16 | print(i) // @describe desc-val-i "\\bi\\b" 17 | 18 | go main() // @describe desc-stmt "go" 19 | } 20 | 21 | type I interface { 22 | f() 23 | } 24 | 25 | type C int // @describe desc-type-C "C" 26 | type D struct{} 27 | 28 | func (c C) f() {} 29 | func (d *D) f() {} 30 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/freevars.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of 'freevars' query. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See freevars.golden for expected query results. 6 | 7 | // TODO(adonovan): it's hard to test this query in a single line of gofmt'd code. 8 | 9 | type T struct { 10 | a, b int 11 | } 12 | 13 | type S struct { 14 | x int 15 | t T 16 | } 17 | 18 | func f(int) {} 19 | 20 | func main() { 21 | type C int 22 | x := 1 23 | const exp = 6 24 | if y := 2; x+y+int(C(3)) != exp { // @freevars fv1 "if.*{" 25 | panic("expected 6") 26 | } 27 | 28 | var s S 29 | 30 | for x, y := range "foo" { 31 | println(s.x + s.t.a + s.t.b + x + int(y)) // @freevars fv2 "print.*y." 32 | } 33 | 34 | f(x) // @freevars fv3 "f.x." 35 | 36 | // TODO(adonovan): enable when go/types supports labels. 37 | loop: // #@freevars fv-def-label "loop:" 38 | for { 39 | break loop // #@freevars fv-ref-label "break loop" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/freevars.golden: -------------------------------------------------------------------------------- 1 | -------- @freevars fv1 -------- 2 | Free identifiers: 3 | type C 4 | const exp int 5 | var x int 6 | 7 | -------- @freevars fv2 -------- 8 | Free identifiers: 9 | var s.t.a int 10 | var s.t.b int 11 | var s.x int 12 | var x int 13 | var y int32 14 | 15 | -------- @freevars fv3 -------- 16 | Free identifiers: 17 | var x int 18 | 19 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/implements-json.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of 'implements' query, -output=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See implements.golden for expected query results. 6 | 7 | func main() { 8 | } 9 | 10 | type E interface{} // @implements E "E" 11 | 12 | type F interface { // @implements F "F" 13 | f() 14 | } 15 | 16 | type FG interface { // @implements FG "FG" 17 | f() 18 | g() []int // @implements slice "..int" 19 | } 20 | 21 | type C int // @implements C "C" 22 | type D struct{} 23 | 24 | func (c *C) f() {} // @implements starC ".C" 25 | func (d D) f() {} // @implements D "D" 26 | 27 | func (d *D) g() []int { return nil } // @implements starD ".D" 28 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/implements.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of 'implements' query. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See implements.golden for expected query results. 6 | 7 | import _ "lib" 8 | import _ "sort" 9 | 10 | func main() { 11 | } 12 | 13 | type E interface{} // @implements E "E" 14 | 15 | type F interface { // @implements F "F" 16 | f() 17 | } 18 | 19 | type FG interface { // @implements FG "FG" 20 | f() 21 | g() []int // @implements slice "..int" 22 | } 23 | 24 | type C int // @implements C "C" 25 | type D struct{} 26 | 27 | func (c *C) f() {} // @implements starC ".C" 28 | func (d D) f() {} // @implements D "D" 29 | 30 | func (d *D) g() []int { return nil } // @implements starD ".D" 31 | 32 | type sorter []int // @implements sorter "sorter" 33 | 34 | func (sorter) Len() int { return 0 } 35 | func (sorter) Less(i, j int) bool { return false } 36 | func (sorter) Swap(i, j int) {} 37 | 38 | type I interface { // @implements I "I" 39 | Method(*int) *int 40 | } 41 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/imports.go: -------------------------------------------------------------------------------- 1 | package imports 2 | 3 | import ( 4 | "lib" // @describe ref-pkg-import "lib" 5 | ) 6 | 7 | // Tests that import another package. (To make the tests run quickly, 8 | // we avoid using imports in all the other tests. Remember, each 9 | // query causes parsing and typechecking of the whole program.) 10 | // 11 | // See go.tools/oracle/oracle_test.go for explanation. 12 | // See imports.golden for expected query results. 13 | 14 | var a int 15 | 16 | func main() { 17 | const c = lib.Const // @describe ref-const "Const" 18 | lib.Func() // @describe ref-func "Func" 19 | lib.Var++ // @describe ref-var "Var" 20 | var t lib.Type // @describe ref-type "Type" 21 | p := t.Method(&a) // @describe ref-method "Method" 22 | 23 | print(*p + 1) // @pointsto p "p " 24 | 25 | var _ lib.Type // @describe ref-pkg "lib" 26 | } 27 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/multi.go: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | func g(x int) { 4 | } 5 | 6 | func f() { 7 | x := 1 8 | g(x) // "g(x)" is the selection for multiple queries 9 | } 10 | 11 | func main() { 12 | f() 13 | } 14 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/peers-json.go: -------------------------------------------------------------------------------- 1 | package peers 2 | 3 | // Tests of channel 'peers' query, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See peers-json.golden for expected query results. 6 | 7 | func main() { 8 | chA := make(chan *int) 9 | <-chA 10 | select { 11 | case <-chA: // @peers peer-recv-chA "<-" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/peers-json.golden: -------------------------------------------------------------------------------- 1 | -------- @peers peer-recv-chA -------- 2 | { 3 | "mode": "peers", 4 | "peers": { 5 | "pos": "testdata/src/main/peers-json.go:11:7", 6 | "type": "chan *int", 7 | "allocs": [ 8 | "testdata/src/main/peers-json.go:8:13" 9 | ], 10 | "receives": [ 11 | "testdata/src/main/peers-json.go:9:2", 12 | "testdata/src/main/peers-json.go:11:7" 13 | ] 14 | } 15 | } -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/peers.go: -------------------------------------------------------------------------------- 1 | package peers 2 | 3 | // Tests of channel 'peers' query. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See peers.golden for expected query results. 6 | 7 | var a2 int 8 | 9 | func main() { 10 | chA := make(chan *int) 11 | a1 := 1 12 | chA <- &a1 13 | 14 | chA2 := make(chan *int, 2) 15 | if a2 == 0 { 16 | chA = chA2 17 | } 18 | 19 | chB := make(chan *int) 20 | b := 3 21 | chB <- &b 22 | 23 | <-chA // @pointsto pointsto-chA "chA" 24 | <-chA2 // @pointsto pointsto-chA2 "chA2" 25 | <-chB // @pointsto pointsto-chB "chB" 26 | 27 | select { 28 | case rA := <-chA: // @peers peer-recv-chA "<-" 29 | _ = rA // @pointsto pointsto-rA "rA" 30 | case rB := <-chB: // @peers peer-recv-chB "<-" 31 | _ = rB // @pointsto pointsto-rB "rB" 32 | 33 | case <-chA: // @peers peer-recv-chA' "<-" 34 | 35 | case chA2 <- &a2: // @peers peer-send-chA' "<-" 36 | } 37 | 38 | for _ = range chA { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/pointsto-json.go: -------------------------------------------------------------------------------- 1 | package pointsto 2 | 3 | // Tests of 'pointsto' queries, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See pointsto-json.golden for expected query results. 6 | 7 | func main() { // 8 | var s struct{ x [3]int } 9 | p := &s.x[0] // @pointsto val-p "p" 10 | _ = p 11 | 12 | var i I = C(0) 13 | if i == nil { 14 | i = new(D) 15 | } 16 | print(i) // @pointsto val-i "\\bi\\b" 17 | } 18 | 19 | type I interface { 20 | f() 21 | } 22 | 23 | type C int 24 | type D struct{} 25 | 26 | func (c C) f() {} 27 | func (d *D) f() {} 28 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/pointsto-json.golden: -------------------------------------------------------------------------------- 1 | -------- @pointsto val-p -------- 2 | { 3 | "mode": "pointsto", 4 | "pointsto": [ 5 | { 6 | "type": "*int", 7 | "labels": [ 8 | { 9 | "pos": "testdata/src/main/pointsto-json.go:8:6", 10 | "desc": "s.x[*]" 11 | } 12 | ] 13 | } 14 | ] 15 | }-------- @pointsto val-i -------- 16 | { 17 | "mode": "pointsto", 18 | "pointsto": [ 19 | { 20 | "type": "*D", 21 | "namepos": "testdata/src/main/pointsto-json.go:24:6", 22 | "labels": [ 23 | { 24 | "pos": "testdata/src/main/pointsto-json.go:14:10", 25 | "desc": "new" 26 | } 27 | ] 28 | }, 29 | { 30 | "type": "C", 31 | "namepos": "testdata/src/main/pointsto-json.go:23:6" 32 | } 33 | ] 34 | } -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/referrers-json.go: -------------------------------------------------------------------------------- 1 | package referrers 2 | 3 | // Tests of 'referrers' query. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See referrers.golden for expected query results. 6 | 7 | import "lib" 8 | 9 | type s struct { 10 | f int 11 | } 12 | 13 | func main() { 14 | var v lib.Type = lib.Const // @referrers ref-package "lib" 15 | _ = v.Method // @referrers ref-method "Method" 16 | _ = v.Method 17 | v++ //@referrers ref-local "v" 18 | v++ 19 | 20 | _ = s{}.f // @referrers ref-field "f" 21 | 22 | var s2 s 23 | s2.f = 1 24 | } 25 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/reflection.go: -------------------------------------------------------------------------------- 1 | package reflection 2 | 3 | // This is a test of 'pointsto', but we split it into a separate file 4 | // so that pointsto.go doesn't have to import "reflect" each time. 5 | 6 | import "reflect" 7 | 8 | var a int 9 | var b bool 10 | 11 | func main() { 12 | m := make(map[*int]*bool) 13 | m[&a] = &b 14 | 15 | mrv := reflect.ValueOf(m) 16 | if a > 0 { 17 | mrv = reflect.ValueOf(&b) 18 | } 19 | if a > 0 { 20 | mrv = reflect.ValueOf(&a) 21 | } 22 | 23 | _ = mrv // @pointsto mrv "mrv" 24 | p1 := mrv.Interface() // @pointsto p1 "p1" 25 | p2 := mrv.MapKeys() // @pointsto p2 "p2" 26 | p3 := p2[0] // @pointsto p3 "p3" 27 | p4 := reflect.TypeOf(p1) // @pointsto p4 "p4" 28 | 29 | _, _, _, _ = p1, p2, p3, p4 30 | } 31 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/reflection.golden: -------------------------------------------------------------------------------- 1 | -------- @pointsto mrv -------- 2 | this reflect.Value may contain these dynamic types: 3 | *bool, may point to: 4 | reflection.b 5 | *int, may point to: 6 | reflection.a 7 | map[*int]*bool, may point to: 8 | makemap 9 | 10 | -------- @pointsto p1 -------- 11 | this interface{} may contain these dynamic types: 12 | *bool, may point to: 13 | reflection.b 14 | *int, may point to: 15 | reflection.a 16 | map[*int]*bool, may point to: 17 | makemap 18 | 19 | -------- @pointsto p2 -------- 20 | this []reflect.Value may point to these objects: 21 | 22 | 23 | -------- @pointsto p3 -------- 24 | this reflect.Value may contain these dynamic types: 25 | *int, may point to: 26 | reflection.a 27 | 28 | -------- @pointsto p4 -------- 29 | this reflect.Type may contain these dynamic types: 30 | *reflect.rtype, may point to: 31 | *bool 32 | *int 33 | map[*int]*bool 34 | 35 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/what-json.go: -------------------------------------------------------------------------------- 1 | package what 2 | 3 | // Tests of 'what' queries, -format=json. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See what-json.golden for expected query results. 6 | 7 | func main() { 8 | f() // @what call "f" 9 | } 10 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/what-json.golden: -------------------------------------------------------------------------------- 1 | -------- @what call -------- 2 | { 3 | "mode": "what", 4 | "what": { 5 | "enclosing": [ 6 | { 7 | "desc": "identifier", 8 | "start": 179, 9 | "end": 180 10 | }, 11 | { 12 | "desc": "function call (or conversion)", 13 | "start": 179, 14 | "end": 182 15 | }, 16 | { 17 | "desc": "expression statement", 18 | "start": 179, 19 | "end": 182 20 | }, 21 | { 22 | "desc": "block", 23 | "start": 176, 24 | "end": 202 25 | }, 26 | { 27 | "desc": "function declaration", 28 | "start": 164, 29 | "end": 202 30 | }, 31 | { 32 | "desc": "source file", 33 | "start": 0, 34 | "end": 202 35 | } 36 | ], 37 | "modes": [ 38 | "callees", 39 | "callers", 40 | "callgraph", 41 | "callstack", 42 | "definition", 43 | "describe", 44 | "freevars", 45 | "implements", 46 | "pointsto", 47 | "referrers" 48 | ], 49 | "srcdir": "testdata/src", 50 | "importpath": "main" 51 | } 52 | } -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/oracle/testdata/src/main/what.go: -------------------------------------------------------------------------------- 1 | package what // @what pkgdecl "what" 2 | 3 | // Tests of 'what' queries. 4 | // See go.tools/oracle/oracle_test.go for explanation. 5 | // See what.golden for expected query results. 6 | 7 | func main() { 8 | f() // @what call "f" 9 | var ch chan int // @what var "var" 10 | <-ch // @what recv "ch" 11 | } 12 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/playground/appengine.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package playground 8 | 9 | import ( 10 | "net/http" 11 | 12 | "appengine" 13 | "appengine/urlfetch" 14 | ) 15 | 16 | func client(r *http.Request) *http.Client { 17 | return urlfetch.Client(appengine.NewContext(r)) 18 | } 19 | 20 | func report(r *http.Request, err error) { 21 | appengine.NewContext(r).Errorf("%v", err) 22 | } 23 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/playground/local.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | 7 | package playground 8 | 9 | import ( 10 | "log" 11 | "net/http" 12 | ) 13 | 14 | func client(r *http.Request) *http.Client { 15 | return http.DefaultClient 16 | } 17 | 18 | func report(r *http.Request, err error) { 19 | log.Println(err) 20 | } 21 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/another.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package main 4 | 5 | var unknown bool 6 | 7 | type S string 8 | 9 | func incr(x int) int { return x + 1 } 10 | 11 | func main() { 12 | var i interface{} 13 | i = 1 14 | if unknown { 15 | i = S("foo") 16 | } 17 | if unknown { 18 | i = (func(int, int))(nil) // NB type compares equal to that below. 19 | } 20 | // Look, the test harness can handle equal-but-not-String-equal 21 | // types because we parse types and using a typemap. 22 | if unknown { 23 | i = (func(x int, y int))(nil) 24 | } 25 | if unknown { 26 | i = incr 27 | } 28 | print(i) // @types int | S | func(int, int) | func(int) int 29 | 30 | // NB, an interface may never directly alias any global 31 | // labels, even though it may contain pointers that do. 32 | print(i) // @pointsto makeinterface:func(x int) int | makeinterface:func(x int, y int) | makeinterface:func(int, int) | makeinterface:int | makeinterface:main.S 33 | print(i.(func(int) int)) // @pointsto main.incr 34 | } 35 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/chanreflect1.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package main 4 | 5 | import "reflect" 6 | 7 | // 8 | // This test is very sensitive to line-number perturbations! 9 | 10 | // Test of channels with reflection. 11 | 12 | var a, b int 13 | 14 | func chanreflect1() { 15 | ch := make(chan *int, 0) 16 | crv := reflect.ValueOf(ch) 17 | crv.Send(reflect.ValueOf(&a)) 18 | print(crv.Interface()) // @types chan *int 19 | print(crv.Interface().(chan *int)) // @pointsto makechan@testdata/chanreflect.go:15:12 20 | print(<-ch) // @pointsto main.a 21 | } 22 | 23 | func chanreflect2() { 24 | ch := make(chan *int, 0) 25 | ch <- &b 26 | crv := reflect.ValueOf(ch) 27 | r, _ := crv.Recv() 28 | print(r.Interface()) // @types *int 29 | print(r.Interface().(*int)) // @pointsto main.b 30 | } 31 | 32 | func main() { 33 | chanreflect1() 34 | chanreflect2() 35 | } 36 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/fmtexcerpt.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | // This is a slice of the fmt package. 4 | 5 | package main 6 | 7 | type pp struct { 8 | field interface{} 9 | } 10 | 11 | func newPrinter() *pp { 12 | return new(pp) 13 | } 14 | 15 | func Fprintln(a ...interface{}) { 16 | p := newPrinter() 17 | p.doPrint(a, true, true) 18 | } 19 | 20 | func Println(a ...interface{}) { 21 | Fprintln(a...) 22 | } 23 | 24 | func (p *pp) doPrint(a []interface{}, addspace, addnewline bool) { 25 | print(a[0]) // @types S | string 26 | stringer := a[0].(interface { 27 | String() string 28 | }) 29 | 30 | stringer.String() 31 | print(stringer) // @types S 32 | } 33 | 34 | type S int 35 | 36 | func (S) String() string { return "" } 37 | 38 | func main() { 39 | Println("Hello, World!", S(0)) 40 | } 41 | 42 | // @calls (*main.pp).doPrint -> (main.S).String 43 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/hello.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | ) 9 | 10 | type S int 11 | 12 | var theS S 13 | 14 | func (s *S) String() string { 15 | print(s) // @pointsto main.theS 16 | return "" 17 | } 18 | 19 | func main() { 20 | // os.Args is considered instrincally allocated, 21 | // but may also be set explicitly (e.g. on Windows), hence '...'. 22 | print(os.Args) // @pointsto | ... 23 | fmt.Println("Hello, World!", &theS) 24 | } 25 | 26 | // @calls main.main -> fmt.Println 27 | // @calls (*fmt.pp).handleMethods -> (*main.S).String 28 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/panic.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package main 4 | 5 | // Test of value flow from panic() to recover(). 6 | // We model them as stores/loads of a global location. 7 | // We ignore concrete panic types originating from the runtime. 8 | 9 | var someval int 10 | 11 | type myPanic struct{} 12 | 13 | func f(int) {} 14 | 15 | func g() string { return "" } 16 | 17 | func deadcode() { 18 | panic(123) // not reached 19 | } 20 | 21 | func main() { 22 | switch someval { 23 | case 0: 24 | panic("oops") 25 | case 1: 26 | panic(myPanic{}) 27 | case 2: 28 | panic(f) 29 | case 3: 30 | panic(g) 31 | } 32 | ex := recover() 33 | print(ex) // @types myPanic | string | func(int) | func() string 34 | print(ex.(func(int))) // @pointsto main.f 35 | print(ex.(func() string)) // @pointsto main.g 36 | } 37 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/recur.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package main 4 | 5 | // Analysis abstraction of recursive calls is finite. 6 | 7 | func main() { 8 | main() 9 | } 10 | 11 | // @calls main.main -> main.main 12 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/pointer/testdata/rtti.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Regression test for oracle crash 4 | // https://code.google.com/p/go/issues/detail?id=6605 5 | // 6 | // Using reflection, methods may be called on types that are not the 7 | // operand of any ssa.MakeInterface instruction. In this example, 8 | // (Y).F is called by deriving the type Y from *Y. Prior to the fix, 9 | // no RTTI (or method set) for type Y was included in the program, so 10 | // the F() call would crash. 11 | 12 | import "reflect" 13 | 14 | var a int 15 | 16 | type X struct{} 17 | 18 | func (X) F() *int { 19 | return &a 20 | } 21 | 22 | type I interface { 23 | F() *int 24 | } 25 | 26 | func main() { 27 | type Y struct{ X } 28 | print(reflect.Indirect(reflect.ValueOf(new(Y))).Interface().(I).F()) // @pointsto main.a 29 | } 30 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/present/html.go: -------------------------------------------------------------------------------- 1 | package present 2 | 3 | import ( 4 | "errors" 5 | "html/template" 6 | "path/filepath" 7 | "strings" 8 | ) 9 | 10 | func init() { 11 | Register("html", parseHTML) 12 | } 13 | 14 | func parseHTML(ctx *Context, fileName string, lineno int, text string) (Elem, error) { 15 | p := strings.Fields(text) 16 | if len(p) != 2 { 17 | return nil, errors.New("invalid .html args") 18 | } 19 | name := filepath.Join(filepath.Dir(fileName), p[1]) 20 | b, err := ctx.ReadFile(name) 21 | if err != nil { 22 | return nil, err 23 | } 24 | return HTML{template.HTML(b)}, nil 25 | } 26 | 27 | type HTML struct { 28 | template.HTML 29 | } 30 | 31 | func (s HTML) TemplateName() string { return "html" } 32 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/present/iframe.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 present 6 | 7 | import ( 8 | "fmt" 9 | "strings" 10 | ) 11 | 12 | func init() { 13 | Register("iframe", parseIframe) 14 | } 15 | 16 | type Iframe struct { 17 | URL string 18 | Width int 19 | Height int 20 | } 21 | 22 | func (i Iframe) TemplateName() string { return "iframe" } 23 | 24 | func parseIframe(ctx *Context, fileName string, lineno int, text string) (Elem, error) { 25 | args := strings.Fields(text) 26 | i := Iframe{URL: args[1]} 27 | a, err := parseArgs(fileName, lineno, args[2:]) 28 | if err != nil { 29 | return nil, err 30 | } 31 | switch len(a) { 32 | case 0: 33 | // no size parameters 34 | case 2: 35 | if v, ok := a[0].(int); ok { 36 | i.Height = v 37 | } 38 | if v, ok := a[1].(int); ok { 39 | i.Width = v 40 | } 41 | default: 42 | return nil, fmt.Errorf("incorrect image invocation: %q", text) 43 | } 44 | return i, nil 45 | } 46 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/present/image.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package present 6 | 7 | import ( 8 | "fmt" 9 | "strings" 10 | ) 11 | 12 | func init() { 13 | Register("image", parseImage) 14 | } 15 | 16 | type Image struct { 17 | URL string 18 | Width int 19 | Height int 20 | } 21 | 22 | func (i Image) TemplateName() string { return "image" } 23 | 24 | func parseImage(ctx *Context, fileName string, lineno int, text string) (Elem, error) { 25 | args := strings.Fields(text) 26 | img := Image{URL: args[1]} 27 | a, err := parseArgs(fileName, lineno, args[2:]) 28 | if err != nil { 29 | return nil, err 30 | } 31 | switch len(a) { 32 | case 0: 33 | // no size parameters 34 | case 2: 35 | if v, ok := a[0].(int); ok { 36 | img.Height = v 37 | } 38 | if v, ok := a[1].(int); ok { 39 | img.Width = v 40 | } 41 | default: 42 | return nil, fmt.Errorf("incorrect image invocation: %q", text) 43 | } 44 | return img, nil 45 | } 46 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/ssa/interp/testdata/a_test.go: -------------------------------------------------------------------------------- 1 | package a 2 | 3 | import "testing" 4 | 5 | func TestFoo(t *testing.T) { 6 | t.Error("foo") 7 | } 8 | 9 | func TestBar(t *testing.T) { 10 | t.Error("bar") 11 | } 12 | 13 | func BenchmarkWiz(b *testing.B) { 14 | b.Error("wiz") 15 | } 16 | 17 | // Don't test Examples since that testing package needs pipe(2) for that. 18 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/ssa/interp/testdata/b_test.go: -------------------------------------------------------------------------------- 1 | package b 2 | 3 | import "testing" 4 | 5 | func NotATest(t *testing.T) { 6 | t.Error("foo") 7 | } 8 | 9 | func NotABenchmark(b *testing.B) { 10 | b.Error("wiz") 11 | } 12 | -------------------------------------------------------------------------------- /src/code.google.com/p/go.tools/ssa/interp/testdata/recover.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Tests of panic/recover. 4 | 5 | import "fmt" 6 | 7 | func fortyTwo() (r int) { 8 | r = 42 9 | // The next two statements simulate a 'return' statement. 10 | defer func() { recover() }() 11 | panic(nil) 12 | } 13 | 14 | func zero() int { 15 | defer func() { recover() }() 16 | panic(1) 17 | } 18 | 19 | func zeroEmpty() (int, string) { 20 | defer func() { recover() }() 21 | panic(1) 22 | } 23 | 24 | func main() { 25 | if r := fortyTwo(); r != 42 { 26 | panic(r) 27 | } 28 | if r := zero(); r != 0 { 29 | panic(r) 30 | } 31 | if r, s := zeroEmpty(); r != 0 || s != "" { 32 | panic(fmt.Sprint(r, s)) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/game/algorithm/hu_qingluanfeng.go: -------------------------------------------------------------------------------- 1 | package algorithm 2 | 3 | // 乱风胡检测 4 | // 所有牌都为风牌(东南西北中发白),无需成胡牌型 5 | // 碰杠牌要加入检测 6 | func ExistLuanFeng(cards []byte) int64 { 7 | for _, v := range cards { 8 | if v != WILDCARD { 9 | if v>>4 < FENG { 10 | return 0 11 | } 12 | } 13 | } 14 | return HU_LUAN_FENG 15 | } 16 | 17 | // 清一色检测 18 | func ExistOneSuit(cards []byte,wildcard byte) int64 { 19 | var c byte 20 | le := len(cards) 21 | for i := 0; i < le; i++ { 22 | card := cards[i] 23 | //if card == BAI{ 24 | // card = wildcard 25 | //} 26 | if card != wildcard { 27 | if c > 0 && c>>4 != card>>4 { 28 | return 0 29 | } 30 | c = card 31 | } 32 | } 33 | 34 | return HU_ONE_SUIT 35 | } 36 | -------------------------------------------------------------------------------- /src/game/algorithm/score_calc.go: -------------------------------------------------------------------------------- 1 | package algorithm 2 | 3 | //算番(牌型) 多个牌型时相加 4 | func HuType(value int64, ante uint32) uint32 { 5 | if value&HU == 0 { 6 | return 0 7 | } 8 | var fan uint32 9 | 10 | for k, v := range Fan { 11 | if value&k > 0 && k != HU && k != HU_SINGLE { 12 | fan += (ante * v) 13 | if fan > 12 { 14 | fan = 6 * ante 15 | break 16 | } 17 | } 18 | } 19 | 20 | // 没有大牌则胡平胡 21 | if fan == 0 { 22 | fan += (ante * Fan[HU]) 23 | } 24 | return fan 25 | } 26 | -------------------------------------------------------------------------------- /src/game/algorithm/sort.go: -------------------------------------------------------------------------------- 1 | package algorithm 2 | 3 | 4 | // 对牌值从小到大排序,采用快速排序算法 5 | func Sort(arr []byte, start, end int) { 6 | if start < end { 7 | i, j := start, end 8 | key := arr[(start+end)/2] 9 | for i <= j { 10 | for arr[i] < key { 11 | i++ 12 | } 13 | for arr[j] > key { 14 | j-- 15 | } 16 | if i <= j { 17 | arr[i], arr[j] = arr[j], arr[i] 18 | i++ 19 | j-- 20 | } 21 | } 22 | if start < j { 23 | Sort(arr, start, j) 24 | } 25 | if end > i { 26 | Sort(arr, i, end) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/game/csv/pattern_test.go: -------------------------------------------------------------------------------- 1 | package csv 2 | 3 | import "io/ioutil" 4 | import "lib/csv" 5 | var Patterns []Pattern 6 | 7 | type Pattern struct { 8 | Cards int `csv:"cards"` // 9 | Value int `csv:"value"` // 10 | Fan int `csv:"fan"` // 11 | Name int `csv:"name"` // 12 | } 13 | 14 | func InitPattern()error { 15 | file:= "./csv/test_patterns.csv" 16 | data, err := ioutil.ReadFile(file) 17 | if err != nil { 18 | return err 19 | } 20 | 21 | Patterns = []Pattern{} 22 | err = csv.Unmarshal(data, &Patterns) 23 | if err != nil { 24 | return err 25 | } 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /src/game/csv/shop_csv.go: -------------------------------------------------------------------------------- 1 | package csv 2 | 3 | import ( 4 | "io/ioutil" 5 | "lib/csv" 6 | "os" 7 | 8 | "github.com/golang/glog" 9 | "sync" 10 | ) 11 | 12 | var shopMap map[uint32]ShopData 13 | var shopLock sync.RWMutex 14 | 15 | type ShopData struct { 16 | Id uint32 `csv:"id"` // 17 | PropId uint32 `csv:"propid"` // 兑换的物品,1=钻石,2=房卡 18 | Number uint32 `csv:"number"` // 兑换的数量 19 | Paymenttype uint32 `csv:"paymenttype"` // 支付方式,1=RMB,2=钻石 20 | Price uint32 `csv:"price"` // 支付价格 21 | } 22 | 23 | func InitShop() { 24 | shopLock.Lock() 25 | defer shopLock.Unlock() 26 | f, err := os.Open("./csv/shop.csv") 27 | if err != nil { 28 | panic(err) 29 | } 30 | defer f.Close() 31 | 32 | data, err := ioutil.ReadAll(f) 33 | if err != nil { 34 | panic(err) 35 | } 36 | var shop []ShopData 37 | err = csv.Unmarshal(data, &shop) 38 | if err != nil { 39 | panic(err) 40 | } 41 | shopMap = make(map[uint32]ShopData) 42 | for _, v := range shop { 43 | shopMap[v.Id] = v 44 | } 45 | glog.Infoln("shop表:", len(shopMap)) 46 | } 47 | -------------------------------------------------------------------------------- /src/game/data/data_active.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | import ( 4 | "errors" 5 | "time" 6 | ) 7 | 8 | type DataUserActive struct { 9 | Userid string `bson:"Userid"` // 用户账号id 10 | IP uint32 `bson:"IP"` // 登录IP 11 | Time time.Time `bson:"Time"` // 时间戳 12 | Action uint32 `bson:"Action"` // 1:上线,2:下线 13 | } 14 | 15 | // 记录登陆时间,没有该玩家数据则插入 16 | func (this *DataUserActive) Login() error { 17 | this.Time = time.Now() 18 | this.Action = 1 19 | if this.Userid != "" { 20 | } else { 21 | return errors.New("user id is empty!") 22 | } 23 | 24 | return C(_LOGIN_LOG_OUT_RECORD).Insert(this) 25 | } 26 | 27 | // 记录退出时间,并累积在线时长 28 | func (this *DataUserActive) Logout() error { 29 | this.Time = time.Now() 30 | this.Action = 2 31 | if this.Userid != "" { 32 | } else { 33 | return errors.New("user id is empty!") 34 | } 35 | return C(_LOGIN_LOG_OUT_RECORD).Insert(this) 36 | } 37 | -------------------------------------------------------------------------------- /src/game/data/data_card_record.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | import "time" 4 | 5 | type CarRecord struct { 6 | Id string `bson:"_id"` // 7 | RoomId uint32 `bson:"RoomId"` // 8 | Record []uint64 `bson:"Record"` // 9 | CTime uint32 `bson:"CTime"` // 10 | } 11 | 12 | func (this *CarRecord) Add() error { 13 | this.CTime = uint32(time.Now().Unix()) 14 | return C(_CARD_RECORD).Insert(this) 15 | } 16 | 17 | func (this *CarRecord) Get() error { 18 | return C(_CARD_RECORD).FindId(this.Id).One(this) 19 | } 20 | -------------------------------------------------------------------------------- /src/game/data/data_resource_change.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | import ( 4 | "time" 5 | "lib/utils" 6 | ) 7 | 8 | const ( 9 | RESTYPE4 =4 //私人局 10 | ) 11 | 12 | type DataResChange struct { 13 | Userid string `bson:"Userid"` //玩家ID 14 | Kind uint32 `bson:"Kind"` //道具、货币种类 15 | Time uint32 `bson:"Time"` //变动时间 16 | Channel uint32 `bson:"Channel"` //获取、扣除渠道 17 | Residual uint32 `bson:"Residual"` //剩余量 18 | Count int32 `bson:"Count"` // 变数量 19 | } 20 | 21 | 22 | type DataResChanges []*DataResChange 23 | func (this *DataResChanges) Save(userid string) error { 24 | var list []interface{} 25 | for _,v:=range *this{ 26 | v.Time =uint32(time.Now().Unix()) 27 | v.Userid = userid 28 | list =append(list,utils.Struct2Map(v)) 29 | } 30 | return C(_RESOURCE_RECORD).Insert(list...) 31 | } 32 | -------------------------------------------------------------------------------- /src/game/data/statistics_test.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func Test_save(t *testing.T) { 9 | data := &Statistics{Name: "1234567", Total: 1234, Date: uint32(time.Now().Unix())} 10 | t.Log(data.Save()) 11 | } 12 | -------------------------------------------------------------------------------- /src/game/interfacer/iconn.go: -------------------------------------------------------------------------------- 1 | package interfacer 2 | 3 | type IConn interface { 4 | Close() 5 | Send(IProto) 6 | GetUserid() string 7 | SetUserid(string) 8 | GetLogin() bool 9 | SetLogin() 10 | GetIPAddr() uint32 11 | GetConnected() bool 12 | } 13 | -------------------------------------------------------------------------------- /src/game/interfacer/iplayer.go: -------------------------------------------------------------------------------- 1 | package interfacer 2 | 3 | import "protocol" 4 | 5 | type IPlayer interface { 6 | GetUserid() string 7 | GetSeat() uint32 8 | SetUserid(string) 9 | SetLongitudeLatitude(longitude,latitude string) 10 | ConverDataUser() *protocol.UserData 11 | ConverProtoUser() *protocol.ProtoUser 12 | GetInviteCode() string // 私人局邀请码 13 | GetRoomType() uint32 // 房间类型ID,对应房间表 14 | GetRoomID() uint32 // 比赛场或金币场房间id 15 | // 分别为:房间类型ID,房间号,房间邀请码 16 | SetRoom( uint32, uint32, string) 17 | ClearRoom() 18 | GetPlatform() uint32 19 | 20 | SetConn(IConn) 21 | GetConn() IConn 22 | Send(IProto) 23 | 24 | GetRoomCard() uint32 25 | SetRoomCard(uint32) 26 | } 27 | -------------------------------------------------------------------------------- /src/game/interfacer/iproto.go: -------------------------------------------------------------------------------- 1 | package interfacer 2 | 3 | 4 | type IProto interface { 5 | GetCode() uint32 6 | Reset() 7 | String() string 8 | ProtoMessage() 9 | } 10 | -------------------------------------------------------------------------------- /src/game/interfacer/iroom.go: -------------------------------------------------------------------------------- 1 | package interfacer 2 | 3 | type IDesk interface { 4 | Discard(uint32, byte, bool) int32 5 | Operate(uint32, int64, uint32) int32 6 | Readying(uint32, bool) int32 7 | Enter(IPlayer) int32 8 | Vote(bool, uint32, uint32) int32 9 | Broadcasts(IProto) 10 | Closed(bool) 11 | SetCheat([][]byte, []byte, byte) 12 | MaiZi(seat, count uint32) int32 13 | Offline(uint32, bool) 14 | ToString() string 15 | } 16 | -------------------------------------------------------------------------------- /src/game/request/config.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "lib/socket" 5 | "game/interfacer" 6 | "protocol" 7 | log "github.com/golang/glog" 8 | "code.google.com/p/goprotobuf/proto" 9 | "config" 10 | ) 11 | 12 | func init() { 13 | socket.Regist(&protocol.CConfig{}, getconfig) 14 | } 15 | 16 | func getconfig(ctos *protocol.CConfig, c interfacer.IConn) { 17 | defer func() { 18 | if err := recover(); err != nil { 19 | log.Errorln(err) 20 | } 21 | }() 22 | stoc := &protocol.SConfig{ 23 | Sys: &protocol.SysConfig{ 24 | Discardtimeout: proto.Uint32(uint32(config.Opts().Operate_timeout)), 25 | Version: proto.String(config.Opts().Version), 26 | Shareaddr: proto.String(config.Opts().Share_addr), 27 | }, 28 | } 29 | 30 | c.Send(stoc) 31 | } 32 | -------------------------------------------------------------------------------- /src/game/request/ping.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "lib/socket" 5 | "game/interfacer" 6 | "protocol" 7 | 8 | "code.google.com/p/goprotobuf/proto" 9 | ) 10 | 11 | func init() { 12 | 13 | socket.Regist(&protocol.CPing{}, ping) 14 | } 15 | 16 | func ping(ctos *protocol.CPing, c interfacer.IConn) { 17 | stoc := &protocol.SPing{Error: proto.Uint32(0)} 18 | c.Send(stoc) 19 | } 20 | -------------------------------------------------------------------------------- /src/game/room/enter.go: -------------------------------------------------------------------------------- 1 | package room 2 | 3 | import ( 4 | "game/interfacer" 5 | "protocol" 6 | ) 7 | 8 | //进入 9 | func (t *Desk) Enter(p interfacer.IPlayer) int32 { 10 | t.Lock() //房间加锁 11 | defer t.Unlock() 12 | 13 | for k, v := range t.players { 14 | if p.GetUserid() == v.GetUserid() { 15 | p.SetRoom(t.id, k, t.data.Code) 16 | round, expire := t.getRound() 17 | // 判断玩家是否已经在房间 18 | msg1 := t.res_reEnter(t.id, k, round, expire, 19 | t.dealer, t.data, t.players, t.maizi) 20 | p.Send(msg1) 21 | return 0 22 | } 23 | } 24 | p.ClearRoom() 25 | 26 | // 玩家不在房间,查找空座位 27 | for i := uint32(1); i <= 4; i++ { 28 | if _, ok := t.players[i]; !ok { 29 | t.players[i] = p 30 | p.SetRoom(t.id, i, t.data.Code) 31 | round, expire := t.getRound() 32 | msg1 := t.res_enter(t.id, i, round, expire, 33 | t.dealer, t.data, t.players, t.ready, t.maizi) 34 | p.Send(msg1) 35 | uid := p.GetUserid() 36 | score := t.data.Score[uid] 37 | msg2 := res_othercomein(p, score) 38 | t.broadcast_(i, msg2) 39 | return 0 40 | } 41 | } 42 | 43 | // 房间已满员 44 | return int32(protocol.Error_RoomFull) 45 | } 46 | -------------------------------------------------------------------------------- /src/game/room/maizi.go: -------------------------------------------------------------------------------- 1 | package room 2 | 3 | import ( 4 | "lib/utils" 5 | "protocol" 6 | ) 7 | 8 | func (t *Desk) MaiZi(seat, count uint32) int32 { 9 | t.Lock() //房间加锁 10 | defer t.Unlock() 11 | if !t.data.MaiZi { 12 | return int32(protocol.Error_BuyAlready) 13 | } 14 | if _, ok := t.ready[seat]; !ok { 15 | return int32(protocol.Error_BuyAlready) 16 | } 17 | 18 | if _, ok := t.maizi[seat]; ok { 19 | return int32(protocol.Error_BuyAlready) 20 | } 21 | 22 | t.maizi[seat] = count 23 | go func() { 24 | utils.Sleep(2) //延迟2秒 25 | t.Diceing() //主动打骰 26 | }() 27 | 28 | stoc := &protocol.SMaiZi{ 29 | Seat: &seat, 30 | Count: &count, 31 | } 32 | t.broadcast(stoc) 33 | return 0 34 | } 35 | -------------------------------------------------------------------------------- /src/game/roomrequest/ready.go: -------------------------------------------------------------------------------- 1 | package roomrequest 2 | 3 | import ( 4 | "lib/socket" 5 | "game/interfacer" 6 | "game/players" 7 | "protocol" 8 | "game/room" 9 | "code.google.com/p/goprotobuf/proto" 10 | ) 11 | 12 | func init() { 13 | socket.Regist(&protocol.CReady{}, ready) 14 | } 15 | 16 | // 玩家准备 17 | func ready(ctos *protocol.CReady, c interfacer.IConn) { 18 | player := players.Get(c.GetUserid()) 19 | rdata := room.Get(player.GetInviteCode()) 20 | stoc := &protocol.SReady{} 21 | if rdata == nil { 22 | stoc.Error = proto.Uint32(uint32(protocol.Error_NotInRoom)) 23 | c.Send(stoc) 24 | return 25 | } 26 | seat := player.GetSeat() 27 | ready := ctos.GetReady() 28 | err:= rdata.Readying(seat, ready) 29 | if err > 0 { 30 | stoc.Error = proto.Uint32(uint32(err)) 31 | c.Send(stoc) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/game/roomrequest/req_discard.go: -------------------------------------------------------------------------------- 1 | package roomrequest 2 | 3 | import ( 4 | "protocol" 5 | "game/interfacer" 6 | "game/players" 7 | "game/room" 8 | "code.google.com/p/goprotobuf/proto" 9 | "lib/socket" 10 | ) 11 | 12 | func init() { 13 | socket.Regist(&protocol.CDiscard{}, discard) 14 | } 15 | 16 | //打牌 17 | func discard(ctos *protocol.CDiscard, c interfacer.IConn) { 18 | stoc := &protocol.SDiscard{} 19 | player := players.Get(c.GetUserid()) 20 | rdata := room.Get(player.GetInviteCode()) 21 | if rdata == nil { 22 | stoc.Error = proto.Uint32(uint32(protocol.Error_NotInRoom)) 23 | c.Send(stoc) 24 | return 25 | } 26 | 27 | var card uint32 = ctos.GetCard() 28 | seat := player.GetSeat() 29 | if card == 0 { 30 | stoc.Error = proto.Uint32(uint32(protocol.Error_CardValueZero)) 31 | c.Send(stoc) 32 | return 33 | } 34 | err := rdata.Discard(seat, byte(card), false) 35 | if err > 0 { 36 | stoc.Error = proto.Uint32(uint32(err)) 37 | c.Send(stoc) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/game/roomrequest/req_entry_room.go: -------------------------------------------------------------------------------- 1 | package roomrequest 2 | 3 | import ( 4 | "game/room" 5 | "code.google.com/p/goprotobuf/proto" 6 | "protocol" 7 | "game/interfacer" 8 | "game/players" 9 | "lib/socket" 10 | "github.com/golang/glog" 11 | ) 12 | 13 | func init() { 14 | socket.Regist(&protocol.CEnterSocialRoom{}, entryroom) 15 | } 16 | 17 | func entryroom(ctos *protocol.CEnterSocialRoom, c interfacer.IConn) { 18 | stoc := &protocol.SEnterSocialRoom{} 19 | player := players.Get(c.GetUserid()) 20 | rdata := room.Get(player.GetInviteCode()) 21 | if rdata != nil { //已经存在或重复进入 22 | code := rdata.Enter(player) 23 | if code == 0 { 24 | return 25 | } 26 | } 27 | player.ClearRoom() 28 | rdata = room.Get(ctos.GetInvitecode()) 29 | if rdata == nil { 30 | stoc.Error = proto.Uint32(uint32(protocol.Error_RoomNotExist)) 31 | c.Send(stoc) 32 | return 33 | } 34 | glog.Infoln("进入房间:",ctos.String()) 35 | player.SetLongitudeLatitude(ctos.GetLongitude(),ctos.GetLatitude()) 36 | code := rdata.Enter(player) 37 | 38 | if code > 0 { 39 | stoc.Error = proto.Uint32(uint32(code)) 40 | c.Send(stoc) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/game/roomrequest/req_operate.go: -------------------------------------------------------------------------------- 1 | package roomrequest 2 | 3 | import ( 4 | "protocol" 5 | "game/interfacer" 6 | "game/players" 7 | "game/room" 8 | "github.com/golang/glog" 9 | "code.google.com/p/goprotobuf/proto" 10 | "lib/socket" 11 | ) 12 | 13 | func init() { 14 | socket.Regist(&protocol.COperate{}, operate) 15 | } 16 | 17 | //操作 18 | func operate(ctos *protocol.COperate, c interfacer.IConn) { 19 | stoc := &protocol.SOperate{} 20 | var card uint32 = ctos.GetCard() 21 | var value int64 = ctos.GetValue() 22 | player := players.Get(c.GetUserid()) 23 | rdata := room.Get(player.GetInviteCode()) 24 | if rdata == nil { 25 | stoc.Error = proto.Uint32(uint32(protocol.Error_NotInRoom)) 26 | c.Send(stoc) 27 | return 28 | } 29 | seat := player.GetSeat() 30 | code := rdata.Operate(card, value, seat) 31 | if code > 0 { 32 | stoc.Error = proto.Uint32(uint32(code)) 33 | glog.Errorln(stoc.String()) 34 | c.Send(stoc) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/github.com/89hmdys/toast/aes_test.go: -------------------------------------------------------------------------------- 1 | package toast 2 | 3 | import ( 4 | "encoding/base64" 5 | "testing" 6 | 7 | "github.com/89hmdys/toast/crypto" 8 | "github.com/89hmdys/toast/rsa" 9 | ) 10 | 11 | func Test_AES(t *testing.T) { 12 | plant := `故经之以五事,校之以计而索其情:一曰道,二曰天,三曰地,四曰将,五曰法。道者,令民与上同意也,故可与之死,可与之生,而不畏危。天者,阴阳、寒暑、时制也。地者,高下、远近、险易、广狭、死生也。将者,智、信、仁、勇、严也。法者,曲制、官道、主用也。凡此五者,将莫不闻,知之者胜,不知者不胜。故校之以计而索其情,曰:主孰有道?将孰有能?天地孰得?法令孰行?兵众孰强?士卒孰练?赏罚孰明?吾以此知胜负矣。` 13 | 14 | key, err := rsa.LoadKeyFromPEMFile( 15 | `crypto/rsa_public_key.pem`, 16 | `crypto/rsa_private_key.pem`, 17 | rsa.ParsePKCS8Key) 18 | if err != nil { 19 | t.Error(err) 20 | return 21 | } 22 | 23 | cipher, err := crypto.NewRSA(key) 24 | if err != nil { 25 | t.Error(err) 26 | return 27 | } 28 | 29 | enT, err := cipher.Encrypt([]byte(plant)) 30 | if err != nil { 31 | t.Error(err) 32 | return 33 | } 34 | 35 | t.Log(base64.StdEncoding.EncodeToString(enT)) 36 | 37 | deT, err := cipher.Decrypt(enT) 38 | if err != nil { 39 | t.Error(err) 40 | return 41 | } 42 | t.Log(string(deT)) 43 | } 44 | -------------------------------------------------------------------------------- /src/github.com/89hmdys/toast/change.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/89hmdys/toast/change.log -------------------------------------------------------------------------------- /src/github.com/89hmdys/toast/cipher/padding.go: -------------------------------------------------------------------------------- 1 | package cipher 2 | 3 | import "bytes" 4 | 5 | /* 6 | 介绍:Padding接口为各种填充方式提供了统一的接口来填充/还原数据。 7 | 作者:Alex 8 | 版本:release-1.1 9 | */ 10 | type Padding interface { 11 | /* 12 | 介绍:根据块大小填充待加密数据 13 | 作者:Alex 14 | 版本:release-1.1 15 | */ 16 | Padding(src []byte, blockSize int) []byte 17 | /* 18 | 介绍:从解密后的数据中取出填充的数据,还原原文 19 | 作者:Alex 20 | 版本:release-1.1 21 | */ 22 | UnPadding(src []byte) []byte 23 | } 24 | 25 | type padding struct {} 26 | 27 | type pkcs57Padding padding 28 | 29 | /* 30 | 介绍:创建PKCS5/7填充模式 31 | 作者:Alex 32 | 版本:release-1.1 33 | */ 34 | func NewPKCS57Padding() Padding { 35 | return &pkcs57Padding{} 36 | } 37 | 38 | func (p *pkcs57Padding) Padding(src []byte, blockSize int) []byte { 39 | padding := blockSize - len(src) % blockSize 40 | padtext := bytes.Repeat([]byte{byte(padding)}, padding) 41 | return append(src, padtext...) 42 | } 43 | 44 | func (p *pkcs57Padding) UnPadding(src []byte) []byte { 45 | length := len(src) 46 | unpadding := int(src[length - 1]) 47 | return src[:(length - unpadding)] 48 | } 49 | -------------------------------------------------------------------------------- /src/github.com/89hmdys/toast/crypto/rsa_private_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBALZo9E3Vj3kGqNSnJZ4NAamAAmp76Uch3hCOdm5kmMs6RKr+uEBUdnjOzJ2ZaaDKLgQQYNULC2UvR8HQSvShdGdrplY+MuipWAr5UvKFayzOpnfle2l5ku7RaLB2p3d4DfKCrgyasU0VATOmlb4g7Oa9qq5CTh3LY0DqnF/QX/4DAgMBAAECgYEAlmHkt56PUAnLerXqb2jtq94bH8rUQY6MUz4AKXbJ+RIqtoaVRIPdwC9NxchKqwLD+Rm/myQl2t+l2wVsJk5NdeXlF3MJauI7xw7nbksG+y9Qh5xT6JrhxAHNHKby0DH1ygZ4YL9AvQ0H4qn1ZBZ03hEzSCRSxmsB1LFzGsrHh4ECQQD5o+HKrrTGeK5IaBN9vmoxXjpUdv095SHDlB+L9OhOnolScQHOue3jufnoELHd21BYVsLkNHliQQlfJ3TfdI0hAkEAuw6bQ+TyHQs7GDv9znrWp7nw9OiKEepb+fQShdD0GU6HSwt083me+l5bw7s7kWdwhOCRi10cAGa9rK5opzPiowJBALEFxlJcqvJml2fe7ZtoUJNrdz94FUIz3kp7Ghe79pPxlf0xB5AZhpjKw20NkaN6JrJN6+u5Ti4fYk7ogtcGJiECQQCyXyVTwtfVNkZtv5cw9BYI7tiE0dIHb3GxkjqvfCeokieVOiGVot4kZSIgLUSKTRcQvoxLVshC4bXxGocVGfb9AkEAr68Nce5FZXGhW8wbhuK70TUpj+kVY1PXI3l1S8pnsUsOejozes4v7uETeqM1pprml4bjtVVSJiHRJIzK4Z69pg== 3 | -----END RSA PRIVATE KEY----- 4 | 5 | -------------------------------------------------------------------------------- /src/github.com/89hmdys/toast/crypto/rsa_public_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCOt/89In/3+4mIZiiyOfvB+XX5 3 | XBsQqiqqa9GVheIaovLcxeChb5Y5LHMFKYw5qaEQfz7Hgx4U6qTzR48nM9kN9IWP 4 | mfpGiuRrRp3BqL8QXJNM2fGiqOFG50W292Rr81Jb5EBKHioogIlX+jxXzUZ8VVpz 5 | egGiPEzQf+Ku0VebuQIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/COMPATIBLE: -------------------------------------------------------------------------------- 1 | Compatible with TOML version 2 | [v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md) 3 | 4 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | 15 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | go install ./... 3 | 4 | test: install 5 | go test -v 6 | toml-test toml-test-decoder 7 | toml-test -encoder toml-test-encoder 8 | 9 | fmt: 10 | gofmt -w *.go */*.go 11 | colcheck *.go */*.go 12 | 13 | tags: 14 | find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS 15 | 16 | push: 17 | git push origin master 18 | git push github master 19 | 20 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/encoding_types.go: -------------------------------------------------------------------------------- 1 | // +build go1.2 2 | 3 | package toml 4 | 5 | // In order to support Go 1.1, we define our own TextMarshaler and 6 | // TextUnmarshaler types. For Go 1.2+, we just alias them with the 7 | // standard library interfaces. 8 | 9 | import ( 10 | "encoding" 11 | ) 12 | 13 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 14 | // so that Go 1.1 can be supported. 15 | type TextMarshaler encoding.TextMarshaler 16 | 17 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 18 | // here so that Go 1.1 can be supported. 19 | type TextUnmarshaler encoding.TextUnmarshaler 20 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/encoding_types_1.1.go: -------------------------------------------------------------------------------- 1 | // +build !go1.2 2 | 3 | package toml 4 | 5 | // These interfaces were introduced in Go 1.2, so we add them manually when 6 | // compiling for Go 1.1. 7 | 8 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 9 | // so that Go 1.1 can be supported. 10 | type TextMarshaler interface { 11 | MarshalText() (text []byte, err error) 12 | } 13 | 14 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 15 | // here so that Go 1.1 can be supported. 16 | type TextUnmarshaler interface { 17 | UnmarshalText(text []byte) error 18 | } 19 | -------------------------------------------------------------------------------- /src/github.com/BurntSushi/toml/session.vim: -------------------------------------------------------------------------------- 1 | au BufWritePost *.go silent!make tags > /dev/null 2>&1 2 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | script: 4 | - go vet ./... 5 | - go test -v ./... 6 | 7 | go: 8 | - 1.3 9 | - 1.4 10 | - 1.5 11 | - 1.6 12 | - 1.7 13 | - tip 14 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dave Grijalva 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | 9 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/cmd/jwt/README.md: -------------------------------------------------------------------------------- 1 | `jwt` command-line tool 2 | ======================= 3 | 4 | This is a simple tool to sign, verify and show JSON Web Tokens from 5 | the command line. 6 | 7 | The following will create and sign a token, then verify it and output the original claims: 8 | 9 | echo {\"foo\":\"bar\"} | bin/jwt -key test/sample_key -alg RS256 -sign - | bin/jwt -key test/sample_key.pub -verify - 10 | 11 | To simply display a token, use: 12 | 13 | echo $JWT | jwt -show - 14 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/doc.go: -------------------------------------------------------------------------------- 1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html 2 | // 3 | // See README.md for more info. 4 | package jwt 5 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/request/doc.go: -------------------------------------------------------------------------------- 1 | // Utility package for extracting JWT tokens from 2 | // HTTP requests. 3 | // 4 | // The main function is ParseFromRequest and it's WithClaims variant. 5 | // See examples for how to use the various Extractor implementations 6 | // or roll your own. 7 | package request 8 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/request/extractor_example_test.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | ) 7 | 8 | const ( 9 | exampleTokenA = "A" 10 | ) 11 | 12 | func ExampleHeaderExtractor() { 13 | req := makeExampleRequest("GET", "/", map[string]string{"Token": exampleTokenA}, nil) 14 | tokenString, err := HeaderExtractor{"Token"}.ExtractToken(req) 15 | if err == nil { 16 | fmt.Println(tokenString) 17 | } else { 18 | fmt.Println(err) 19 | } 20 | //Output: A 21 | } 22 | 23 | func ExampleArgumentExtractor() { 24 | req := makeExampleRequest("GET", "/", nil, url.Values{"token": {extractorTestTokenA}}) 25 | tokenString, err := ArgumentExtractor{"token"}.ExtractToken(req) 26 | if err == nil { 27 | fmt.Println(tokenString) 28 | } else { 29 | fmt.Println(err) 30 | } 31 | //Output: A 32 | } 33 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/request/oauth2.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // Strips 'Bearer ' prefix from bearer token string 8 | func stripBearerPrefixFromTokenString(tok string) (string, error) { 9 | // Should be a bearer token 10 | if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " { 11 | return tok[7:], nil 12 | } 13 | return tok, nil 14 | } 15 | 16 | // Extract bearer token from Authorization header 17 | // Uses PostExtractionFilter to strip "Bearer " prefix from header 18 | var AuthorizationHeaderExtractor = &PostExtractionFilter{ 19 | HeaderExtractor{"Authorization"}, 20 | stripBearerPrefixFromTokenString, 21 | } 22 | 23 | // Extractor for OAuth2 access tokens. Looks in 'Authorization' 24 | // header then 'access_token' argument for a token. 25 | var OAuth2Extractor = &MultiExtractor{ 26 | AuthorizationHeaderExtractor, 27 | ArgumentExtractor{"access_token"}, 28 | } 29 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/request/request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "github.com/dgrijalva/jwt-go" 5 | "net/http" 6 | ) 7 | 8 | // Extract and parse a JWT token from an HTTP request. 9 | // This behaves the same as Parse, but accepts a request and an extractor 10 | // instead of a token string. The Extractor interface allows you to define 11 | // the logic for extracting a token. Several useful implementations are provided. 12 | func ParseFromRequest(req *http.Request, extractor Extractor, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { 13 | return ParseFromRequestWithClaims(req, extractor, jwt.MapClaims{}, keyFunc) 14 | } 15 | 16 | // ParseFromRequest but with custom Claims type 17 | func ParseFromRequestWithClaims(req *http.Request, extractor Extractor, claims jwt.Claims, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { 18 | // Extract token from request 19 | if tokStr, err := extractor.ExtractToken(req); err == nil { 20 | return jwt.ParseWithClaims(tokStr, claims, keyFunc) 21 | } else { 22 | return nil, err 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec256-private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIAh5qA3rmqQQuu0vbKV/+zouz/y/Iy2pLpIcWUSyImSwoAoGCCqGSM49 3 | AwEHoUQDQgAEYD54V/vp+54P9DXarYqx4MPcm+HKRIQzNasYSoRQHQ/6S6Ps8tpM 4 | cT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec256-public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYD54V/vp+54P9DXarYqx4MPcm+HK 3 | RIQzNasYSoRQHQ/6S6Ps8tpMcT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec384-private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MIGkAgEBBDCaCvMHKhcG/qT7xsNLYnDT7sE/D+TtWIol1ROdaK1a564vx5pHbsRy 3 | SEKcIxISi1igBwYFK4EEACKhZANiAATYa7rJaU7feLMqrAx6adZFNQOpaUH/Uylb 4 | ZLriOLON5YFVwtVUpO1FfEXZUIQpptRPtc5ixIPY658yhBSb6irfIJUSP9aYTflJ 5 | GKk/mDkK4t8mWBzhiD5B6jg9cEGhGgA= 6 | -----END EC PRIVATE KEY----- 7 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec384-public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE2Gu6yWlO33izKqwMemnWRTUDqWlB/1Mp 3 | W2S64jizjeWBVcLVVKTtRXxF2VCEKabUT7XOYsSD2OufMoQUm+oq3yCVEj/WmE35 4 | SRipP5g5CuLfJlgc4Yg+Qeo4PXBBoRoA 5 | -----END PUBLIC KEY----- 6 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec512-private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MIHcAgEBBEIB0pE4uFaWRx7t03BsYlYvF1YvKaBGyvoakxnodm9ou0R9wC+sJAjH 3 | QZZJikOg4SwNqgQ/hyrOuDK2oAVHhgVGcYmgBwYFK4EEACOhgYkDgYYABAAJXIuw 4 | 12MUzpHggia9POBFYXSxaOGKGbMjIyDI+6q7wi7LMw3HgbaOmgIqFG72o8JBQwYN 5 | 4IbXHf+f86CRY1AA2wHzbHvt6IhkCXTNxBEffa1yMUgu8n9cKKF2iLgyQKcKqW33 6 | 8fGOw/n3Rm2Yd/EB56u2rnD29qS+nOM9eGS+gy39OQ== 7 | -----END EC PRIVATE KEY----- 8 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/ec512-public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQACVyLsNdjFM6R4IImvTzgRWF0sWjh 3 | ihmzIyMgyPuqu8IuyzMNx4G2jpoCKhRu9qPCQUMGDeCG1x3/n/OgkWNQANsB82x7 4 | 7eiIZAl0zcQRH32tcjFILvJ/XCihdoi4MkCnCqlt9/HxjsP590ZtmHfxAeertq5w 5 | 9vakvpzjPXhkvoMt/Tk= 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/helpers.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "crypto/rsa" 5 | "github.com/dgrijalva/jwt-go" 6 | "io/ioutil" 7 | ) 8 | 9 | func LoadRSAPrivateKeyFromDisk(location string) *rsa.PrivateKey { 10 | keyData, e := ioutil.ReadFile(location) 11 | if e != nil { 12 | panic(e.Error()) 13 | } 14 | key, e := jwt.ParseRSAPrivateKeyFromPEM(keyData) 15 | if e != nil { 16 | panic(e.Error()) 17 | } 18 | return key 19 | } 20 | 21 | func LoadRSAPublicKeyFromDisk(location string) *rsa.PublicKey { 22 | keyData, e := ioutil.ReadFile(location) 23 | if e != nil { 24 | panic(e.Error()) 25 | } 26 | key, e := jwt.ParseRSAPublicKeyFromPEM(keyData) 27 | if e != nil { 28 | panic(e.Error()) 29 | } 30 | return key 31 | } 32 | 33 | func MakeSampleToken(c jwt.Claims, key interface{}) string { 34 | token := jwt.NewWithClaims(jwt.SigningMethodRS256, c) 35 | s, e := token.SignedString(key) 36 | 37 | if e != nil { 38 | panic(e.Error()) 39 | } 40 | 41 | return s 42 | } 43 | -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/hmacTestKey: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/dgrijalva/jwt-go/test/hmacTestKey -------------------------------------------------------------------------------- /src/github.com/dgrijalva/jwt-go/test/sample_key.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4f5wg5l2hKsTeNem/V41 3 | fGnJm6gOdrj8ym3rFkEU/wT8RDtnSgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7 4 | mCpz9Er5qLaMXJwZxzHzAahlfA0icqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBp 5 | HssPnpYGIn20ZZuNlX2BrClciHhCPUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2 6 | XrHhR+1DcKJzQBSTAGnpYVaqpsARap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3b 7 | ODIRe1AuTyHceAbewn8b462yEWKARdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy 8 | 7wIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /src/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 8 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | 24 | .idea/ 25 | *.iml -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.4 7 | - go: 1.5 8 | - go: 1.6 9 | - go: tip 10 | allow_failures: 11 | - go: tip 12 | 13 | script: 14 | - go get -t -v ./... 15 | - diff -u <(echo -n) <(gofmt -d .) 16 | - go vet $(go list ./... | grep -v /vendor/) 17 | - go test -v -race ./... 18 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Gorilla WebSocket authors for copyright 2 | # purposes. 3 | # 4 | # Please keep the list sorted. 5 | 6 | Gary Burd 7 | Joachim Bauch 8 | 9 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/bench_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func BenchmarkMaskBytes(b *testing.B) { 12 | var key [4]byte 13 | data := make([]byte, 1024) 14 | pos := 0 15 | for i := 0; i < b.N; i++ { 16 | pos = maskBytes(key, pos, data) 17 | } 18 | b.SetBytes(int64(len(data))) 19 | } 20 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/compression_test.go: -------------------------------------------------------------------------------- 1 | package websocket 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "testing" 7 | ) 8 | 9 | type nopCloser struct{ io.Writer } 10 | 11 | func (nopCloser) Close() error { return nil } 12 | 13 | func TestTruncWriter(t *testing.T) { 14 | const data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlkmnopqrstuvwxyz987654321" 15 | for n := 1; n <= 10; n++ { 16 | var b bytes.Buffer 17 | w := &truncWriter{w: nopCloser{&b}} 18 | p := []byte(data) 19 | for len(p) > 0 { 20 | m := len(p) 21 | if m > n { 22 | m = n 23 | } 24 | w.Write(p[:m]) 25 | p = p[m:] 26 | } 27 | if b.String() != data[:len(data)-len(w.p)] { 28 | t.Errorf("%d: %q", n, b.String()) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/conn_read.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.5 6 | 7 | package websocket 8 | 9 | import "io" 10 | 11 | func (c *Conn) read(n int) ([]byte, error) { 12 | p, err := c.br.Peek(n) 13 | if err == io.EOF { 14 | err = errUnexpectedEOF 15 | } 16 | c.br.Discard(len(p)) 17 | return p, err 18 | } 19 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/conn_read_legacy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.5 6 | 7 | package websocket 8 | 9 | import "io" 10 | 11 | func (c *Conn) read(n int) ([]byte, error) { 12 | p, err := c.br.Peek(n) 13 | if err == io.EOF { 14 | err = errUnexpectedEOF 15 | } 16 | if len(p) > 0 { 17 | // advance over the bytes just read 18 | io.ReadFull(c.br, p) 19 | } 20 | return p, err 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/autobahn/README.md: -------------------------------------------------------------------------------- 1 | # Test Server 2 | 3 | This package contains a server for the [Autobahn WebSockets Test Suite](http://autobahn.ws/testsuite). 4 | 5 | To test the server, run 6 | 7 | go run server.go 8 | 9 | and start the client test driver 10 | 11 | wstest -m fuzzingclient -s fuzzingclient.json 12 | 13 | When the client completes, it writes a report to reports/clients/index.html. 14 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/autobahn/fuzzingclient.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "options": {"failByDrop": false}, 4 | "outdir": "./reports/clients", 5 | "servers": [ 6 | {"agent": "ReadAllWriteMessage", "url": "ws://localhost:9000/m", "options": {"version": 18}}, 7 | {"agent": "ReadAllWrite", "url": "ws://localhost:9000/r", "options": {"version": 18}}, 8 | {"agent": "CopyFull", "url": "ws://localhost:9000/f", "options": {"version": 18}}, 9 | {"agent": "CopyWriterOnly", "url": "ws://localhost:9000/c", "options": {"version": 18}} 10 | ], 11 | "cases": ["*"], 12 | "exclude-cases": [], 13 | "exclude-agent-cases": {} 14 | } 15 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/command/README.md: -------------------------------------------------------------------------------- 1 | # Command example 2 | 3 | This example connects a websocket connection to stdin and stdout of a command. 4 | Received messages are written to stdin followed by a `\n`. Each line read from 5 | from standard out is sent as a message to the client. 6 | 7 | $ go get github.com/gorilla/websocket 8 | $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/command` 9 | $ go run main.go 10 | # Open http://localhost:8080/ . 11 | 12 | Try the following commands. 13 | 14 | # Echo sent messages to the output area. 15 | $ go run main.go cat 16 | 17 | # Run a shell.Try sending "ls" and "cat main.go". 18 | $ go run main.go sh 19 | 20 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/echo/README.md: -------------------------------------------------------------------------------- 1 | # Client and server example 2 | 3 | This example shows a simple client and server. 4 | 5 | The server echoes messages sent to it. The client sends a message every second 6 | and prints all messages received. 7 | 8 | To run the example, start the server: 9 | 10 | $ go run server.go 11 | 12 | Next, start the client: 13 | 14 | $ go run client.go 15 | 16 | The server includes a simple web client. To use the client, open 17 | http://127.0.0.1:8080 in the browser and follow the instructions on the page. 18 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/filewatch/README.md: -------------------------------------------------------------------------------- 1 | # File Watch example. 2 | 3 | This example sends a file to the browser client for display whenever the file is modified. 4 | 5 | $ go get github.com/gorilla/websocket 6 | $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/filewatch` 7 | $ go run main.go 8 | # Open http://localhost:8080/ . 9 | # Modify the file to see it update in the browser. 10 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig coding styles definitions. For more information about the 2 | # properties used in this file, please see the EditorConfig documentation: 3 | # http://editorconfig.org/ 4 | 5 | # indicate this is the root of the project 6 | root = true 7 | 8 | [*] 9 | charset = utf-8 10 | 11 | end_of_line = LF 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | indent_style = space 16 | indent_size = 2 17 | 18 | [Makefile] 19 | indent_style = tab 20 | 21 | [*.md] 22 | trim_trailing_whitespace = false 23 | 24 | [*.go] 25 | indent_style = tab 26 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.6 4 | - 1.7 5 | - tip 6 | install: 7 | - go get golang.org/x/tools/cmd/cover 8 | - go get github.com/Masterminds/glide 9 | - go get github.com/mattn/goveralls 10 | - go get github.com/modocache/gover 11 | - glide install 12 | script: 13 | - go test -coverprofile=echo.coverprofile 14 | - go test -coverprofile=middleware.coverprofile ./middleware 15 | - gover 16 | - goveralls -coverprofile=gover.coverprofile -service=travis-ci 17 | matrix: 18 | allow_failures: 19 | - go: tip 20 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/_fixture/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/_fixture/favicon.ico -------------------------------------------------------------------------------- /src/github.com/labstack/echo/_fixture/folder/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Echo 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/_fixture/images/walle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/_fixture/images/walle.png -------------------------------------------------------------------------------- /src/github.com/labstack/echo/_fixture/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Echo 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/labstack/echo 2 | import: 3 | - package: github.com/GeertJohan/go.rice 4 | - package: github.com/dgrijalva/jwt-go 5 | - package: github.com/gorilla/websocket 6 | - package: github.com/labstack/gommon 7 | subpackages: 8 | - bytes 9 | - color 10 | - log 11 | - random 12 | - package: github.com/mattn/go-isatty 13 | - package: github.com/rsc/letsencrypt 14 | - package: github.com/tylerb/graceful 15 | - package: github.com/valyala/fasttemplate 16 | - package: golang.org/x/net 17 | subpackages: 18 | - websocket 19 | - package: google.golang.org/appengine 20 | testImport: 21 | - package: github.com/stretchr/testify 22 | subpackages: 23 | - assert 24 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/logger.go: -------------------------------------------------------------------------------- 1 | package echo 2 | 3 | import ( 4 | "io" 5 | 6 | "github.com/labstack/gommon/log" 7 | ) 8 | 9 | type ( 10 | // Logger defines the logging interface. 11 | Logger interface { 12 | Output() io.Writer 13 | SetOutput(io.Writer) 14 | Level() log.Lvl 15 | SetLevel(log.Lvl) 16 | Prefix() string 17 | SetPrefix(string) 18 | Print(...interface{}) 19 | Printf(string, ...interface{}) 20 | Printj(log.JSON) 21 | Debug(...interface{}) 22 | Debugf(string, ...interface{}) 23 | Debugj(log.JSON) 24 | Info(...interface{}) 25 | Infof(string, ...interface{}) 26 | Infoj(log.JSON) 27 | Warn(...interface{}) 28 | Warnf(string, ...interface{}) 29 | Warnj(log.JSON) 30 | Error(...interface{}) 31 | Errorf(string, ...interface{}) 32 | Errorj(log.JSON) 33 | Fatal(...interface{}) 34 | Fatalj(log.JSON) 35 | Fatalf(string, ...interface{}) 36 | Panic(...interface{}) 37 | Panicj(log.JSON) 38 | Panicf(string, ...interface{}) 39 | } 40 | ) 41 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/middleware/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import "github.com/labstack/echo" 4 | 5 | type ( 6 | // Skipper defines a function to skip middleware. Returning true skips processing 7 | // the middleware. 8 | Skipper func(c echo.Context) bool 9 | ) 10 | 11 | // defaultSkipper returns false which processes the middleware. 12 | func defaultSkipper(c echo.Context) bool { 13 | return false 14 | } 15 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/middleware/recover_test.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "bytes" 5 | "net/http" 6 | "net/http/httptest" 7 | "testing" 8 | 9 | "github.com/labstack/echo" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestRecover(t *testing.T) { 14 | e := echo.New() 15 | buf := new(bytes.Buffer) 16 | e.Logger.SetOutput(buf) 17 | req, _ := http.NewRequest(echo.GET, "/", nil) 18 | rec := httptest.NewRecorder() 19 | c := e.NewContext(req, rec) 20 | h := Recover()(echo.HandlerFunc(func(c echo.Context) error { 21 | panic("test") 22 | })) 23 | h(c) 24 | assert.Equal(t, http.StatusInternalServerError, rec.Code) 25 | assert.Contains(t, buf.String(), "PANIC RECOVER") 26 | } 27 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/cors/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/labstack/echo" 7 | "github.com/labstack/echo/middleware" 8 | ) 9 | 10 | var ( 11 | users = []string{"Joe", "Veer", "Zion"} 12 | ) 13 | 14 | func getUsers(c echo.Context) error { 15 | return c.JSON(http.StatusOK, users) 16 | } 17 | 18 | func main() { 19 | e := echo.New() 20 | e.Use(middleware.Logger()) 21 | e.Use(middleware.Recover()) 22 | 23 | // CORS default 24 | // Allows requests from any origin wth GET, HEAD, PUT, POST or DELETE method. 25 | // e.Use(middleware.CORS()) 26 | 27 | // CORS restricted 28 | // Allows requests from any `https://labstack.com` or `https://labstack.net` origin 29 | // wth GET, PUT, POST or DELETE method. 30 | e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ 31 | AllowOrigins: []string{"https://labstack.com", "https://labstack.net"}, 32 | AllowMethods: []string{echo.GET, echo.PUT, echo.POST, echo.DELETE}, 33 | })) 34 | 35 | e.GET("/api/users", getUsers) 36 | 37 | e.Logger.Fatal(e.Start(":1323")) 38 | } 39 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/embed-resources/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | go.rice Example 6 | 7 | 8 | 9 |

go.rice Example

10 | 11 | 12 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/embed-resources/app/main.js: -------------------------------------------------------------------------------- 1 | alert("main.js"); 2 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/embed-resources/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | 6 | rice "github.com/GeertJohan/go.rice" 7 | "github.com/labstack/echo" 8 | ) 9 | 10 | func main() { 11 | e := echo.New() 12 | // the file server for rice. "app" is the folder where the files come from. 13 | assetHandler := http.FileServer(rice.MustFindBox("app").HTTPBox()) 14 | // serves the index.html from rice 15 | e.GET("/", echo.WrapHandler(assetHandler)) 16 | 17 | // servers other static files 18 | e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler))) 19 | 20 | e.Logger.Fatal(e.Start(":1323")) 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/file-upload/multiple/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Multiple file upload 6 | 7 | 8 |

Upload multiple files with fields

9 | 10 |
11 | Name:
12 | Email:
13 | Files:

14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/file-upload/single/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Single file upload 6 | 7 | 8 |

Upload single file with fields

9 | 10 |
11 | Name:
12 | Email:
13 | Files:

14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile extending the generic Go image with application files for a 2 | # single application. 3 | FROM gcr.io/google_appengine/golang 4 | 5 | COPY . /go/src/app 6 | RUN go-wrapper download 7 | RUN go-wrapper install -tags appenginevm -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/app-engine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package main 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/labstack/echo" 9 | ) 10 | 11 | func createMux() *echo.Echo { 12 | e := echo.New() 13 | // note: we don't need to provide the middleware or static handlers, that's taken care of by the platform 14 | // app engine has it's own "main" wrapper - we just need to hook echo into the default handler 15 | http.Handle("/", e) 16 | return e 17 | } 18 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/app-managed.go: -------------------------------------------------------------------------------- 1 | // +build appenginevm 2 | 3 | package main 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/labstack/echo" 9 | "google.golang.org/appengine" 10 | ) 11 | 12 | func createMux() *echo.Echo { 13 | e := echo.New() 14 | // note: we don't need to provide the middleware or static handlers 15 | // for the appengine vm version - that's taken care of by the platform 16 | return e 17 | } 18 | 19 | func main() { 20 | // the appengine package provides a convenient method to handle the health-check requests 21 | // and also run the app on the correct port. We just need to add Echo to the default handler 22 | e := echo.New(":8080") 23 | http.Handle("/", e) 24 | appengine.Main() 25 | } 26 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/app-standalone.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!appenginevm 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/labstack/echo" 7 | "github.com/labstack/echo/middleware" 8 | ) 9 | 10 | func createMux() *echo.Echo { 11 | e := echo.New() 12 | 13 | e.Use(middleware.Recover()) 14 | e.Use(middleware.Logger()) 15 | e.Use(middleware.Gzip()) 16 | 17 | e.Static("/", "public") 18 | 19 | return e 20 | } 21 | 22 | func main() { 23 | e.Logger.Fatal(e.Start(":8080")) 24 | } 25 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // reference our echo instance and create it early 4 | var e = createMux() 5 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/recipe/google-app-engine/public/favicon.ico -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Echo 7 | 8 | 9 | 10 | 11 | 12 |

Echo!

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/public/scripts/main.js: -------------------------------------------------------------------------------- 1 | console.log("Echo!"); 2 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/templates/welcome.html: -------------------------------------------------------------------------------- 1 | {{define "welcome"}}Hello, {{.}}!{{end}} 2 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/google-app-engine/welcome.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "html/template" 5 | "io" 6 | "net/http" 7 | 8 | "github.com/labstack/echo" 9 | ) 10 | 11 | type ( 12 | Template struct { 13 | templates *template.Template 14 | } 15 | ) 16 | 17 | func init() { 18 | t := &Template{ 19 | templates: template.Must(template.ParseFiles("templates/welcome.html")), 20 | } 21 | e.Renderer = t 22 | e.GET("/welcome", welcome) 23 | } 24 | 25 | func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error { 26 | return t.templates.ExecuteTemplate(w, name, data) 27 | } 28 | 29 | func welcome(c echo.Context) error { 30 | return c.Render(http.StatusOK, "welcome", "Joe") 31 | } 32 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/graceful-shutdown/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/labstack/echo" 7 | ) 8 | 9 | func main() { 10 | e := echo.New() 11 | 12 | // Setting up the termination timeout to 30 seconds. 13 | e.ShutdownTimeout = 30 * time.Second 14 | 15 | e.GET("/", func(ctx echo.Context) error { 16 | return ctx.String(200, "OK") 17 | }) 18 | 19 | e.Logger.Fatal(e.Start(":1323")) 20 | } 21 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/hello-world/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/labstack/echo" 7 | "github.com/labstack/echo/middleware" 8 | ) 9 | 10 | func main() { 11 | // Echo instance 12 | e := echo.New() 13 | 14 | // Middleware 15 | e.Use(middleware.Logger()) 16 | e.Use(middleware.Recover()) 17 | 18 | // Route => handler 19 | e.GET("/", func(c echo.Context) error { 20 | return c.String(http.StatusOK, "Hello, World!\n") 21 | }) 22 | 23 | // Start server 24 | e.Logger.Fatal(e.Start(":1323")) 25 | } 26 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/jsonp/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | "net/http" 6 | "time" 7 | 8 | "github.com/labstack/echo" 9 | "github.com/labstack/echo/middleware" 10 | ) 11 | 12 | func main() { 13 | e := echo.New() 14 | e.Use(middleware.Logger()) 15 | e.Use(middleware.Recover()) 16 | 17 | e.Static("/", "public") 18 | 19 | // JSONP 20 | e.GET("/jsonp", func(c echo.Context) error { 21 | callback := c.QueryParam("callback") 22 | var content struct { 23 | Response string `json:"response"` 24 | Timestamp time.Time `json:"timestamp"` 25 | Random int `json:"random"` 26 | } 27 | content.Response = "Sent via JSONP" 28 | content.Timestamp = time.Now().UTC() 29 | content.Random = rand.Intn(1000) 30 | return c.JSONP(http.StatusOK, callback, &content) 31 | }) 32 | 33 | // Start server 34 | e.Logger.Fatal(e.Start(":1323")) 35 | } 36 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/streaming-response/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | "time" 6 | 7 | "encoding/json" 8 | 9 | "github.com/labstack/echo" 10 | ) 11 | 12 | type ( 13 | Geolocation struct { 14 | Altitude float64 15 | Latitude float64 16 | Longitude float64 17 | } 18 | ) 19 | 20 | var ( 21 | locations = []Geolocation{ 22 | {-97, 37.819929, -122.478255}, 23 | {1899, 39.096849, -120.032351}, 24 | {2619, 37.865101, -119.538329}, 25 | {42, 33.812092, -117.918974}, 26 | {15, 37.77493, -122.419416}, 27 | } 28 | ) 29 | 30 | func main() { 31 | e := echo.New() 32 | e.GET("/", func(c echo.Context) error { 33 | c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSON) 34 | c.Response().WriteHeader(http.StatusOK) 35 | for _, l := range locations { 36 | if err := json.NewEncoder(c.Response()).Encode(l); err != nil { 37 | return err 38 | } 39 | c.Response().Flush() 40 | time.Sleep(1 * time.Second) 41 | } 42 | return nil 43 | }) 44 | e.Logger.Fatal(e.Start(":1323")) 45 | } 46 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/websocket/gorilla/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/labstack/echo" 8 | 9 | "github.com/gorilla/websocket" 10 | "github.com/labstack/echo/middleware" 11 | ) 12 | 13 | var ( 14 | upgrader = websocket.Upgrader{} 15 | ) 16 | 17 | func hello(c echo.Context) error { 18 | ws, err := upgrader.Upgrade(c.Response(), c.Request(), nil) 19 | if err != nil { 20 | return err 21 | } 22 | defer ws.Close() 23 | 24 | for { 25 | // Write 26 | err := ws.WriteMessage(websocket.TextMessage, []byte("Hello, Client!")) 27 | if err != nil { 28 | log.Fatal(err) 29 | } 30 | 31 | // Read 32 | _, msg, err := ws.ReadMessage() 33 | if err != nil { 34 | log.Fatal(err) 35 | } 36 | fmt.Printf("%s\n", msg) 37 | } 38 | } 39 | 40 | func main() { 41 | e := echo.New() 42 | e.Use(middleware.Logger()) 43 | e.Use(middleware.Recover()) 44 | e.Static("/", "../public") 45 | e.GET("/ws", hello) 46 | e.Logger.Fatal(e.Start(":1323")) 47 | } 48 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/websocket/net/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "github.com/labstack/echo" 8 | "github.com/labstack/echo/middleware" 9 | "golang.org/x/net/websocket" 10 | ) 11 | 12 | func hello(c echo.Context) error { 13 | websocket.Handler(func(ws *websocket.Conn) { 14 | defer ws.Close() 15 | for { 16 | // Write 17 | err := websocket.Message.Send(ws, "Hello, Client!") 18 | if err != nil { 19 | log.Fatal(err) 20 | } 21 | 22 | // Read 23 | msg := "" 24 | err = websocket.Message.Receive(ws, &msg) 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | fmt.Printf("%s\n", msg) 29 | } 30 | }).ServeHTTP(c.Response(), c.Request()) 31 | return nil 32 | } 33 | 34 | func main() { 35 | e := echo.New() 36 | e.Use(middleware.Logger()) 37 | e.Use(middleware.Recover()) 38 | e.Static("/", "../public") 39 | e.GET("/ws", hello) 40 | e.Logger.Fatal(e.Start(":1323")) 41 | } 42 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/recipe/websocket/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WebSocket 7 | 8 | 9 | 10 |

11 | 12 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | rm -rf public/v3 && hugo 3 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/godoc/echo.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "echo" 3 | [menu.side] 4 | name = "echo" 5 | parent = "godoc" 6 | weight = 1 7 | url = "https://godoc.org/github.com/labstack/echo" 8 | +++ 9 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/godoc/middleware.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "middleware" 3 | [menu.side] 4 | name = "middleware" 5 | identifier = "godoc-middleware" 6 | parent = "godoc" 7 | weight = 2 8 | url = "https://godoc.org/github.com/labstack/echo/middleware" 9 | +++ 10 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/guide/installation.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Installation" 3 | description = "Installing Echo" 4 | [menu.side] 5 | name = "Installation" 6 | parent = "guide" 7 | weight = 1 8 | +++ 9 | 10 | Echo is developed and tested using Go `1.6.x` and `1.7.x` 11 | 12 | ```sh 13 | $ go get -u github.com/labstack/echo 14 | ``` 15 | 16 | > Ideally you should rely on a [package manager](https://github.com/avelino/awesome-go#package-management) like glide or govendor to use a specific [version](https://github.com/labstack/echo/releases) of Echo. 17 | 18 | ### [Migrating Guide](/guide/migration) 19 | 20 | Echo follows [semantic versioning](http://semver.org) managed through GitHub releases. 21 | Specific version of Echo can be installed using a [package manager](https://github.com/avelino/awesome-go#package-management). 22 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/middleware/gzip.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Gzip Middleware" 3 | description = "Gzip middleware for Echo" 4 | [menu.side] 5 | name = "Gzip" 6 | parent = "middleware" 7 | weight = 5 8 | +++ 9 | 10 | Gzip middleware compresses HTTP response using gzip compression scheme. 11 | 12 | *Usage* 13 | 14 | `e.Use(middleware.Gzip())` 15 | 16 | ## Custom Configuration 17 | 18 | *Usage* 19 | 20 | ```go 21 | e := echo.New() 22 | e.Use(middleware.GzipWithConfig(middleware.GzipConfig{ 23 | Level: 5, 24 | })) 25 | ``` 26 | 27 | ## Configuration 28 | 29 | ```go 30 | GzipConfig struct { 31 | // Skipper defines a function to skip middleware. 32 | Skipper Skipper 33 | 34 | // Gzip compression level. 35 | // Optional. Default value -1. 36 | Level int `json:"level"` 37 | } 38 | ``` 39 | 40 | *Default Configuration* 41 | 42 | ```go 43 | DefaultGzipConfig = GzipConfig{ 44 | Skipper: defaultSkipper, 45 | Level: -1, 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Recipes" 3 | description = "Recipes" 4 | type = "recipes" 5 | +++ 6 | 7 | ## Echo Examples 8 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/cors.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "CORS Example" 3 | description = "CORS example for Echo" 4 | [menu.side] 5 | name = "CORS" 6 | identifier = "cors-middleware" 7 | parent = "recipes" 8 | weight = 3 9 | +++ 10 | 11 | ## Server 12 | 13 | `server.go` 14 | 15 | {{< embed "cors/server.go" >}} 16 | 17 | ## [Source Code]({{< source "cors" >}}) 18 | 19 | ## Maintainers 20 | 21 | - [vishr](https://github.com/vishr) 22 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/embed-resources.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Embed Resources Example" 3 | description = "Embed resources example for Echo" 4 | [menu.side] 5 | name = "Embed Resources" 6 | parent = "recipes" 7 | weight = 14 8 | +++ 9 | 10 | ## With go.rice 11 | 12 | `server.go` 13 | 14 | {{< embed "embed-resources/server.go" >}} 15 | 16 | ## [Source Code]({{< source "embed-resources" >}}) 17 | 18 | ## Maintainers 19 | 20 | - [caarlos0](https://github.com/caarlos0) 21 | - [maddie](https://github.com/maddie) 22 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/file-upload.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "File Upload Example" 3 | description = "File upload example for Echo" 4 | [menu.side] 5 | name = "File Upload" 6 | parent = "recipes" 7 | weight = 7 8 | +++ 9 | 10 | ## How to upload single file with fields? 11 | 12 | ### Server 13 | 14 | `server.go` 15 | 16 | {{< embed "file-upload/single/server.go" >}} 17 | 18 | ### Client 19 | 20 | `index.html` 21 | 22 | {{< embed "file-upload/single/public/index.html" >}} 23 | 24 | ## How to upload multiple files with fields? 25 | 26 | ### Server 27 | 28 | `server.go` 29 | 30 | {{< embed "file-upload/multiple/server.go" >}} 31 | 32 | ### Client 33 | 34 | `index.html` 35 | 36 | {{< embed "file-upload/multiple/public/index.html" >}} 37 | 38 | ## Source Code 39 | 40 | - [single]({{< source "file-upload/single" >}}) 41 | - [multiple]({{< source "file-upload/multiple" >}}) 42 | 43 | ## Maintainers 44 | 45 | - [vishr](https://github.com/vishr) 46 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/graceful-shutdown.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Graceful Shutdown Example" 3 | description = "Graceful shutdown example for Echo" 4 | [menu.side] 5 | name = "Graceful Shutdown" 6 | parent = "recipes" 7 | weight = 13 8 | +++ 9 | 10 | Echo now ships with graceful server termination inside it, to accomplish it Echo 11 | uses `github.com/tylerb/graceful` library. By Default echo uses 15 seconds as shutdown 12 | timeout, giving 15 secs to open connections at the time the server starts to shut-down. 13 | In order to change this default 15 seconds you could change the `ShutdownTimeout` 14 | property of your Echo instance as needed by doing something like: 15 | 16 | `server.go` 17 | 18 | {{< embed "graceful-shutdown/server.go" >}} 19 | 20 | ## Source Code 21 | 22 | - [graceful]({{< source "graceful-shutdown/graceful" >}}) 23 | 24 | ## Maintainers 25 | 26 | - [mertenvg](https://github.com/mertenvg) 27 | - [apaganobeleno](https://github.com/apaganobeleno) 28 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/hello-world.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Hello World Example" 3 | description = "Hello world example for Echo" 4 | [menu.side] 5 | name = "Hello World" 6 | parent = "recipes" 7 | weight = 1 8 | +++ 9 | 10 | ## Server 11 | 12 | `server.go` 13 | 14 | {{< embed "hello-world/server.go" >}} 15 | 16 | ## [Source Code]({{< source "hello-world" >}}) 17 | 18 | ## Maintainers 19 | 20 | - [vishr](https://github.com/vishr) 21 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/jsonp.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "JSONP Example" 3 | description = "JSONP example for Echo" 4 | [menu.side] 5 | name = "JSONP" 6 | parent = "recipes" 7 | weight = 6 8 | +++ 9 | 10 | JSONP is a method that allows cross-domain server calls. You can read more about it at the JSON versus JSONP Tutorial. 11 | 12 | ## Server 13 | 14 | `server.go` 15 | 16 | {{< embed "jsonp/server.go" >}} 17 | 18 | ## Client 19 | 20 | `index.html` 21 | 22 | {{< embed "jsonp/public/index.html" >}} 23 | 24 | ## [Source Code]({{< source "jsonp" >}}) 25 | 26 | ## Maintainers 27 | 28 | - [willf](https://github.com/willf) 29 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/middleware.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Middleware Example" 3 | description = "Middleware example for Echo" 4 | [menu.side] 5 | name = "Middleware" 6 | parent = "recipes" 7 | weight = 3 8 | +++ 9 | 10 | ## How to write a custom middleware? 11 | 12 | - Middleware to collect request count, statuses and uptime. 13 | - Middleware to write custom `Server` header to the response. 14 | 15 | ### Server 16 | 17 | `server.go` 18 | 19 | {{< embed "middleware/server.go" >}} 20 | 21 | ### Response 22 | 23 | *Headers* 24 | ```sh 25 | Content-Length:122 26 | Content-Type:application/json; charset=utf-8 27 | Date:Thu, 14 Apr 2016 20:31:46 GMT 28 | Server:Echo/2.0 29 | ``` 30 | 31 | *Body* 32 | 33 | ```js 34 | { 35 | "uptime": "2016-04-14T13:28:48.486548936-07:00", 36 | "requestCount": 5, 37 | "statuses": { 38 | "200": 4, 39 | "404": 1 40 | } 41 | } 42 | ``` 43 | 44 | ## [Source Code]({{< source "middleware" >}}) 45 | 46 | ## Maintainers 47 | 48 | - [vishr](https://github.com/vishr) 49 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/streaming-response.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Streaming Response Example" 3 | description = "Streaming response example for Echo" 4 | [menu.side] 5 | name = "Streaming Response" 6 | parent = "recipes" 7 | weight = 3 8 | +++ 9 | 10 | - Send data as it is produced 11 | - Streaming JSON response with chunked transfer encoding 12 | 13 | ## Server 14 | 15 | `server.go` 16 | 17 | {{< embed "streaming-response/server.go" >}} 18 | 19 | ## Client 20 | 21 | ```sh 22 | $ curl localhost:1323 23 | ``` 24 | 25 | ## Output 26 | 27 | ```sh 28 | {"Altitude":-97,"Latitude":37.819929,"Longitude":-122.478255} 29 | {"Altitude":1899,"Latitude":39.096849,"Longitude":-120.032351} 30 | {"Altitude":2619,"Latitude":37.865101,"Longitude":-119.538329} 31 | {"Altitude":42,"Latitude":33.812092,"Longitude":-117.918974} 32 | {"Altitude":15,"Latitude":37.77493,"Longitude":-122.419416} 33 | ``` 34 | 35 | ## [Source Code]({{< source "streaming-response" >}}) 36 | 37 | ## Maintainers 38 | 39 | - [vishr](https://github.com/vishr) 40 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/subdomains.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Subdomains Example" 3 | description = "Subdomains example for Echo" 4 | [menu.side] 5 | name = "Subdomains" 6 | parent = "recipes" 7 | weight = 10 8 | +++ 9 | 10 | `server.go` 11 | 12 | {{< embed "subdomains/server.go" >}} 13 | 14 | ## [Source Code]({{< source "subdomains" >}}) 15 | 16 | ## Maintainers 17 | 18 | - [axdg](https://github.com/axdg) 19 | - [vishr](https://github.com/vishr) 20 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/recipes/websocket.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "WebSocket Example" 3 | description = "WebSocket example for Echo" 4 | [menu.side] 5 | name = "WebSocket" 6 | parent = "recipes" 7 | weight = 5 8 | +++ 9 | 10 | ## Using `net` WebSocket 11 | 12 | ### Server 13 | 14 | `server.go` 15 | 16 | {{< embed "websocket/net/server.go" >}} 17 | 18 | ## Using `gorilla` WebSocket 19 | 20 | ### Server 21 | 22 | `server.go` 23 | 24 | {{< embed "websocket/gorilla/server.go" >}} 25 | 26 | ## Client 27 | 28 | `index.html` 29 | 30 | {{< embed "websocket/public/index.html" >}} 31 | 32 | ## Output 33 | 34 | `Client` 35 | 36 | ```sh 37 | Hello, Client! 38 | Hello, Client! 39 | Hello, Client! 40 | Hello, Client! 41 | Hello, Client! 42 | ``` 43 | 44 | `Server` 45 | 46 | ```sh 47 | Hello, Server! 48 | Hello, Server! 49 | Hello, Server! 50 | Hello, Server! 51 | Hello, Server! 52 | ``` 53 | 54 | ## [Source Code]({{< source "websocket" >}}) 55 | 56 | ## Maintainers 57 | 58 | - [vishr](https://github.com/vishr) 59 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/content/support-echo.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Support Echo" 3 | description = "Support Echo" 4 | +++ 5 | 6 |

7 |
8 |
9 |

Support via Patreon (recurring pledge)

10 | 11 |

12 | 13 |

14 |
15 |
16 |

Donate via PayPal (one time)

17 | 18 |

19 | 20 | Echo is an MIT licensed open source project and completely free to use. If you are 21 | using Echo in your products/projects, please consider sponsoring Echo to ensure 22 | it is actively developed and maintained. 23 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/data/index.toml: -------------------------------------------------------------------------------- 1 | h1 = "Echo" 2 | h2 = "High performance, extensible, minimalist web framework for Go" 3 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ partial "head.html" . }} 2 | 3 | {{ partial "navbar.html" . }} 4 | {{ partial "sidenav.html" . }} 5 | {{ partial "search.html" . }} 6 |
7 | {{ partial "ad.html" }} 8 |
9 |
10 | {{ partial "notice.html" }} 11 | 27 |
28 |
29 |
30 | {{ partial "footer.html" . }} 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/ad.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 11 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/connect.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/website/layouts/partials/connect.html -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/navbar.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/notice.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Check out our new project Armor 4 |

5 |

6 | Uncomplicated HTTP server, supports HTTP/2 and auto TLS 7 |

8 |
9 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/search.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/share.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/partials/sidenav.html: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /src/github.com/labstack/echo/website/layouts/shortcodes/embed.html: -------------------------------------------------------------------------------- 1 |

2 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/layouts/shortcodes/source.html:
--------------------------------------------------------------------------------
1 | https://github.com/labstack/echo/tree/master/recipe/{{ .Get 0 }}
2 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/static/images/echo_terminal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/website/static/images/echo_terminal.png


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/static/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/website/static/images/logo.png


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/static/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/static/scripts/main.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/github.com/labstack/echo/website/static/scripts/main.js


--------------------------------------------------------------------------------
/src/github.com/labstack/echo/website/static/styles/main.css:
--------------------------------------------------------------------------------
1 | .navbar .links a {
2 |   text-decoration: none;
3 |   color: inherit;
4 |   margin-left: 12px;
5 | }
6 | .navbar .links a:hover {
7 |   border-bottom: 4px solid #00AFD1;
8 | }
9 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/.travis.yml:
--------------------------------------------------------------------------------
 1 | language: go
 2 | go:
 3 |     - 1.6
 4 |     - 1.7
 5 |     - tip
 6 | before_install:
 7 |     - go get github.com/modocache/gover
 8 |     - go get github.com/mattn/goveralls
 9 |     - go get golang.org/x/tools/cmd/cover
10 | script:
11 |     - go test -race ./...
12 |     - go test -coverprofile=color.coverprofile ./color
13 |     - go test -coverprofile=bytes.coverprofile ./bytes
14 |     - go test -coverprofile=log.coverprofile ./log
15 |     - go test -coverprofile=random.coverprofile ./random
16 |     - gover
17 |     - goveralls -coverprofile=gover.coverprofile -service=travis-ci
18 | matrix:
19 |   allow_failures:
20 |     - go: tip
21 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/README.md:
--------------------------------------------------------------------------------
1 | # Gommon [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/gommon) [![Build Status](http://img.shields.io/travis/labstack/gommon.svg?style=flat-square)](https://travis-ci.org/labstack/gommon) [![Coverage Status](http://img.shields.io/coveralls/labstack/gommon.svg?style=flat-square)](https://coveralls.io/r/labstack/gommon)
2 | 
3 | Common packages for Go
4 | - [Bytes](https://github.com/labstack/gommon/tree/master/bytes) - Format/parse bytes.
5 | - [Color](https://github.com/labstack/gommon/tree/master/color) - Style terminal text.
6 | - [Log](https://github.com/labstack/gommon/tree/master/log) - Simple logging.
7 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/bytes/README.md:
--------------------------------------------------------------------------------
 1 | # Bytes
 2 | 
 3 | - Format bytes integer to human readable bytes string.
 4 | - Parse human readable bytes string to bytes integer.
 5 | 
 6 | ## Installation
 7 | 
 8 | ```go
 9 | go get github.com/labstack/gommon/bytes
10 | ```
11 | 
12 | ## [Usage](https://github.com/labstack/gommon/blob/master/bytes/bytes_test.go)
13 | 
14 | ### Format
15 | 
16 | ```go
17 | println(bytes.Format(13231323))
18 | ```
19 | 
20 | `12.62MB`
21 | 
22 | ### Parse
23 | 
24 | ```go
25 | b, _ = Parse("2M")
26 | println(b)
27 | ```
28 | 
29 | `2097152`
30 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/glide.lock:
--------------------------------------------------------------------------------
 1 | hash: bcc8372e328f52bdff7d94805509d05082dc1cffb53d7f5d764187b148bc0e31
 2 | updated: 2016-11-17T11:50:51.708359983-08:00
 3 | imports:
 4 | - name: github.com/mattn/go-colorable
 5 |   version: ed8eb9e318d7a84ce5915b495b7d35e0cfe7b5a8
 6 | - name: github.com/mattn/go-isatty
 7 |   version: 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8
 8 | - name: github.com/valyala/fasttemplate
 9 |   version: 3b874956e03f1636d171bda64b130f9135f42cff
10 | - name: golang.org/x/sys
11 |   version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9
12 |   subpackages:
13 |   - unix
14 | testImports:
15 | - name: github.com/davecgh/go-spew
16 |   version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d
17 |   subpackages:
18 |   - spew
19 | - name: github.com/pmezard/go-difflib
20 |   version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
21 |   subpackages:
22 |   - difflib
23 | - name: github.com/stretchr/testify
24 |   version: d77da356e56a7428ad25149ca77381849a6a5232
25 |   subpackages:
26 |   - assert
27 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/glide.yaml:
--------------------------------------------------------------------------------
 1 | package: github.com/labstack/gommon
 2 | import:
 3 | - package: github.com/mattn/go-colorable
 4 | - package: github.com/mattn/go-isatty
 5 | - package: github.com/valyala/fasttemplate
 6 | testImport:
 7 | - package: github.com/stretchr/testify
 8 |   subpackages:
 9 |   - assert
10 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/gommon.go:
--------------------------------------------------------------------------------
1 | package gommon
2 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/log/README.md:
--------------------------------------------------------------------------------
1 | ## WORK IN PROGRESS
2 | 
3 | ### Usage
4 | 
5 | [log_test.go](log_test.go)
6 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/log/color.go:
--------------------------------------------------------------------------------
 1 | // +build !appengine
 2 | 
 3 | package log
 4 | 
 5 | import (
 6 | 	"io"
 7 | 
 8 | 	"github.com/mattn/go-colorable"
 9 | )
10 | 
11 | func output() io.Writer {
12 | 	return colorable.NewColorableStdout()
13 | }
14 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/log/white.go:
--------------------------------------------------------------------------------
 1 | // +build appengine
 2 | 
 3 | package log
 4 | 
 5 | import (
 6 | 	"io"
 7 | 	"os"
 8 | )
 9 | 
10 | func output() io.Writer {
11 | 	return os.Stdout
12 | }
13 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/random/random.go:
--------------------------------------------------------------------------------
 1 | package random
 2 | 
 3 | import (
 4 | 	"math/rand"
 5 | 	"time"
 6 | )
 7 | 
 8 | type (
 9 | 	Random struct {
10 | 		charset Charset
11 | 	}
12 | 
13 | 	Charset string
14 | )
15 | 
16 | const (
17 | 	Alphanumeric Charset = Alphabetic + Numeric
18 | 	Alphabetic   Charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
19 | 	Numeric      Charset = "0123456789"
20 | 	Hex          Charset = Numeric + "abcdef"
21 | )
22 | 
23 | var (
24 | 	global = New()
25 | )
26 | 
27 | func New() *Random {
28 | 	rand.Seed(time.Now().UnixNano())
29 | 	return &Random{
30 | 		charset: Alphanumeric,
31 | 	}
32 | }
33 | 
34 | func (r *Random) SetCharset(c Charset) {
35 | 	r.charset = c
36 | }
37 | 
38 | func (r *Random) String(length uint8) string {
39 | 	b := make([]byte, length)
40 | 	for i := range b {
41 | 		b[i] = r.charset[rand.Int63()%int64(len(r.charset))]
42 | 	}
43 | 	return string(b)
44 | }
45 | 
46 | func SetCharset(c Charset) {
47 | 	global.SetCharset(c)
48 | }
49 | 
50 | func String(length uint8) string {
51 | 	return global.String(length)
52 | }
53 | 


--------------------------------------------------------------------------------
/src/github.com/labstack/gommon/random/random_test.go:
--------------------------------------------------------------------------------
 1 | package random
 2 | 
 3 | import (
 4 | 	"testing"
 5 | 
 6 | 	"github.com/stretchr/testify/assert"
 7 | )
 8 | 
 9 | func Test(t *testing.T) {
10 | 	assert.Len(t, String(32), 32)
11 | 	r := New()
12 | 	r.SetCharset(Numeric)
13 | 	assert.Len(t, r.String(8), 8)
14 | }
15 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/src/github.com/mattn/go-colorable/colorable_others.go:
--------------------------------------------------------------------------------
 1 | // +build !windows
 2 | 
 3 | package colorable
 4 | 
 5 | import (
 6 | 	"io"
 7 | 	"os"
 8 | )
 9 | 
10 | func NewColorableStdout() io.Writer {
11 | 	return os.Stdout
12 | }
13 | 
14 | func NewColorableStderr() io.Writer {
15 | 	return os.Stderr
16 | }
17 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/src/github.com/mattn/go-isatty/doc.go:
--------------------------------------------------------------------------------
1 | // Package isatty implements interface to isatty
2 | package isatty
3 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/src/github.com/mattn/go-isatty/isatty_bsd.go:
--------------------------------------------------------------------------------
 1 | // +build darwin freebsd openbsd netbsd
 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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/src/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme/challenges.go:
--------------------------------------------------------------------------------
 1 | package acme
 2 | 
 3 | // Challenge is a string that identifies a particular type and version of ACME challenge.
 4 | type Challenge string
 5 | 
 6 | const (
 7 | 	// HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#http
 8 | 	// Note: HTTP01ChallengePath returns the URL path to fulfill this challenge
 9 | 	HTTP01 = Challenge("http-01")
10 | 	// TLSSNI01 is the "tls-sni-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#tls-with-server-name-indication-tls-sni
11 | 	// Note: TLSSNI01ChallengeCert returns a certificate to fulfill this challenge
12 | 	TLSSNI01 = Challenge("tls-sni-01")
13 | 	// DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#dns
14 | 	// Note: DNS01Record returns a DNS record which will fulfill this challenge
15 | 	DNS01 = Challenge("dns-01")
16 | )
17 | 


--------------------------------------------------------------------------------
/src/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme/utils.go:
--------------------------------------------------------------------------------
 1 | package acme
 2 | 
 3 | import (
 4 | 	"fmt"
 5 | 	"time"
 6 | )
 7 | 
 8 | // WaitFor polls the given function 'f', once every 'interval', up to 'timeout'.
 9 | func WaitFor(timeout, interval time.Duration, f func() (bool, error)) error {
10 | 	var lastErr string
11 | 	timeup := time.After(timeout)
12 | 	for {
13 | 		select {
14 | 		case <-timeup:
15 | 			return fmt.Errorf("Time limit exceeded. Last error: %s", lastErr)
16 | 		default:
17 | 		}
18 | 
19 | 		stop, err := f()
20 | 		if stop {
21 | 			return nil
22 | 		}
23 | 		if err != nil {
24 | 			lastErr = err.Error()
25 | 		}
26 | 
27 | 		time.Sleep(interval)
28 | 	}
29 | }
30 | 


--------------------------------------------------------------------------------
/src/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme/utils_test.go:
--------------------------------------------------------------------------------
 1 | package acme
 2 | 
 3 | import (
 4 | 	"testing"
 5 | 	"time"
 6 | )
 7 | 
 8 | func TestWaitForTimeout(t *testing.T) {
 9 | 	c := make(chan error)
10 | 	go func() {
11 | 		err := WaitFor(3*time.Second, 1*time.Second, func() (bool, error) {
12 | 			return false, nil
13 | 		})
14 | 		c <- err
15 | 	}()
16 | 
17 | 	timeout := time.After(4 * time.Second)
18 | 	select {
19 | 	case <-timeout:
20 | 		t.Fatal("timeout exceeded")
21 | 	case err := <-c:
22 | 		if err == nil {
23 | 			t.Errorf("expected timeout error; got %v", err)
24 | 		}
25 | 	}
26 | }
27 | 


--------------------------------------------------------------------------------
/src/github.com/rsc/letsencrypt/vendor/vendor.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"comment": "",
 3 | 	"ignore": "",
 4 | 	"package": [
 5 | 		{
 6 | 			"checksumSHA1": "CHmdoMriAboKW2nHYSXo0yBizaE=",
 7 | 			"path": "github.com/xenolf/lego/acme",
 8 | 			"revision": "ca19a90028e242e878585941c2a27c8f3b3efc25",
 9 | 			"revisionTime": "2016-03-28T16:28:34Z"
10 | 		},
11 | 		{
12 | 			"checksumSHA1": "jrheBzltbBE1frmNXQiu911T7dE=",
13 | 			"path": "gopkg.in/square/go-jose.v1",
14 | 			"revision": "40d457b439244b546f023d056628e5184136899b",
15 | 			"revisionTime": "2016-03-29T20:33:11Z"
16 | 		},
17 | 		{
18 | 			"checksumSHA1": "fX4KSC9E1oX9yRx20Zjb3rVJHn4=",
19 | 			"path": "gopkg.in/square/go-jose.v1/cipher",
20 | 			"revision": "40d457b439244b546f023d056628e5184136899b",
21 | 			"revisionTime": "2016-03-29T20:33:11Z"
22 | 		},
23 | 		{
24 | 			"checksumSHA1": "NxdXsIcLGuuX654ygsaOhoLsg6s=",
25 | 			"path": "gopkg.in/square/go-jose.v1/json",
26 | 			"revision": "40d457b439244b546f023d056628e5184136899b",
27 | 			"revisionTime": "2016-03-29T20:33:11Z"
28 | 		}
29 | 	],
30 | 	"rootPath": "rsc.io/letsencrypt"
31 | }
32 | 


--------------------------------------------------------------------------------
/src/github.com/tylerb/graceful/.travis.yml:
--------------------------------------------------------------------------------
 1 | language: go
 2 | sudo: false
 3 | go:
 4 |   - 1.7
 5 |   - 1.6.2
 6 |   - 1.5.4
 7 |   - 1.4.3
 8 |   - 1.3.3
 9 | before_install:
10 |   - go get github.com/mattn/goveralls
11 |   - go get golang.org/x/tools/cmd/cover
12 | script:
13 |   - $HOME/gopath/bin/goveralls -service=travis-ci
14 | 


--------------------------------------------------------------------------------
/src/github.com/tylerb/graceful/keepalive_listener.go:
--------------------------------------------------------------------------------
 1 | package graceful
 2 | 
 3 | import (
 4 | 	"net"
 5 | 	"time"
 6 | )
 7 | 
 8 | type keepAliveConn interface {
 9 | 	SetKeepAlive(bool) error
10 | 	SetKeepAlivePeriod(d time.Duration) error
11 | }
12 | 
13 | // keepAliveListener sets TCP keep-alive timeouts on accepted
14 | // connections. It's used by ListenAndServe and ListenAndServeTLS so
15 | // dead TCP connections (e.g. closing laptop mid-download) eventually
16 | // go away.
17 | type keepAliveListener struct {
18 | 	net.Listener
19 | 	keepAlivePeriod time.Duration
20 | }
21 | 
22 | func (ln keepAliveListener) Accept() (net.Conn, error) {
23 | 	c, err := ln.Listener.Accept()
24 | 	if err != nil {
25 | 		return nil, err
26 | 	}
27 | 
28 | 	kac := c.(keepAliveConn)
29 | 	kac.SetKeepAlive(true)
30 | 	kac.SetKeepAlivePeriod(ln.keepAlivePeriod)
31 | 	return c, nil
32 | }
33 | 


--------------------------------------------------------------------------------
/src/github.com/tylerb/graceful/signal.go:
--------------------------------------------------------------------------------
 1 | //+build !appengine
 2 | 
 3 | package graceful
 4 | 
 5 | import (
 6 | 	"os"
 7 | 	"os/signal"
 8 | 	"syscall"
 9 | )
10 | 
11 | func signalNotify(interrupt chan<- os.Signal) {
12 | 	signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
13 | }
14 | 
15 | func sendSignalInt(interrupt chan<- os.Signal) {
16 | 	interrupt <- syscall.SIGINT
17 | }
18 | 


--------------------------------------------------------------------------------
/src/github.com/tylerb/graceful/signal_appengine.go:
--------------------------------------------------------------------------------
 1 | //+build appengine
 2 | 
 3 | package graceful
 4 | 
 5 | import "os"
 6 | 
 7 | func signalNotify(interrupt chan<- os.Signal) {
 8 | 	// Does not notify in the case of AppEngine.
 9 | }
10 | 
11 | func sendSignalInt(interrupt chan<- os.Signal) {
12 | 	// Does not send in the case of AppEngine.
13 | }
14 | 


--------------------------------------------------------------------------------
/src/github.com/tylerb/graceful/tests/main.go:
--------------------------------------------------------------------------------
 1 | package main
 2 | 
 3 | import (
 4 | 	"fmt"
 5 | 	"sync"
 6 | 
 7 | 	"github.com/urfave/negroni"
 8 | 	"gopkg.in/tylerb/graceful.v1"
 9 | )
10 | 
11 | func main() {
12 | 
13 | 	var wg sync.WaitGroup
14 | 
15 | 	wg.Add(3)
16 | 	go func() {
17 | 		n := negroni.New()
18 | 		fmt.Println("Launching server on :3000")
19 | 		graceful.Run(":3000", 0, n)
20 | 		fmt.Println("Terminated server on :3000")
21 | 		wg.Done()
22 | 	}()
23 | 	go func() {
24 | 		n := negroni.New()
25 | 		fmt.Println("Launching server on :3001")
26 | 		graceful.Run(":3001", 0, n)
27 | 		fmt.Println("Terminated server on :3001")
28 | 		wg.Done()
29 | 	}()
30 | 	go func() {
31 | 		n := negroni.New()
32 | 		fmt.Println("Launching server on :3002")
33 | 		graceful.Run(":3002", 0, n)
34 | 		fmt.Println("Terminated server on :3002")
35 | 		wg.Done()
36 | 	}()
37 | 	fmt.Println("Press ctrl+c. All servers should terminate.")
38 | 	wg.Wait()
39 | 
40 | }
41 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/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 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/Makefile:
--------------------------------------------------------------------------------
1 | startdb:
2 | 	@harness/setup.sh start
3 | 
4 | stopdb:
5 | 	@harness/setup.sh stop
6 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/README.md:
--------------------------------------------------------------------------------
1 | The MongoDB driver for Go
2 | -------------------------
3 | 
4 | Please go to [http://labix.org/mgo](http://labix.org/mgo) for all project details.
5 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/bson/specdata/update.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | set -e
 4 | 
 5 | if [ ! -d specifications ]; then
 6 | 	git clone -b bson git@github.com:jyemin/specifications
 7 | fi
 8 | 
 9 | TESTFILE="../specdata_test.go"
10 | 
11 | cat < $TESTFILE
12 | package bson_test
13 | 
14 | var specTests = []string{
15 | END
16 | 
17 | for file in specifications/source/bson/tests/*.yml; do
18 | 	(
19 | 		echo '`'
20 | 		cat $file
21 | 		echo -n '`,'
22 | 	) >> $TESTFILE
23 | done
24 | 
25 | echo '}' >> $TESTFILE
26 | 
27 | gofmt -w $TESTFILE
28 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/dbtest/export_test.go:
--------------------------------------------------------------------------------
 1 | package dbtest
 2 | 
 3 | import (
 4 | 	"os"
 5 | )
 6 | 
 7 | func (dbs *DBServer) ProcessTest() *os.Process {
 8 | 	if dbs.server == nil {
 9 | 		return nil
10 | 	}
11 | 	return dbs.server.Process
12 | }
13 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/export_test.go:
--------------------------------------------------------------------------------
 1 | package mgo
 2 | 
 3 | import (
 4 | 	"time"
 5 | )
 6 | 
 7 | func HackPingDelay(newDelay time.Duration) (restore func()) {
 8 | 	globalMutex.Lock()
 9 | 	defer globalMutex.Unlock()
10 | 
11 | 	oldDelay := pingDelay
12 | 	restore = func() {
13 | 		globalMutex.Lock()
14 | 		pingDelay = oldDelay
15 | 		globalMutex.Unlock()
16 | 	}
17 | 	pingDelay = newDelay
18 | 	return
19 | }
20 | 
21 | func HackSyncSocketTimeout(newTimeout time.Duration) (restore func()) {
22 | 	globalMutex.Lock()
23 | 	defer globalMutex.Unlock()
24 | 
25 | 	oldTimeout := syncSocketTimeout
26 | 	restore = func() {
27 | 		globalMutex.Lock()
28 | 		syncSocketTimeout = oldTimeout
29 | 		globalMutex.Unlock()
30 | 	}
31 | 	syncSocketTimeout = newTimeout
32 | 	return
33 | }
34 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/certs/client.req:
--------------------------------------------------------------------------------
 1 | -----BEGIN CERTIFICATE REQUEST-----
 2 | MIICoTCCAYkCAQAwXDELMAkGA1UEBhMCR08xDDAKBgNVBAgMA01HTzEMMAoGA1UE
 3 | BwwDTUdPMQwwCgYDVQQKDANNR08xDzANBgNVBAsMBkNsaWVudDESMBAGA1UEAwwJ
 4 | bG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtFIkIZk/
 5 | h+CCKq5/EjBEg873Jd68CJsFKESB5Zl5KLwiGQm7wQidZwLul+cyDfPRDzzo3za4
 6 | GetesD4FVf2BEF6fg+/o0wLBObPCXqUVxXXnEXrJr4f/tItg0riOEBbLslQDzNTt
 7 | CAEORCoK9MHmWZrF+pYTw+LmHoVeA8QxNIv/GkwJQ6DYEQgCa2BTIWq0Uw3WO20M
 8 | 3e2WGm/6Sv9w0pjisZfwBSfBJ5nI/cNW7L8tH4AIKBhAZwa7vND0RaRYqpO9kyZF
 9 | zh8e83GBaXoLSj2wK3kwjKHWgp4z//37JAqeFya5Hx+ftNTXnl/69TnxG44BP8M8
10 | 8ZfDWlpzwpsTXwIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAKbOFblIscxlXalV
11 | sEGNm2oz380RN2QoLhN6nKtAiv0jWm6iKhdAhOIQIeaRPhUP3cyi8bcBvLdMeQ3d
12 | ZYIByB55/R0VSP1vs4qkXJCQegHcpMpyuIzsMV8p3Q4lxzGKyKtPA6Bb5c49p8Sk
13 | ncD+LL4ymrMEia4cBPsHL9hhFOm4gqDacbU8+ETLTpuoSvUZiw7OwngqhE2r+kMv
14 | KDweq5TOPeb+ftKzQKrrfB+XVdBoTKYw6CwARpogbc0/7mvottVcJ/0yAgC1fBbM
15 | vupkohkXwKfjxKl6nKNL3R2GkzHQOh91hglAx5zyybKQn2YMM328Vk4X6csBg+pg
16 | tb1s0MA=
17 | -----END CERTIFICATE REQUEST-----
18 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg1/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/cfg1/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg1/db/mongod.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/cfg1/db/mongod.lock


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg1/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg1/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONCOPTS \
6 | 	--port 40101 \
7 | 	--configsvr
8 | 
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg2/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/cfg2/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg2/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg2/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONCOPTS \
6 | 	--port 40102 \
7 | 	--configsvr
8 | 
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg3/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/cfg3/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg3/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/cfg3/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | exec mongod $COMMONCOPTS \
 6 | 	--port 40103 \
 7 | 	--configsvr \
 8 | 	--auth \
 9 | 	--keyFile=../../certs/keyfile
10 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db1/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/db1/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db1/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db1/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | if [ x$NOIPV6 = x1 ]; then
 6 | 	BINDIP="127.0.0.1"
 7 | else
 8 | 	BINDIP="127.0.0.1,::1"
 9 | fi
10 | 
11 | exec mongod $COMMONDOPTSNOIP \
12 | 	--shardsvr \
13 | 	--bind_ip=$BINDIP \
14 | 	--port 40001 \
15 | 	--ipv6
16 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db2/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/db2/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db2/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db2/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--port 40002 \
8 | 	--auth
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db3/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/db3/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db3/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/db3/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | exec mongod $COMMONDOPTS \
 6 | 	--shardsvr \
 7 | 	--port 40003 \
 8 | 	--auth \
 9 | 	--sslMode preferSSL \
10 | 	--sslCAFile ../../certs/server.pem \
11 | 	--sslPEMKeyFile ../../certs/server.pem
12 | 
13 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1a/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs1a/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1a/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1a/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs1 \
8 | 	--port 40011
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1b/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs1b/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1b/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1b/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs1 \
8 | 	--port 40012
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1c/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs1c/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1c/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs1c/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs1 \
8 | 	--port 40013
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2a/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs2a/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2a/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2a/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs2 \
8 | 	--port 40021
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2b/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs2b/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2b/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2b/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs2 \
8 | 	--port 40022
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2c/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs2c/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2c/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs2c/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs2 \
8 | 	--port 40023
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3a/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs3a/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3a/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3a/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | exec mongod $COMMONDOPTS \
 6 | 	--shardsvr \
 7 | 	--replSet rs3 \
 8 | 	--port 40031 \
 9 | 	--keyFile=../../certs/keyfile
10 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3b/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs3b/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3b/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3b/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | exec mongod $COMMONDOPTS \
 6 | 	--shardsvr \
 7 | 	--replSet rs3 \
 8 | 	--port 40032 \
 9 | 	--keyFile=../../certs/keyfile
10 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3c/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs3c/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3c/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs3c/run:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | . ../.env
 4 | 
 5 | exec mongod $COMMONDOPTS \
 6 | 	--shardsvr \
 7 | 	--replSet rs3 \
 8 | 	--port 40033 \
 9 | 	--keyFile=../../certs/keyfile
10 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs4a/db/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/harness/daemons/rs4a/db/.empty


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs4a/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/rs4a/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongod $COMMONDOPTS \
6 | 	--shardsvr \
7 | 	--replSet rs4 \
8 | 	--port 40041
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s1/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s1/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongos $COMMONSOPTS \
6 | 	--port 40201 \
7 | 	--configdb 127.0.0.1:40101
8 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s2/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s2/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongos $COMMONSOPTS \
6 | 	--port 40202 \
7 | 	--configdb 127.0.0.1:40102
8 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s3/log/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | exec cat - > log.txt
4 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/harness/daemons/s3/run:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | 
3 | . ../.env
4 | 
5 | exec mongos $COMMONSOPTS \
6 | 	--port 40203 \
7 | 	--configdb 127.0.0.1:40103 \
8 | 	--keyFile=../../certs/keyfile
9 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/internal/json/tags_test.go:
--------------------------------------------------------------------------------
 1 | // Copyright 2011 The Go Authors. All rights reserved.
 2 | // Use of this source code is governed by a BSD-style
 3 | // license that can be found in the LICENSE file.
 4 | 
 5 | package json
 6 | 
 7 | import (
 8 | 	"testing"
 9 | )
10 | 
11 | func TestTagParsing(t *testing.T) {
12 | 	name, opts := parseTag("field,foobar,foo")
13 | 	if name != "field" {
14 | 		t.Fatalf("name = %q, want field", name)
15 | 	}
16 | 	for _, tt := range []struct {
17 | 		opt  string
18 | 		want bool
19 | 	}{
20 | 		{"foobar", true},
21 | 		{"foo", true},
22 | 		{"bar", false},
23 | 	} {
24 | 		if opts.Contains(tt.opt) != tt.want {
25 | 			t.Errorf("Contains(%q) = %v", tt.opt, !tt.want)
26 | 		}
27 | 	}
28 | }
29 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/internal/json/testdata/code.json.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/internal/json/testdata/code.json.gz


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/internal/sasl/sasl_windows.h:
--------------------------------------------------------------------------------
1 | #include 
2 | 
3 | #include "sspi_windows.h"
4 | 
5 | SECURITY_STATUS SEC_ENTRY sspi_acquire_credentials_handle(CredHandle* cred_handle, char* username, char* password, char* domain);
6 | int sspi_step(CredHandle* cred_handle, int has_context, CtxtHandle* context, PVOID buffer, ULONG buffer_length, PVOID* out_buffer, ULONG* out_buffer_length, char* target);
7 | int sspi_send_client_authz_id(CtxtHandle* context, PVOID* buffer, ULONG* buffer_length, char* user_plus_realm);
8 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/raceoff.go:
--------------------------------------------------------------------------------
1 | // +build !race
2 | 
3 | package mgo
4 | 
5 | const raceDetector = false
6 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/raceon.go:
--------------------------------------------------------------------------------
1 | // +build race
2 | 
3 | package mgo
4 | 
5 | const raceDetector = true
6 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/saslimpl.go:
--------------------------------------------------------------------------------
 1 | //+build sasl
 2 | 
 3 | package mgo
 4 | 
 5 | import (
 6 | 	"gopkg.in/mgo.v2/internal/sasl"
 7 | )
 8 | 
 9 | func saslNew(cred Credential, host string) (saslStepper, error) {
10 | 	return sasl.New(cred.Username, cred.Password, cred.Mechanism, cred.Service, host)
11 | }
12 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/saslstub.go:
--------------------------------------------------------------------------------
 1 | //+build !sasl
 2 | 
 3 | package mgo
 4 | 
 5 | import (
 6 | 	"fmt"
 7 | )
 8 | 
 9 | func saslNew(cred Credential, host string) (saslStepper, error) {
10 | 	return nil, fmt.Errorf("SASL support not enabled during build (-tags sasl)")
11 | }
12 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/syscall_test.go:
--------------------------------------------------------------------------------
 1 | // +build !windows
 2 | 
 3 | package mgo_test
 4 | 
 5 | import (
 6 | 	"syscall"
 7 | )
 8 | 
 9 | func stop(pid int) (err error) {
10 | 	return syscall.Kill(pid, syscall.SIGSTOP)
11 | }
12 | 
13 | func cont(pid int) (err error) {
14 | 	return syscall.Kill(pid, syscall.SIGCONT)
15 | }
16 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/syscall_windows_test.go:
--------------------------------------------------------------------------------
 1 | package mgo_test
 2 | 
 3 | func stop(pid int) (err error) {
 4 | 	panicOnWindows() // Always does.
 5 | 	return nil
 6 | }
 7 | 
 8 | func cont(pid int) (err error) {
 9 | 	panicOnWindows() // Always does.
10 | 	return nil
11 | }
12 | 


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/txn/output.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/mgo.v2/txn/output.txt


--------------------------------------------------------------------------------
/src/gopkg.in/mgo.v2/txn/tarjan_test.go:
--------------------------------------------------------------------------------
 1 | package txn
 2 | 
 3 | import (
 4 | 	"fmt"
 5 | 	"gopkg.in/mgo.v2/bson"
 6 | 	. "gopkg.in/check.v1"
 7 | )
 8 | 
 9 | type TarjanSuite struct{}
10 | 
11 | var _ = Suite(TarjanSuite{})
12 | 
13 | func bid(n int) bson.ObjectId {
14 | 	return bson.ObjectId(fmt.Sprintf("%024d", n))
15 | }
16 | 
17 | func bids(ns ...int) (ids []bson.ObjectId) {
18 | 	for _, n := range ns {
19 | 		ids = append(ids, bid(n))
20 | 	}
21 | 	return
22 | }
23 | 
24 | func (TarjanSuite) TestExample(c *C) {
25 | 	successors := map[bson.ObjectId][]bson.ObjectId{
26 | 		bid(1): bids(2, 3),
27 | 		bid(2): bids(1, 5),
28 | 		bid(3): bids(4),
29 | 		bid(4): bids(3, 5),
30 | 		bid(5): bids(6),
31 | 		bid(6): bids(7),
32 | 		bid(7): bids(8),
33 | 		bid(8): bids(6, 9),
34 | 		bid(9): bids(),
35 | 	}
36 | 
37 | 	c.Assert(tarjanSort(successors), DeepEquals, [][]bson.ObjectId{
38 | 		bids(9),
39 | 		bids(6, 7, 8),
40 | 		bids(5),
41 | 		bids(3, 4),
42 | 		bids(1, 2),
43 | 	})
44 | }
45 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/.gitcookies.sh.enc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/square/go-jose.v1/.gitcookies.sh.enc


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/BUG-BOUNTY.md:
--------------------------------------------------------------------------------
 1 | Serious about security
 2 | ======================
 3 | 
 4 | Square recognizes the important contributions the security research community
 5 | can make. We therefore encourage reporting security issues with the code
 6 | contained in this repository.
 7 | 
 8 | If you believe you have discovered a security vulnerability, please follow the
 9 | guidelines at .
10 | 
11 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/CONTRIBUTING.md:
--------------------------------------------------------------------------------
 1 | # Contributing
 2 | 
 3 | If you would like to contribute code to go-jose you can do so through GitHub by
 4 | forking the repository and sending a pull request.
 5 | 
 6 | When submitting code, please make every effort to follow existing conventions
 7 | and style in order to keep the code as readable as possible. Please also make
 8 | sure all tests pass by running `go test`, and format your code with `go fmt`.
 9 | We also recommend using `golint` and `errcheck`.
10 | 
11 | Before your code can be accepted into the project you must also sign the
12 | [Individual Contributor License Agreement][1].
13 | 
14 |  [1]: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1
15 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/doc.go:
--------------------------------------------------------------------------------
 1 | /*-
 2 |  * Copyright 2014 Square Inc.
 3 |  *
 4 |  * Licensed under the Apache License, Version 2.0 (the "License");
 5 |  * you may not use this file except in compliance with the License.
 6 |  * You may obtain a copy of the License at
 7 |  *
 8 |  *     http://www.apache.org/licenses/LICENSE-2.0
 9 |  *
10 |  * Unless required by applicable law or agreed to in writing, software
11 |  * distributed under the License is distributed on an "AS IS" BASIS,
12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 |  * See the License for the specific language governing permissions and
14 |  * limitations under the License.
15 |  */
16 | 
17 | /*
18 | 
19 | Package jose aims to provide an implementation of the Javascript Object Signing
20 | and Encryption set of standards. For the moment, it mainly focuses on
21 | encryption and signing based on the JSON Web Encryption and JSON Web Signature
22 | standards.  The library supports both the compact and full serialization
23 | formats, and has optional support for multiple recipients.
24 | 
25 | */
26 | package jose // import "gopkg.in/square/go-jose.v1"
27 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/json/README.md:
--------------------------------------------------------------------------------
 1 | # Safe JSON
 2 | 
 3 | This repository contains a fork of the `encoding/json` package from Go 1.6.
 4 | 
 5 | The following changes were made:
 6 | 
 7 | * Object deserialization uses case-sensitive member name matching instead of
 8 |   [case-insensitive matching](https://www.ietf.org/mail-archive/web/json/current/msg03763.html).
 9 |   This is to avoid differences in the interpretation of JOSE messages between
10 |   go-jose and libraries written in other languages.
11 | * When deserializing a JSON object, we check for duplicate keys and reject the
12 |   input whenever we detect a duplicate. Rather than trying to work with malformed
13 |   data, we prefer to reject it right away.
14 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/json/tags_test.go:
--------------------------------------------------------------------------------
 1 | // Copyright 2011 The Go Authors.  All rights reserved.
 2 | // Use of this source code is governed by a BSD-style
 3 | // license that can be found in the LICENSE file.
 4 | 
 5 | package json
 6 | 
 7 | import (
 8 | 	"testing"
 9 | )
10 | 
11 | func TestTagParsing(t *testing.T) {
12 | 	name, opts := parseTag("field,foobar,foo")
13 | 	if name != "field" {
14 | 		t.Fatalf("name = %q, want field", name)
15 | 	}
16 | 	for _, tt := range []struct {
17 | 		opt  string
18 | 		want bool
19 | 	}{
20 | 		{"foobar", true},
21 | 		{"foo", true},
22 | 		{"bar", false},
23 | 	} {
24 | 		if opts.Contains(tt.opt) != tt.want {
25 | 			t.Errorf("Contains(%q) = %v", tt.opt, !tt.want)
26 | 		}
27 | 	}
28 | }
29 | 


--------------------------------------------------------------------------------
/src/gopkg.in/square/go-jose.v1/json/testdata/code.json.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dolotech/lanxi_mahjong/f84f93ef2f52c7394f590794f02e9c0167b902c3/src/gopkg.in/square/go-jose.v1/json/testdata/code.json.gz


--------------------------------------------------------------------------------
/src/interfacer/iconn.go:
--------------------------------------------------------------------------------
 1 | /**********************************************************
 2 |  * Author        : Michael
 3 |  * Email         : dolotech@163.com
 4 |  * Last modified : 2016-01-23 10:43
 5 |  * Filename      : iconn.go
 6 |  * Description   : 每个玩家socket连接的对象接口
 7 |  * *******************************************************/
 8 | package interfacer
 9 | 
10 | type IConn interface {
11 | 	Close()
12 | 	Send(IProto)
13 | 	GetUserid() string
14 | 	SetUserid(string)
15 | 	GetLogin() bool
16 | 	SetLogin()
17 | 	GetIPAddr() uint32
18 | 	GetConnected() bool
19 | }
20 | 


--------------------------------------------------------------------------------
/src/interfacer/iproto.go:
--------------------------------------------------------------------------------
 1 | /**********************************************************
 2 |  * Author : Michael
 3 |  * Email : dolotech@163.com
 4 |  * Last modified : 2016-06-11 16:27
 5 |  * Filename : interface.go
 6 |  * Description :  零散的接口
 7 |  * *******************************************************/
 8 | package interfacer
 9 | 
10 | 
11 | type IProto interface {
12 | 	GetCode() uint32
13 | 	Reset()
14 | 	String() string
15 | 	ProtoMessage()
16 | }
17 | 


--------------------------------------------------------------------------------
/src/interfacer/iroom.go:
--------------------------------------------------------------------------------
 1 | /**********************************************************
 2 |  * Author        : Michael
 3 |  * Email         : dolotech@163.com
 4 |  * Last modified : 2016-01-23 10:42
 5 |  * Filename      : iroom.go
 6 |  * Description   : 房间的数据接口
 7 |  * *******************************************************/
 8 | package interfacer
 9 | 
10 | type IDesk interface {
11 | 	Discard(uint32, byte, bool)int32
12 | 	Operate(uint32, int64, uint32) int32
13 | 	Readying(uint32, bool) int32
14 | 	Enter(IPlayer) int32
15 | 	Vote(bool, uint32, uint32) int32
16 | 	Broadcasts(IProto)
17 | 	Closed(bool)
18 | 	SetCheat( [][]byte,[]byte,byte)
19 | 	MaiZi(seat, count uint32) int32
20 | 	Offline( uint32, bool)
21 | 
22 | 	ToString ()string
23 | }
24 | 


--------------------------------------------------------------------------------
/src/lib/csv/csv.go:
--------------------------------------------------------------------------------
 1 | /**********************************************************
 2 |  * Author : Michael
 3 |  * Email : dolotech@163.com
 4 |  * Last modified : 2016-07-07 23:41
 5 |  * Filename : csv.go
 6 |  * Description :
 7 |  * *******************************************************/
 8 | // Package csv provides `Marshal` and `UnMarshal` encoding functions for CSV(Comma Seperated Value) data.
 9 | // This package is built on the the standard library's encoding/csv.
10 | package csv
11 | 
12 | import (
13 | 	"reflect"
14 | )
15 | 
16 | // fieldHeaderName returns the header name to use for the given StructField
17 | // This can be a user defined name (via the Tag) or a default name.
18 | func fieldHeaderName(f reflect.StructField) (string, bool) {
19 | 	h := f.Tag.Get("csv")
20 | 
21 | 	if h == "-" {
22 | 		return "", false
23 | 	}
24 | 
25 | 	// If there is no tag set, use a default name
26 | 	if h == "" {
27 | 		return f.Name, true
28 | 	}
29 | 
30 | 	return h, true
31 | }
32 | 


--------------------------------------------------------------------------------
/src/lib/csv/example_marshal_test.go:
--------------------------------------------------------------------------------
 1 | /**********************************************************
 2 |  * Author : Michael
 3 |  * Email : dolotech@163.com
 4 |  * Last modified : 2016-07-07 23:42
 5 |  * Filename : example_marshal_test.go
 6 |  * Description :
 7 |  * *******************************************************/
 8 | package csv
 9 | 
10 | import (
11 | 	"fmt"
12 | )
13 | 
14 | func ExampleMarshal() {
15 | 	type Person struct {
16 | 		Name    string `csv:"FullName"`
17 | 		Gender  string
18 | 		Age     int
19 | 		Wallet  float32 `csv:"Bank Account"`
20 | 		Happy   bool    `true:"Yes!" false:"Sad"`
21 | 		private int     `csv:"-"`
22 | 	}
23 | 
24 | 	people := []Person{
25 | 		Person{
26 | 			Name:   "Smith, Joe",
27 | 			Gender: "M",
28 | 			Age:    23,
29 | 			Wallet: 19.07,
30 | 			Happy:  false,
31 | 		},
32 | 	}
33 | 
34 | 	out, _ := Marshal(people)
35 | 	fmt.Printf("%s", out)
36 | 	// Output:
37 | 	// FullName,Gender,Age,Bank Account,Happy
38 | 	// "Smith, Joe",M,23,19.07,Sad
39 | }
40 | 


--------------------------------------------------------------------------------
/src/lib/event/event_test.go:
--------------------------------------------------------------------------------
 1 | package event
 2 | 
 3 | import "testing"
 4 | 
 5 | func Test_event(t *testing.T) {
 6 | 	dispatch := &Dispatcher{}
 7 | 	f := func(eTyte string, args interface{}) {
 8 | 		t.Log(args)
 9 | 	}
10 | 	dispatch.Listen("hello", f)
11 | 	dispatch.ListenOnce("hello1", func(eType string, args interface{}) {
12 | 		t.Log(args)
13 | 		//	dispatch.ListenOnce("hello2", func(eType string, args interface{}) {
14 | 		//		t.Log(args)
15 | 		//	})
16 | 
17 | 	})
18 | 	//dispatch.RemoveListen("hello", f)
19 | 	dispatch.Dispatch("hello", "你好")
20 | 	dispatch.Dispatch("hello", "你好")
21 | 
22 | 	dispatch.Dispatch("hello1", "你好")
23 | 	dispatch.Dispatch("hello1", "你好")
24 | }
25 | 


--------------------------------------------------------------------------------
/src/lib/iplocation/iplocation_test.go:
--------------------------------------------------------------------------------
 1 | package iplocation
 2 | 
 3 | import (
 4 | 	"testing"
 5 | )
 6 | 
 7 | //
 8 | func TestProtoFriendListData(t *testing.T) {
 9 | 	t.Log(Query("61.128.126.23"))
10 | }
11 | 


--------------------------------------------------------------------------------
/src/lib/utils/array_test.go:
--------------------------------------------------------------------------------
 1 | package utils
 2 | 
 3 | import (
 4 | 	"fmt"
 5 | 	"testing"
 6 | )
 7 | 
 8 | func TestSet(t *testing.T) {
 9 | 	var s = NewArray(true, 1, 2, 3, 5, 6, 7, 7)
10 | 
11 | 	t.Error("集合的长度应该为 7", s.Len())
12 | 
13 | 	s.Push(111, 444)
14 | 	s.PushFront(222, 555)
15 | 	e := s.Pop()
16 | 	fmt.Println(e)
17 | 	e = s.PopFront()
18 | 	fmt.Println(e)
19 | 	fmt.Println(s.Values())
20 | }
21 | 
22 | func TestIter(t *testing.T) {
23 | 	fmt.Println("=====TestIter=====")
24 | 	var s1 = NewArray(true, 1, 2, 3, 4, 5)
25 | 
26 | 	for v := range s1.Iter() {
27 | 		fmt.Println(v)
28 | 	}
29 | }
30 | 


--------------------------------------------------------------------------------
/src/lib/utils/map_list_test.go:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Created by Michael on 2015/8/4.
 3 |  */
 4 | package utils
 5 | 
 6 | import "testing"
 7 | 
 8 | func Test_ran(t *testing.T) {
 9 | 	list := &List{}
10 | 	t.Log(list)
11 | 	//m := NewMap()
12 | 
13 | }
14 | 


--------------------------------------------------------------------------------
/src/lib/utils/random.go:
--------------------------------------------------------------------------------
 1 | package utils
 2 | 
 3 | import (
 4 | 	"math/rand"
 5 | 	"sync"
 6 | )
 7 | 
 8 | var o *rand.Rand = rand.New(rand.NewSource(TimestampNano()))
 9 | var random_mux_ sync.Mutex
10 | 
11 | func RandInt64() (r int64) {
12 | 	random_mux_.Lock()
13 | 	r = o.Int63()
14 | 	random_mux_.Unlock()
15 | 	return
16 | }
17 | 
18 | func RandInt32() (r int32) {
19 | 	random_mux_.Lock()
20 | 	r = o.Int31()
21 | 	random_mux_.Unlock()
22 | 	return
23 | }
24 | 
25 | func RandUint32() (r uint32) {
26 | 	random_mux_.Lock()
27 | 	r = o.Uint32()
28 | 	random_mux_.Unlock()
29 | 	return
30 | }
31 | 
32 | func RandInt64N(n int64) (r int64) {
33 | 	random_mux_.Lock()
34 | 	r = o.Int63n(n)
35 | 	random_mux_.Unlock()
36 | 	return
37 | }
38 | 
39 | func RandInt32N(n int32) (r int32) {
40 | 	random_mux_.Lock()
41 | 	r = o.Int31n(n)
42 | 	random_mux_.Unlock()
43 | 	return
44 | }
45 | 


--------------------------------------------------------------------------------