├── .gitignore
├── LICENSE
├── README.md
├── botconf_test.yaml
├── conf
└── conf.go
├── helper
└── helper.go
├── html
├── .gitignore
├── index.html
├── package.json
├── src
│ ├── chart.vue
│ ├── corner.vue
│ ├── footer.vue
│ ├── index.vue
│ ├── main.js
│ ├── pie.vue
│ ├── searchbox.vue
│ ├── user.js
│ ├── user.vue
│ └── userChart.vue
├── user.html
└── webpack.config.js
├── main.go
├── mongo
└── mongo.go
├── plugin
├── about.go
├── base64.go
├── cancel.go
├── default.go
├── google.go
├── groups.go
├── man.go
├── markdown.go
├── otherResources.go
├── prepare.go
├── rss.go
├── rule.go
├── search.go
├── start.go
├── statistics.go
├── subscribe.go
├── sysStat.go
├── trans.go
└── turing.go
├── vendor
├── github.com
│ ├── DeanThompson
│ │ └── ginpprof
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── pprof.go
│ ├── PuerkitoBio
│ │ └── goquery
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── array.go
│ │ │ ├── doc.go
│ │ │ ├── expand.go
│ │ │ ├── filter.go
│ │ │ ├── iteration.go
│ │ │ ├── manipulation.go
│ │ │ ├── property.go
│ │ │ ├── query.go
│ │ │ ├── traversal.go
│ │ │ ├── type.go
│ │ │ └── utilities.go
│ ├── Syfaro
│ │ └── telegram-bot-api
│ │ │ ├── LICENSE.txt
│ │ │ ├── README.md
│ │ │ ├── bot.go
│ │ │ ├── helpers.go
│ │ │ ├── methods.go
│ │ │ ├── types.go
│ │ │ ├── updates.go
│ │ │ └── webhook.go
│ ├── abbot
│ │ └── go-http-auth
│ │ │ ├── LICENSE
│ │ │ ├── Makefile
│ │ │ ├── README.md
│ │ │ ├── auth.go
│ │ │ ├── basic.go
│ │ │ ├── digest.go
│ │ │ ├── md5crypt.go
│ │ │ ├── misc.go
│ │ │ ├── test.htdigest
│ │ │ ├── test.htpasswd
│ │ │ └── users.go
│ ├── andybalholm
│ │ └── cascadia
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── parser.go
│ │ │ └── selector.go
│ ├── antonholmquist
│ │ └── jason
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── jason.go
│ ├── bieber
│ │ └── barcode
│ │ │ ├── README
│ │ │ ├── barcode.go
│ │ │ ├── doc.go
│ │ │ ├── errors.go
│ │ │ ├── image.go
│ │ │ ├── image_scanner.go
│ │ │ └── symbol.go
│ ├── carlescere
│ │ └── scheduler
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── scheduler.go
│ ├── fatih
│ │ └── set
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── set.go
│ │ │ ├── set_nots.go
│ │ │ └── set_ts.go
│ ├── franela
│ │ └── goreq
│ │ │ ├── LICENSE
│ │ │ ├── Makefile
│ │ │ ├── README.md
│ │ │ ├── goreq.go
│ │ │ └── tags.go
│ ├── gin-gonic
│ │ └── gin
│ │ │ ├── AUTHORS.md
│ │ │ ├── BENCHMARKS.md
│ │ │ ├── CHANGELOG.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── auth.go
│ │ │ ├── binding
│ │ │ ├── binding.go
│ │ │ ├── default_validator.go
│ │ │ ├── form.go
│ │ │ ├── form_mapping.go
│ │ │ ├── json.go
│ │ │ └── xml.go
│ │ │ ├── context.go
│ │ │ ├── debug.go
│ │ │ ├── deprecated.go
│ │ │ ├── errors.go
│ │ │ ├── fs.go
│ │ │ ├── gin.go
│ │ │ ├── logger.go
│ │ │ ├── mode.go
│ │ │ ├── path.go
│ │ │ ├── recovery.go
│ │ │ ├── render
│ │ │ ├── data.go
│ │ │ ├── html.go
│ │ │ ├── json.go
│ │ │ ├── redirect.go
│ │ │ ├── render.go
│ │ │ ├── text.go
│ │ │ └── xml.go
│ │ │ ├── response_writer.go
│ │ │ ├── routergroup.go
│ │ │ ├── tree.go
│ │ │ ├── utils.go
│ │ │ └── wercker.yml
│ ├── jqs7
│ │ └── bb
│ │ │ ├── audio.go
│ │ │ ├── bb.go
│ │ │ ├── chatAction.go
│ │ │ ├── document.go
│ │ │ ├── file.go
│ │ │ ├── location.go
│ │ │ ├── markup.go
│ │ │ ├── message.go
│ │ │ ├── photo.go
│ │ │ ├── sticker.go
│ │ │ ├── video.go
│ │ │ └── voice.go
│ ├── kylelemons
│ │ └── go-gypsy
│ │ │ ├── LICENSE
│ │ │ └── yaml
│ │ │ ├── Makefile
│ │ │ ├── config.go
│ │ │ ├── doc.go
│ │ │ ├── parser.go
│ │ │ └── types.go
│ ├── m3ng9i
│ │ ├── feedreader
│ │ │ ├── atom1.0.go
│ │ │ ├── doc.go
│ │ │ ├── error.go
│ │ │ ├── feed.go
│ │ │ ├── fetch.go
│ │ │ ├── init.go
│ │ │ ├── readme.md
│ │ │ ├── rss2.0.go
│ │ │ └── utils.go
│ │ └── go-utils
│ │ │ ├── encoding
│ │ │ └── utf8gbk.go
│ │ │ ├── html
│ │ │ └── html.go
│ │ │ ├── http
│ │ │ ├── auth.go
│ │ │ ├── can_be_compressed.go
│ │ │ ├── fetcher.go
│ │ │ ├── gzip_handler.go
│ │ │ ├── http.go
│ │ │ ├── request_id.go
│ │ │ └── sniffer.go
│ │ │ ├── possible
│ │ │ └── possible.go
│ │ │ ├── set
│ │ │ └── set.go
│ │ │ └── xml
│ │ │ └── xml.go
│ ├── manucorporat
│ │ └── sse
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── sse-decoder.go
│ │ │ ├── sse-encoder.go
│ │ │ └── writer.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
│ ├── pyk
│ │ └── byten
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── size.go
│ ├── shirou
│ │ └── gopsutil
│ │ │ ├── LICENSE
│ │ │ ├── common
│ │ │ ├── common.go
│ │ │ ├── common_darwin.go
│ │ │ ├── common_freebsd.go
│ │ │ └── common_windows.go
│ │ │ ├── cpu
│ │ │ ├── cpu.go
│ │ │ ├── cpu_darwin.go
│ │ │ ├── cpu_freebsd.go
│ │ │ ├── cpu_linux.go
│ │ │ ├── cpu_unix.go
│ │ │ └── cpu_windows.go
│ │ │ ├── disk
│ │ │ ├── binary.go
│ │ │ ├── disk.go
│ │ │ ├── disk_darwin.go
│ │ │ ├── disk_darwin_amd64.go
│ │ │ ├── disk_freebsd.go
│ │ │ ├── disk_freebsd_amd64.go
│ │ │ ├── disk_linux.go
│ │ │ ├── disk_unix.go
│ │ │ ├── disk_windows.go
│ │ │ └── types_freebsd.go
│ │ │ ├── host
│ │ │ ├── host.go
│ │ │ ├── host_darwin.go
│ │ │ ├── host_darwin_amd64.go
│ │ │ ├── host_freebsd.go
│ │ │ ├── host_freebsd_amd64.go
│ │ │ ├── host_linux.go
│ │ │ ├── host_linux_386.go
│ │ │ ├── host_linux_amd64.go
│ │ │ ├── host_linux_arm.go
│ │ │ ├── host_windows.go
│ │ │ ├── types_darwin.go
│ │ │ ├── types_freebsd.go
│ │ │ └── types_linux.go
│ │ │ ├── load
│ │ │ ├── load.go
│ │ │ ├── load_darwin.go
│ │ │ ├── load_freebsd.go
│ │ │ ├── load_linux.go
│ │ │ └── load_windows.go
│ │ │ ├── mem
│ │ │ ├── mem.go
│ │ │ ├── mem_darwin.go
│ │ │ ├── mem_freebsd.go
│ │ │ ├── mem_linux.go
│ │ │ └── mem_windows.go
│ │ │ ├── net
│ │ │ ├── net.go
│ │ │ ├── net_darwin.go
│ │ │ ├── net_freebsd.go
│ │ │ ├── net_linux.go
│ │ │ └── net_windows.go
│ │ │ └── process
│ │ │ ├── binary.go
│ │ │ ├── process.go
│ │ │ ├── process_darwin.go
│ │ │ ├── process_darwin_amd64.go
│ │ │ ├── process_freebsd.go
│ │ │ ├── process_freebsd_386.go
│ │ │ ├── process_freebsd_amd64.go
│ │ │ ├── process_linux.go
│ │ │ ├── process_linux_386.go
│ │ │ ├── process_linux_amd64.go
│ │ │ ├── process_linux_arm.go
│ │ │ ├── process_posix.go
│ │ │ ├── process_windows.go
│ │ │ └── types_darwin.go
│ ├── st3v
│ │ ├── tracerr
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── tracerr.go
│ │ └── translator
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── http
│ │ │ ├── authenticator.go
│ │ │ ├── client.go
│ │ │ └── mocks.go
│ │ │ ├── microsoft
│ │ │ ├── api.go
│ │ │ ├── auth
│ │ │ │ ├── access_token.go
│ │ │ │ ├── access_token_provider.go
│ │ │ │ └── authenticator.go
│ │ │ ├── language_catalog.go
│ │ │ ├── language_provider.go
│ │ │ ├── router.go
│ │ │ ├── translation_provider.go
│ │ │ └── xml.go
│ │ │ └── translator.go
│ └── technoweenie
│ │ └── multipartstreamer
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── multipartstreamer.go
├── golang.org
│ └── x
│ │ ├── crypto
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ ├── bcrypt
│ │ │ ├── base64.go
│ │ │ └── bcrypt.go
│ │ └── blowfish
│ │ │ ├── block.go
│ │ │ ├── cipher.go
│ │ │ └── const.go
│ │ ├── net
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ ├── context
│ │ │ ├── context.go
│ │ │ ├── go17.go
│ │ │ └── pre_go17.go
│ │ ├── html
│ │ │ ├── atom
│ │ │ │ ├── atom.go
│ │ │ │ ├── gen.go
│ │ │ │ └── table.go
│ │ │ ├── const.go
│ │ │ ├── doc.go
│ │ │ ├── doctype.go
│ │ │ ├── entity.go
│ │ │ ├── escape.go
│ │ │ ├── foreign.go
│ │ │ ├── node.go
│ │ │ ├── parse.go
│ │ │ ├── render.go
│ │ │ └── token.go
│ │ └── proxy
│ │ │ ├── direct.go
│ │ │ ├── per_host.go
│ │ │ ├── proxy.go
│ │ │ └── socks5.go
│ │ ├── sys
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ └── unix
│ │ │ ├── asm.s
│ │ │ ├── asm_darwin_386.s
│ │ │ ├── asm_darwin_amd64.s
│ │ │ ├── asm_dragonfly_386.s
│ │ │ ├── asm_dragonfly_amd64.s
│ │ │ ├── asm_freebsd_386.s
│ │ │ ├── asm_freebsd_amd64.s
│ │ │ ├── asm_freebsd_arm.s
│ │ │ ├── asm_linux_386.s
│ │ │ ├── asm_linux_amd64.s
│ │ │ ├── asm_linux_arm.s
│ │ │ ├── asm_netbsd_386.s
│ │ │ ├── asm_netbsd_amd64.s
│ │ │ ├── asm_netbsd_arm.s
│ │ │ ├── asm_openbsd_386.s
│ │ │ ├── asm_openbsd_amd64.s
│ │ │ ├── asm_solaris_amd64.s
│ │ │ ├── constants.go
│ │ │ ├── env_unix.go
│ │ │ ├── env_unset.go
│ │ │ ├── flock.go
│ │ │ ├── flock_linux_32bit.go
│ │ │ ├── gccgo.go
│ │ │ ├── gccgo_c.c
│ │ │ ├── gccgo_linux_amd64.go
│ │ │ ├── mkall.sh
│ │ │ ├── mkerrors.sh
│ │ │ ├── mksyscall.pl
│ │ │ ├── mksyscall_solaris.pl
│ │ │ ├── mksysctl_openbsd.pl
│ │ │ ├── mksysnum_darwin.pl
│ │ │ ├── mksysnum_dragonfly.pl
│ │ │ ├── mksysnum_freebsd.pl
│ │ │ ├── mksysnum_linux.pl
│ │ │ ├── mksysnum_netbsd.pl
│ │ │ ├── mksysnum_openbsd.pl
│ │ │ ├── race.go
│ │ │ ├── race0.go
│ │ │ ├── so_solaris.go
│ │ │ ├── sockcmsg_linux.go
│ │ │ ├── sockcmsg_unix.go
│ │ │ ├── str.go
│ │ │ ├── syscall.go
│ │ │ ├── syscall_bsd.go
│ │ │ ├── syscall_darwin.go
│ │ │ ├── syscall_darwin_386.go
│ │ │ ├── syscall_darwin_amd64.go
│ │ │ ├── syscall_dragonfly.go
│ │ │ ├── syscall_dragonfly_386.go
│ │ │ ├── syscall_dragonfly_amd64.go
│ │ │ ├── syscall_freebsd.go
│ │ │ ├── syscall_freebsd_386.go
│ │ │ ├── syscall_freebsd_amd64.go
│ │ │ ├── syscall_freebsd_arm.go
│ │ │ ├── syscall_linux.go
│ │ │ ├── syscall_linux_386.go
│ │ │ ├── syscall_linux_amd64.go
│ │ │ ├── syscall_linux_arm.go
│ │ │ ├── syscall_netbsd.go
│ │ │ ├── syscall_netbsd_386.go
│ │ │ ├── syscall_netbsd_amd64.go
│ │ │ ├── syscall_netbsd_arm.go
│ │ │ ├── syscall_no_getwd.go
│ │ │ ├── syscall_openbsd.go
│ │ │ ├── syscall_openbsd_386.go
│ │ │ ├── syscall_openbsd_amd64.go
│ │ │ ├── syscall_solaris.go
│ │ │ ├── syscall_solaris_amd64.go
│ │ │ ├── syscall_unix.go
│ │ │ ├── types_darwin.go
│ │ │ ├── types_dragonfly.go
│ │ │ ├── types_freebsd.go
│ │ │ ├── types_linux.go
│ │ │ ├── types_netbsd.go
│ │ │ ├── types_openbsd.go
│ │ │ ├── types_solaris.go
│ │ │ ├── zerrors_darwin_386.go
│ │ │ ├── zerrors_darwin_amd64.go
│ │ │ ├── zerrors_dragonfly_386.go
│ │ │ ├── zerrors_dragonfly_amd64.go
│ │ │ ├── zerrors_freebsd_386.go
│ │ │ ├── zerrors_freebsd_amd64.go
│ │ │ ├── zerrors_freebsd_arm.go
│ │ │ ├── zerrors_linux_386.go
│ │ │ ├── zerrors_linux_amd64.go
│ │ │ ├── zerrors_linux_arm.go
│ │ │ ├── zerrors_netbsd_386.go
│ │ │ ├── zerrors_netbsd_amd64.go
│ │ │ ├── zerrors_netbsd_arm.go
│ │ │ ├── zerrors_openbsd_386.go
│ │ │ ├── zerrors_openbsd_amd64.go
│ │ │ ├── zerrors_solaris_amd64.go
│ │ │ ├── zsyscall_darwin_386.go
│ │ │ ├── zsyscall_darwin_amd64.go
│ │ │ ├── zsyscall_dragonfly_386.go
│ │ │ ├── zsyscall_dragonfly_amd64.go
│ │ │ ├── zsyscall_freebsd_386.go
│ │ │ ├── zsyscall_freebsd_amd64.go
│ │ │ ├── zsyscall_freebsd_arm.go
│ │ │ ├── zsyscall_linux_386.go
│ │ │ ├── zsyscall_linux_amd64.go
│ │ │ ├── zsyscall_linux_arm.go
│ │ │ ├── zsyscall_netbsd_386.go
│ │ │ ├── zsyscall_netbsd_amd64.go
│ │ │ ├── zsyscall_netbsd_arm.go
│ │ │ ├── zsyscall_openbsd_386.go
│ │ │ ├── zsyscall_openbsd_amd64.go
│ │ │ ├── zsyscall_solaris_amd64.go
│ │ │ ├── zsysctl_openbsd.go
│ │ │ ├── zsysnum_darwin_386.go
│ │ │ ├── zsysnum_darwin_amd64.go
│ │ │ ├── zsysnum_dragonfly_386.go
│ │ │ ├── zsysnum_dragonfly_amd64.go
│ │ │ ├── zsysnum_freebsd_386.go
│ │ │ ├── zsysnum_freebsd_amd64.go
│ │ │ ├── zsysnum_freebsd_arm.go
│ │ │ ├── zsysnum_linux_386.go
│ │ │ ├── zsysnum_linux_amd64.go
│ │ │ ├── zsysnum_linux_arm.go
│ │ │ ├── zsysnum_netbsd_386.go
│ │ │ ├── zsysnum_netbsd_amd64.go
│ │ │ ├── zsysnum_netbsd_arm.go
│ │ │ ├── zsysnum_openbsd_386.go
│ │ │ ├── zsysnum_openbsd_amd64.go
│ │ │ ├── zsysnum_solaris_amd64.go
│ │ │ ├── ztypes_darwin_386.go
│ │ │ ├── ztypes_darwin_amd64.go
│ │ │ ├── ztypes_dragonfly_386.go
│ │ │ ├── ztypes_dragonfly_amd64.go
│ │ │ ├── ztypes_freebsd_386.go
│ │ │ ├── ztypes_freebsd_amd64.go
│ │ │ ├── ztypes_freebsd_arm.go
│ │ │ ├── ztypes_linux_386.go
│ │ │ ├── ztypes_linux_amd64.go
│ │ │ ├── ztypes_linux_arm.go
│ │ │ ├── ztypes_netbsd_386.go
│ │ │ ├── ztypes_netbsd_amd64.go
│ │ │ ├── ztypes_netbsd_arm.go
│ │ │ ├── ztypes_openbsd_386.go
│ │ │ ├── ztypes_openbsd_amd64.go
│ │ │ └── ztypes_solaris_amd64.go
│ │ └── text
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ ├── encoding
│ │ ├── encoding.go
│ │ ├── internal
│ │ │ ├── identifier
│ │ │ │ ├── gen.go
│ │ │ │ ├── identifier.go
│ │ │ │ └── mib.go
│ │ │ └── internal.go
│ │ └── simplifiedchinese
│ │ │ ├── all.go
│ │ │ ├── gbk.go
│ │ │ ├── hzgb2312.go
│ │ │ ├── maketables.go
│ │ │ └── tables.go
│ │ └── transform
│ │ └── transform.go
├── gopkg.in
│ ├── bluesuncorp
│ │ └── validator.v5
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── baked_in.go
│ │ │ ├── doc.go
│ │ │ ├── regexes.go
│ │ │ └── validator.go
│ ├── bsm
│ │ └── ratelimit.v1
│ │ │ ├── Makefile
│ │ │ ├── README.md
│ │ │ └── ratelimit.go
│ ├── bufio.v1
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── buffer.go
│ │ └── bufio.go
│ ├── h2non
│ │ └── filetype.v0
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── filetype.go
│ │ │ ├── kind.go
│ │ │ ├── match.go
│ │ │ ├── matchers
│ │ │ ├── archive.go
│ │ │ ├── audio.go
│ │ │ ├── font.go
│ │ │ ├── image.go
│ │ │ ├── matchers.go
│ │ │ └── video.go
│ │ │ └── types
│ │ │ ├── defaults.go
│ │ │ ├── mime.go
│ │ │ ├── split.go
│ │ │ ├── type.go
│ │ │ └── types.go
│ ├── mgo.v2
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── auth.go
│ │ ├── bson
│ │ │ ├── LICENSE
│ │ │ ├── bson.go
│ │ │ ├── decode.go
│ │ │ └── encode.go
│ │ ├── bulk.go
│ │ ├── cluster.go
│ │ ├── doc.go
│ │ ├── gridfs.go
│ │ ├── internal
│ │ │ ├── sasl
│ │ │ │ ├── sasl.c
│ │ │ │ ├── sasl.go
│ │ │ │ ├── sasl_windows.c
│ │ │ │ ├── sasl_windows.go
│ │ │ │ ├── sasl_windows.h
│ │ │ │ ├── sspi_windows.c
│ │ │ │ └── sspi_windows.h
│ │ │ └── scram
│ │ │ │ └── scram.go
│ │ ├── log.go
│ │ ├── queue.go
│ │ ├── raceoff.go
│ │ ├── raceon.go
│ │ ├── saslimpl.go
│ │ ├── saslstub.go
│ │ ├── server.go
│ │ ├── session.go
│ │ ├── socket.go
│ │ └── stats.go
│ ├── redis.v3
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── cluster.go
│ │ ├── cluster_pipeline.go
│ │ ├── command.go
│ │ ├── commands.go
│ │ ├── conn.go
│ │ ├── crc16.go
│ │ ├── doc.go
│ │ ├── error.go
│ │ ├── internal
│ │ │ └── consistenthash
│ │ │ │ └── consistenthash.go
│ │ ├── multi.go
│ │ ├── parser.go
│ │ ├── pipeline.go
│ │ ├── pool.go
│ │ ├── pubsub.go
│ │ ├── redis.go
│ │ ├── ring.go
│ │ ├── script.go
│ │ ├── sentinel.go
│ │ └── unsafe.go
│ └── unrolled
│ │ └── render.v1
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── buffer.go
│ │ ├── doc.go
│ │ ├── engine.go
│ │ └── render.go
└── vendor.json
└── webServer
└── web.go
/.gitignore:
--------------------------------------------------------------------------------
1 | *Jqs7Bot
2 | botconf.yaml
3 | .idea
4 | /html/tmp.html
5 | crt.pem
6 | key.pem
7 | debug
8 | .vscode
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Telegram 中文群组列表机器人
2 |
3 | 群组娘本体为 [@Jqs7Bot](https://telegram.me/Jqs7Bot)
4 | 推荐新的群组地址,请将邀请链接发给
5 | [@Jqs_7](https://telegram.me/Jqs_7) ,
6 | 并注明群名称、讨论主题或者到
7 | [issues](https://github.com/jqs7/Jqs7Bot/issues)
8 | 发布相关群信息。
9 |
10 | 不适合公开的群、私聊群请勿公开和分享。
11 |
12 | #### 群组娘の秘技
13 |
14 | - `/search [内容]` - 搜索群组
15 | - `/setrule [规则]` - 为群组设定自定义规则
16 | - `/rmrule` - 移除自定义规则
17 | - `/autorule` - 当有新的群成员加入时,自动发送群组规则(通过私聊)
18 | - `/setman [条目] [内容]` - 设置群组自定义条目
19 | - `/man [条目] ` - 查看群组自定义条目,若无参数,则列出所有条目
20 | - `/rmman [条目]` - 删除自定义条目,支持多参数
21 | - `/trans [待翻译内容]` - 中英互译(使用巨硬翻译API)
22 | - `/gg [内容]` - Google搜索
23 | - `/e64 [内容]` - base64加密
24 | - `/d64 [内容]` - base64解密
25 | - `/rss [url]` - 添加RSS订阅
26 | - `/rmrss [url]` - 删除RSS订阅
27 | - `/md [内容]` - 以markdown格式化文本
28 | - `@Jqs7Bot [内容]` - 召唤萌萌哒群组娘
29 | - `/rain [^|m|^m|username with @|me]` - 查看群组娘统计信息
30 |
31 | **除计数外,群组娘不会记录/log聊天信息**
32 | 
33 |
--------------------------------------------------------------------------------
/botconf_test.yaml:
--------------------------------------------------------------------------------
1 | botapi:
2 | baiduTransKey:
3 | vimTipsCache: 3
4 | master: Jqs_7
5 |
6 | questions:
7 |
8 | questionsTest:
9 | - Q1|A1;A2;A3
10 | - Q2|A4;A5;A6
11 |
12 | listTest:
13 | - 1
14 | - 2
15 | - \n
16 | - 3
17 |
--------------------------------------------------------------------------------
/html/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 |
--------------------------------------------------------------------------------
/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Jqs7Bot
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/html/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Jqs7Bot",
3 | "version": "0.1.0",
4 | "main": "index.js",
5 | "scripts": {
6 | "dev": "webpack --inline --hot --quiet --watch",
7 | "build": "NODE_ENV=production webpack --progress --hide-modules"
8 | },
9 | "dependencies": {
10 | "echarts": "^2.2.7-amd-beta2",
11 | "vue": "^1.0.0",
12 | "vue-resource": "^0.1.16"
13 | },
14 | "devDependencies": {
15 | "babel-core": "^5.8.25",
16 | "babel-loader": "^5.3.2",
17 | "babel-runtime": "^5.8.25",
18 | "css-loader": "^0.21.0",
19 | "jade": "^1.11.0",
20 | "style-loader": "^0.13.0",
21 | "stylus-loader": "^1.4.0",
22 | "template-html-loader": "0.0.3",
23 | "vue-hot-reload-api": "^1.2.0",
24 | "vue-html-loader": "^1.0.0",
25 | "vue-loader": "^6.0.0",
26 | "webpack": "^1.12.2",
27 | "webpack-dev-server": "^1.12.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/html/src/corner.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/html/src/footer.vue:
--------------------------------------------------------------------------------
1 |
2 | footer
3 | .footer.
4 | 群组娘的源代码基于
5 | GPL v3
6 | 协议发布
7 | © 2015 @Jqs_7
8 |
9 |
10 |
25 |
--------------------------------------------------------------------------------
/html/src/index.vue:
--------------------------------------------------------------------------------
1 |
2 | corner
3 | .center
4 | h1 群组娘第二舰队活动图
5 | searchbox
6 | chart
7 | foot
8 |
9 |
10 |
16 |
17 |
32 |
--------------------------------------------------------------------------------
/html/src/main.js:
--------------------------------------------------------------------------------
1 | var Vue = require('vue');
2 | var c = require('./index.vue');
3 |
4 | Vue.use(require('vue-resource'));
5 | Vue.http.options.root = 'http://localhost';
6 | new Vue({
7 | el: 'body',
8 | components: {
9 | index: c
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/html/src/searchbox.vue:
--------------------------------------------------------------------------------
1 |
2 | input(type='text' @keydown.enter='submit')
3 |
4 |
5 |
17 |
--------------------------------------------------------------------------------
/html/src/user.js:
--------------------------------------------------------------------------------
1 | var Vue = require('vue');
2 | var c = require('./user.vue');
3 |
4 | Vue.use(require('vue-resource'));
5 | Vue.http.options.root = 'http://localhost';
6 | new Vue({
7 | el: 'body',
8 | components: {
9 | index: c
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/html/src/user.vue:
--------------------------------------------------------------------------------
1 |
2 | corner
3 | .center
4 | h1 {{userName}} 子舰活动图
5 | user-chart
6 | foot
7 |
8 |
9 |
15 |
16 |
35 |
--------------------------------------------------------------------------------
/html/src/userChart.vue:
--------------------------------------------------------------------------------
1 |
2 | #chart
3 |
4 |
5 |
9 |
10 |
67 |
--------------------------------------------------------------------------------
/html/user.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Jqs7Bot
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/html/webpack.config.js:
--------------------------------------------------------------------------------
1 | var webpack = require('webpack');
2 |
3 | module.exports = {
4 | entry: {
5 | main: './src/main.js',
6 | user: './src/user.js'
7 | },
8 | output: {
9 | path: './dist',
10 | publicPath: '/dist/',
11 | filename: '[name].build.js'
12 | },
13 | module: {
14 | loaders: [
15 | {
16 | test: /\.vue$/,
17 | loader: 'vue'
18 | }
19 | ]
20 | }
21 | }
22 |
23 | if (process.env.NODE_ENV === 'production') {
24 | module.exports.plugins = [
25 | new webpack.DefinePlugin({
26 | 'process.env': {
27 | NODE_ENV: '"production"'
28 | }
29 | }),
30 | new webpack.optimize.UglifyJsPlugin({
31 | compress: {
32 | warnings: false
33 | }
34 | }),
35 | new webpack.optimize.OccurenceOrderPlugin()
36 | ]
37 | } else {
38 | module.exports.devtool = '#source-map'
39 | }
40 |
--------------------------------------------------------------------------------
/plugin/about.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "github.com/jqs7/Jqs7Bot/conf"
5 | "github.com/jqs7/bb"
6 | )
7 |
8 | type About struct{ bb.Base }
9 |
10 | func (a *About) Run() {
11 | a.NewMessage(a.Message.From.ID,
12 | conf.List2StringInConf("about")).Send()
13 | }
14 |
--------------------------------------------------------------------------------
/plugin/base64.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "encoding/base64"
5 | "strings"
6 | "unicode/utf8"
7 |
8 | "github.com/jqs7/bb"
9 | )
10 |
11 | type Base64 struct{ bb.Base }
12 |
13 | func (b *Base64) Run() {
14 | switch b.Args[0] {
15 | case "/e64":
16 | if b.Message.ReplyToMessage != nil &&
17 | b.Message.ReplyToMessage.Text != "" {
18 | b.NewMessage(b.ChatID, E64(b.Message.ReplyToMessage.Text)).
19 | Send()
20 | } else if len(b.Args) >= 2 {
21 | in := strings.Join(b.Args[1:], " ")
22 | b.NewMessage(b.ChatID, E64(in)).Send()
23 | }
24 | case "/d64":
25 | if len(b.Args) >= 2 {
26 | in := strings.Join(b.Args[1:], " ")
27 | b.NewMessage(b.ChatID, D64(in)).Send()
28 | }
29 | }
30 | }
31 |
32 | func E64(in string) string {
33 | return base64.StdEncoding.EncodeToString([]byte(in))
34 | }
35 |
36 | func D64(in string) string {
37 | out, err := base64.StdEncoding.DecodeString(in)
38 | if err != nil {
39 | return "解码系统出现故障,请查看弹药是否填充无误"
40 | }
41 | if utf8.Valid(out) {
42 | return string(out)
43 | }
44 | return "解码结果包含不明物体,群组娘已将之上交国家"
45 | }
46 |
--------------------------------------------------------------------------------
/plugin/cancel.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | type Cancel struct{ Default }
4 |
5 | func (c *Cancel) Run() {
6 | if c.FromPrivate {
7 | c.NewMessage(c.ChatID,
8 | "群组娘已完成零态重置").
9 | ReplyMarkup(c.NewReplyKeyboardHide().Done()).
10 | Send()
11 | c.setStatus("")
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/plugin/google.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "bytes"
5 | "fmt"
6 | "log"
7 | "net/url"
8 | "strings"
9 | "time"
10 |
11 | "github.com/franela/goreq"
12 | "github.com/jqs7/Jqs7Bot/helper"
13 | "github.com/jqs7/bb"
14 | )
15 |
16 | type Google struct{ bb.Base }
17 |
18 | func (g *Google) Run() {
19 | if len(g.Args) >= 2 {
20 | q := strings.Join(g.Args[1:], " ")
21 | g.NewMessage(g.ChatID, g.G(q)).
22 | MarkdownMode().
23 | DisableWebPagePreview().
24 | Send()
25 | }
26 | }
27 |
28 | func (g *Google) G(query string) string {
29 | query = url.QueryEscape(query)
30 | retry := 0
31 | Req:
32 | res, err := goreq.Request{
33 | Uri: fmt.Sprintf("http://ajax.googleapis.com/"+
34 | "ajax/services/search/web?v=1.0&rsz=7&q=%s", query),
35 | Timeout: 17 * time.Second,
36 | }.Do()
37 | if err != nil {
38 | if retry < 2 {
39 | retry++
40 | goto Req
41 | } else {
42 | log.Println("Google Timeout!")
43 | return "群组娘连接母舰失败,请稍后重试"
44 | }
45 | }
46 |
47 | var google struct {
48 | ResponseData struct {
49 | Results []struct {
50 | URL string
51 | TitleNoFormatting string
52 | }
53 | }
54 | }
55 |
56 | err = res.Body.FromJsonTo(&google)
57 | if err != nil {
58 | return "转换失败,母舰大概是快没油了Orz"
59 | }
60 |
61 | var buf bytes.Buffer
62 | for _, item := range google.ResponseData.Results {
63 | u, _ := url.QueryUnescape(item.URL)
64 | t, _ := url.QueryUnescape(item.TitleNoFormatting)
65 | buf.WriteString(helper.ToMarkdownLink(t, u) + "\n")
66 | }
67 | return buf.String()
68 | }
69 |
--------------------------------------------------------------------------------
/plugin/groups.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "github.com/jqs7/Jqs7Bot/conf"
5 | "github.com/jqs7/Jqs7Bot/helper"
6 | "github.com/jqs7/bb"
7 | )
8 |
9 | type Groups struct{ bb.Base }
10 |
11 | func (g *Groups) Run() {
12 | category := helper.To2dSlice(conf.Categories, 3, 5)
13 |
14 | g.NewMessage(g.Message.From.ID,
15 | "你想要查看哪些群组呢😋\n(为保护群组不被外星人攻击,"+
16 | "请勿将群链接转发到群组中,或者公布到网络上)").
17 | ReplyMarkup(g.NewReplyKeyboardMarkup(category).
18 | OneTimeKeyboard().ResizeKeyboard().Done()).
19 | Send()
20 | }
21 |
--------------------------------------------------------------------------------
/plugin/man.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "strconv"
5 | "strings"
6 |
7 | "github.com/jqs7/Jqs7Bot/conf"
8 | )
9 |
10 | type Man struct{ Default }
11 |
12 | func (m *Man) Run() {
13 | switch m.Args[0] {
14 | case "/setman":
15 | if len(m.Args) >= 3 {
16 | value := strings.Join(m.Args[2:], " ")
17 | if !m.isAuthed() {
18 | m.sendQuestion()
19 | return
20 | }
21 |
22 | if m.FromGroup || m.FromSuperGroup {
23 | conf.Redis.HSet(
24 | "tgMan:"+strconv.Itoa(m.ChatID),
25 | m.Args[1], value)
26 | m.NewMessage(m.ChatID,
27 | m.Args[1]+":\n"+value).Send()
28 | }
29 | }
30 | case "/rmman":
31 | fields := m.Args[1:]
32 | for k := range fields {
33 | conf.Redis.HDel("tgMan:"+
34 | strconv.Itoa(m.ChatID), fields[k])
35 | }
36 | m.listMan()
37 | case "/man":
38 | if len(m.Args) == 1 {
39 | m.listMan()
40 | } else {
41 | if m.FromPrivate || m.FromChannel {
42 | return
43 | }
44 | if m.Args[1] == "man" && !conf.Redis.HExists(
45 | "tgMan:"+strconv.Itoa(m.ChatID), "man").Val() {
46 | m.NewMessage(m.ChatID, "你在慢慢个什么鬼啦!(σ゚∀゚)σ").Send()
47 | return
48 | }
49 | m.NewMessage(m.ChatID,
50 | conf.Redis.HGet("tgMan:"+strconv.Itoa(m.ChatID),
51 | m.Args[1]).Val()).Send()
52 | }
53 | }
54 | }
55 |
56 | func (m *Man) listMan() {
57 | if m.FromGroup || m.FromSuperGroup {
58 | var result string
59 | fields := conf.Redis.HGetAllMap("tgMan:" +
60 | strconv.Itoa(m.ChatID)).Val()
61 | for k := range fields {
62 | result += k + "\n"
63 | }
64 | m.NewMessage(m.ChatID, result).Send()
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/plugin/markdown.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "strings"
5 |
6 | "github.com/jqs7/bb"
7 | )
8 |
9 | type Markdown struct{ bb.Base }
10 |
11 | func (m *Markdown) Run() {
12 | if len(m.Args) > 1 {
13 | s := strings.Join(m.Args[1:], " ")
14 | err := m.NewMessage(m.ChatID, s).
15 | DisableWebPagePreview().
16 | MarkdownMode().Send().Err
17 | if err != nil {
18 | m.NewMessage(m.ChatID, err.Error()).Send()
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/plugin/otherResources.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "github.com/jqs7/Jqs7Bot/conf"
5 | "github.com/jqs7/bb"
6 | )
7 |
8 | type OtherResources struct{ bb.Base }
9 |
10 | func (o *OtherResources) Run() {
11 | o.NewMessage(o.Message.From.ID,
12 | conf.List2StringInConf("其他资源")).Send()
13 | }
14 |
--------------------------------------------------------------------------------
/plugin/rule.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "strconv"
5 | "strings"
6 |
7 | "github.com/jqs7/Jqs7Bot/conf"
8 | "github.com/jqs7/bb"
9 | )
10 |
11 | type Rule struct{ bb.Base }
12 |
13 | func (r *Rule) Run() {
14 | chatIDStr := strconv.Itoa(r.ChatID)
15 | rule := conf.Redis.Get("tgGroupRule:" + chatIDStr).Val()
16 | if rule != "" {
17 | r.NewMessage(r.ChatID, rule).Send()
18 | } else {
19 | r.NewMessage(r.Message.From.ID,
20 | conf.List2StringInConf("rules")).MarkdownMode().Send()
21 | }
22 | }
23 |
24 | type SetRule struct{ Default }
25 |
26 | func (s *SetRule) Run() {
27 | if len(s.Args) < 2 {
28 | return
29 | }
30 | if s.FromGroup || s.FromSuperGroup {
31 | rule := strings.Join(s.Args[1:], " ")
32 | if s.isAuthed() {
33 | chatIDStr := strconv.Itoa(s.ChatID)
34 | conf.Redis.Set("tgGroupRule:"+chatIDStr, rule, -1)
35 | s.NewMessage(s.ChatID, "新的群组规则Get!✔️").Send()
36 | } else {
37 | s.sendQuestion()
38 | }
39 | }
40 | }
41 |
42 | type RmRule struct{ Default }
43 |
44 | func (s *RmRule) Run() {
45 | if s.isAuthed() {
46 | chatIDStr := strconv.Itoa(s.ChatID)
47 | conf.Redis.Del("tgGroupRule:" + chatIDStr)
48 | s.NewMessage(s.ChatID, "rule removed").Send()
49 | } else {
50 | s.sendQuestion()
51 | }
52 | }
53 |
54 | type AutoRule struct{ Default }
55 |
56 | func (s *AutoRule) Run() {
57 | if s.FromGroup || s.FromSuperGroup {
58 | chatIDStr := strconv.Itoa(s.ChatID)
59 | if conf.Redis.Exists("tgGroupAutoRule:" + chatIDStr).Val() {
60 | conf.Redis.Del("tgGroupAutoRule:" + chatIDStr)
61 | s.NewMessage(s.ChatID, "AutoRule Disabled!").Send()
62 | } else {
63 | conf.Redis.Set("tgGroupAutoRule:"+chatIDStr,
64 | strconv.FormatBool(true), -1)
65 | s.NewMessage(s.ChatID, "AutoRule Enabled!").Send()
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/plugin/search.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import (
4 | "strings"
5 |
6 | "github.com/jqs7/Jqs7Bot/conf"
7 | "github.com/jqs7/Jqs7Bot/helper"
8 | )
9 |
10 | type Search struct{ Default }
11 |
12 | func (s *Search) Run() {
13 | if !s.isAuthed() {
14 | s.sendQuestion()
15 | return
16 | }
17 |
18 | if len(s.Args) > 1 {
19 | result := []string{}
20 | for _, v := range conf.Groups {
21 | arg := strings.ToLower(s.Args[1])
22 | lower := strings.ToLower(v.GroupName)
23 | if strings.Contains(lower, arg) {
24 | if v.GroupURL != "" {
25 | result = append(result, helper.ToMarkdownLink(v.GroupName, v.GroupURL))
26 | } else {
27 | result = append(result, v.GroupName)
28 | }
29 | }
30 | }
31 | if len(result) != 0 {
32 | s.NewMessage(s.Message.From.ID, strings.Join(result, "\n")).
33 | MarkdownMode().DisableWebPagePreview().Send()
34 | } else {
35 | s.NewMessage(s.Message.From.ID, "搜索大失败喵(/ ̄ˇ ̄)/").Send()
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/plugin/start.go:
--------------------------------------------------------------------------------
1 | package plugin
2 |
3 | import "github.com/jqs7/Jqs7Bot/conf"
4 |
5 | type Start struct{ Default }
6 |
7 | func (s *Start) Run() {
8 | if !s.isAuthed() {
9 | s.sendQuestion()
10 | return
11 | }
12 | s.NewMessage(s.Message.From.ID,
13 | conf.List2StringInConf("help")).Send()
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/DeanThompson/ginpprof/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Yangliang Li
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/PuerkitoBio/goquery/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012-2014, Martin Angers & Contributors
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 |
--------------------------------------------------------------------------------
/vendor/github.com/PuerkitoBio/goquery/iteration.go:
--------------------------------------------------------------------------------
1 | package goquery
2 |
3 | // Each iterates over a Selection object, executing a function for each
4 | // matched element. It returns the current Selection object.
5 | func (s *Selection) Each(f func(int, *Selection)) *Selection {
6 | for i, n := range s.Nodes {
7 | f(i, newSingleSelection(n, s.document))
8 | }
9 | return s
10 | }
11 |
12 | // EachWithBreak iterates over a Selection object, executing a function for each
13 | // matched element. It is identical to Each except that it is possible to break
14 | // out of the loop by returning false in the callback function. It returns the
15 | // current Selection object.
16 | func (s *Selection) EachWithBreak(f func(int, *Selection) bool) *Selection {
17 | for i, n := range s.Nodes {
18 | if !f(i, newSingleSelection(n, s.document)) {
19 | return s
20 | }
21 | }
22 | return s
23 | }
24 |
25 | // Map passes each element in the current matched set through a function,
26 | // producing a slice of string holding the returned values.
27 | func (s *Selection) Map(f func(int, *Selection) string) (result []string) {
28 | for i, n := range s.Nodes {
29 | result = append(result, f(i, newSingleSelection(n, s.document)))
30 | }
31 |
32 | return result
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/Syfaro/telegram-bot-api/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Syfaro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/Syfaro/telegram-bot-api/bot.go:
--------------------------------------------------------------------------------
1 | // Package tgbotapi has bindings for interacting with the Telegram Bot API.
2 | package tgbotapi
3 |
4 | import (
5 | "net/http"
6 | )
7 |
8 | // BotAPI has methods for interacting with all of Telegram's Bot API endpoints.
9 | type BotAPI struct {
10 | Token string `json:"token"`
11 | Debug bool `json:"debug"`
12 | Self User `json:"-"`
13 | Updates chan Update `json:"-"`
14 | Client *http.Client `json:"-"`
15 | }
16 |
17 | // NewBotAPI creates a new BotAPI instance.
18 | // Requires a token, provided by @BotFather on Telegram
19 | func NewBotAPI(token string) (*BotAPI, error) {
20 | return NewBotAPIWithClient(token, &http.Client{})
21 | }
22 |
23 | // NewBotAPIWithClient creates a new BotAPI instance passing an http.Client.
24 | // Requires a token, provided by @BotFather on Telegram
25 | func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) {
26 | bot := &BotAPI{
27 | Token: token,
28 | Client: client,
29 | }
30 |
31 | self, err := bot.GetMe()
32 | if err != nil {
33 | return &BotAPI{}, err
34 | }
35 |
36 | bot.Self = self
37 |
38 | return bot, nil
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/Syfaro/telegram-bot-api/updates.go:
--------------------------------------------------------------------------------
1 | package tgbotapi
2 |
3 | import (
4 | "log"
5 | "time"
6 | )
7 |
8 | // UpdatesChan starts a channel for getting updates.
9 | func (bot *BotAPI) UpdatesChan(config UpdateConfig) error {
10 | bot.Updates = make(chan Update, 100)
11 |
12 | go func() {
13 | for {
14 | updates, err := bot.GetUpdates(config)
15 | if err != nil {
16 | log.Println(err)
17 | log.Println("Failed to get updates, retrying in 3 seconds...")
18 | time.Sleep(time.Second * 3)
19 |
20 | continue
21 | }
22 |
23 | for _, update := range updates {
24 | if update.UpdateID >= config.Offset {
25 | config.Offset = update.UpdateID + 1
26 | bot.Updates <- update
27 | }
28 | }
29 | }
30 | }()
31 |
32 | return nil
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/Syfaro/telegram-bot-api/webhook.go:
--------------------------------------------------------------------------------
1 | package tgbotapi
2 |
3 | import (
4 | "encoding/json"
5 | "io/ioutil"
6 | "net/http"
7 | )
8 |
9 | // ListenForWebhook registers a http handler for a webhook.
10 | func (bot *BotAPI) ListenForWebhook(pattern string) {
11 | bot.Updates = make(chan Update, 100)
12 |
13 | http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {
14 | bytes, _ := ioutil.ReadAll(r.Body)
15 |
16 | var update Update
17 | json.Unmarshal(bytes, &update)
18 |
19 | bot.Updates <- update
20 | })
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/abbot/go-http-auth/Makefile:
--------------------------------------------------------------------------------
1 | include $(GOROOT)/src/Make.inc
2 |
3 | TARG=auth_digest
4 | GOFILES=\
5 | auth.go\
6 | digest.go\
7 | basic.go\
8 | misc.go\
9 | md5crypt.go\
10 | users.go\
11 |
12 | include $(GOROOT)/src/Make.pkg
13 |
--------------------------------------------------------------------------------
/vendor/github.com/abbot/go-http-auth/misc.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import "encoding/base64"
4 | import "crypto/md5"
5 | import "crypto/rand"
6 | import "fmt"
7 |
8 | /*
9 | Return a random 16-byte base64 alphabet string
10 | */
11 | func RandomKey() string {
12 | k := make([]byte, 12)
13 | for bytes := 0; bytes < len(k); {
14 | n, err := rand.Read(k[bytes:])
15 | if err != nil {
16 | panic("rand.Read() failed")
17 | }
18 | bytes += n
19 | }
20 | return base64.StdEncoding.EncodeToString(k)
21 | }
22 |
23 | /*
24 | H function for MD5 algorithm (returns a lower-case hex MD5 digest)
25 | */
26 | func H(data string) string {
27 | digest := md5.New()
28 | digest.Write([]byte(data))
29 | return fmt.Sprintf("%x", digest.Sum(nil))
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/abbot/go-http-auth/test.htdigest:
--------------------------------------------------------------------------------
1 | test:example.com:aa78524fceb0e50fd8ca96dd818b8cf9
2 |
--------------------------------------------------------------------------------
/vendor/github.com/abbot/go-http-auth/test.htpasswd:
--------------------------------------------------------------------------------
1 | test:{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00=
2 | test2:$apr1$a0j62R97$mYqFkloXH0/UOaUnAiV2b0
3 | test16:$apr1$JI4wh3am$AmhephVqLTUyAVpFQeHZC0
4 | test3:$2y$05$ih3C91zUBSTFcAh2mQnZYuob0UOZVEf16wl/ukgjDhjvj.xgM1WwS
5 |
--------------------------------------------------------------------------------
/vendor/github.com/andybalholm/cascadia/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Andy Balholm. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/vendor/github.com/andybalholm/cascadia/README.md:
--------------------------------------------------------------------------------
1 | # cascadia
2 |
3 | [](https://travis-ci.org/andybalholm/cascadia)
4 |
5 | The Cascadia package implements CSS selectors for use with the parse trees produced by the html package.
6 |
--------------------------------------------------------------------------------
/vendor/github.com/antonholmquist/jason/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Anton Holmquist, anton.holmquist@gmail.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/bieber/barcode/README:
--------------------------------------------------------------------------------
1 | This package provides a simple Go wrapper around zbar for reading
2 | barcodes from image files. For documentation, see
3 | http://www.godoc.org/github.com/bieber/barcode/
4 |
--------------------------------------------------------------------------------
/vendor/github.com/carlescere/scheduler/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Carles Cerezo Guzmán
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/vendor/github.com/fatih/set/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Fatih Arslan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/franela/goreq/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Jonathan Leibiusky and Marcos Lilljedahl
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/github.com/franela/goreq/Makefile:
--------------------------------------------------------------------------------
1 | test:
2 | go get -v -d -t ./...
3 | go test -v
4 |
--------------------------------------------------------------------------------
/vendor/github.com/franela/goreq/tags.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 goreq
6 |
7 | import (
8 | "strings"
9 | "unicode"
10 | )
11 |
12 | // tagOptions is the string following a comma in a struct field's "json"
13 | // tag, or the empty string. It does not include the leading comma.
14 | type tagOptions string
15 |
16 | // parseTag splits a struct field's json tag into its name and
17 | // comma-separated options.
18 | func parseTag(tag string) (string, tagOptions) {
19 | if idx := strings.Index(tag, ","); idx != -1 {
20 | return tag[:idx], tagOptions(tag[idx+1:])
21 | }
22 | return tag, tagOptions("")
23 | }
24 |
25 | // Contains reports whether a comma-separated list of options
26 | // contains a particular substr flag. substr must be surrounded by a
27 | // string boundary or commas.
28 | func (o tagOptions) Contains(optionName string) bool {
29 | if len(o) == 0 {
30 | return false
31 | }
32 | s := string(o)
33 | for s != "" {
34 | var next string
35 | i := strings.Index(s, ",")
36 | if i >= 0 {
37 | s, next = s[:i], s[i+1:]
38 | }
39 | if s == optionName {
40 | return true
41 | }
42 | s = next
43 | }
44 | return false
45 | }
46 |
47 | func isValidTag(s string) bool {
48 | if s == "" {
49 | return false
50 | }
51 | for _, c := range s {
52 | switch {
53 | case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
54 | // Backslash and quote chars are reserved, but
55 | // otherwise any punctuation chars are allowed
56 | // in a tag name.
57 | default:
58 | if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
59 | return false
60 | }
61 | }
62 | }
63 | return true
64 | }
65 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Manuel Martínez-Almeida
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/default_validator.go:
--------------------------------------------------------------------------------
1 | package binding
2 |
3 | import (
4 | "reflect"
5 | "sync"
6 |
7 | "gopkg.in/bluesuncorp/validator.v5"
8 | )
9 |
10 | type defaultValidator struct {
11 | once sync.Once
12 | validate *validator.Validate
13 | }
14 |
15 | var _ StructValidator = &defaultValidator{}
16 |
17 | func (v *defaultValidator) ValidateStruct(obj interface{}) error {
18 | if kindOfData(obj) == reflect.Struct {
19 | v.lazyinit()
20 | if err := v.validate.Struct(obj); err != nil {
21 | return error(err)
22 | }
23 | }
24 | return nil
25 | }
26 |
27 | func (v *defaultValidator) lazyinit() {
28 | v.once.Do(func() {
29 | v.validate = validator.New("binding", validator.BakedInValidators)
30 | })
31 | }
32 |
33 | func kindOfData(data interface{}) reflect.Kind {
34 | value := reflect.ValueOf(data)
35 | valueType := value.Kind()
36 | if valueType == reflect.Ptr {
37 | valueType = value.Elem().Kind()
38 | }
39 | return valueType
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/form.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import "net/http"
8 |
9 | type formBinding struct{}
10 | type formPostBinding struct{}
11 | type formMultipartBinding struct{}
12 |
13 | func (formBinding) Name() string {
14 | return "form"
15 | }
16 |
17 | func (formBinding) Bind(req *http.Request, obj interface{}) error {
18 | if err := req.ParseForm(); err != nil {
19 | return err
20 | }
21 | req.ParseMultipartForm(32 << 10) // 32 MB
22 | if err := mapForm(obj, req.Form); err != nil {
23 | return err
24 | }
25 | return validate(obj)
26 | }
27 |
28 | func (formPostBinding) Name() string {
29 | return "form-urlencoded"
30 | }
31 |
32 | func (formPostBinding) Bind(req *http.Request, obj interface{}) error {
33 | if err := req.ParseForm(); err != nil {
34 | return err
35 | }
36 | if err := mapForm(obj, req.PostForm); err != nil {
37 | return err
38 | }
39 | return validate(obj)
40 | }
41 |
42 | func (formMultipartBinding) Name() string {
43 | return "multipart/form-data"
44 | }
45 |
46 | func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error {
47 | if err := req.ParseMultipartForm(32 << 10); err != nil {
48 | return err
49 | }
50 | if err := mapForm(obj, req.MultipartForm.Value); err != nil {
51 | return err
52 | }
53 | return validate(obj)
54 | }
55 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "encoding/json"
9 |
10 | "net/http"
11 | )
12 |
13 | type jsonBinding struct{}
14 |
15 | func (jsonBinding) Name() string {
16 | return "json"
17 | }
18 |
19 | func (jsonBinding) Bind(req *http.Request, obj interface{}) error {
20 | decoder := json.NewDecoder(req.Body)
21 | if err := decoder.Decode(obj); err != nil {
22 | return err
23 | }
24 | return validate(obj)
25 | }
26 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/xml.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "encoding/xml"
9 | "net/http"
10 | )
11 |
12 | type xmlBinding struct{}
13 |
14 | func (xmlBinding) Name() string {
15 | return "xml"
16 | }
17 |
18 | func (xmlBinding) Bind(req *http.Request, obj interface{}) error {
19 | decoder := xml.NewDecoder(req.Body)
20 | if err := decoder.Decode(obj); err != nil {
21 | return err
22 | }
23 | return validate(obj)
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/deprecated.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/fs.go:
--------------------------------------------------------------------------------
1 | package gin
2 |
3 | import (
4 | "net/http"
5 | "os"
6 | )
7 |
8 | type (
9 | onlyfilesFS struct {
10 | fs http.FileSystem
11 | }
12 | neuteredReaddirFile struct {
13 | http.File
14 | }
15 | )
16 |
17 | // Dir returns a http.Filesystem that can be used by http.FileServer(). It is used interally
18 | // in router.Static().
19 | // if listDirectory == true, then it works the same as http.Dir() otherwise it returns
20 | // a filesystem that prevents http.FileServer() to list the directory files.
21 | func Dir(root string, listDirectory bool) http.FileSystem {
22 | fs := http.Dir(root)
23 | if listDirectory {
24 | return fs
25 | }
26 | return &onlyfilesFS{fs}
27 | }
28 |
29 | // Conforms to http.Filesystem
30 | func (fs onlyfilesFS) Open(name string) (http.File, error) {
31 | f, err := fs.fs.Open(name)
32 | if err != nil {
33 | return nil, err
34 | }
35 | return neuteredReaddirFile{f}, nil
36 | }
37 |
38 | // Overrides the http.File default implementation
39 | func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
40 | // this disables directory listing
41 | return nil, nil
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/mode.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "io"
9 | "os"
10 |
11 | "github.com/gin-gonic/gin/binding"
12 | "github.com/mattn/go-colorable"
13 | )
14 |
15 | const ENV_GIN_MODE = "GIN_MODE"
16 |
17 | const (
18 | DebugMode string = "debug"
19 | ReleaseMode string = "release"
20 | TestMode string = "test"
21 | )
22 | const (
23 | debugCode = iota
24 | releaseCode = iota
25 | testCode = iota
26 | )
27 |
28 | var DefaultWriter io.Writer = colorable.NewColorableStdout()
29 | var ginMode int = debugCode
30 | var modeName string = DebugMode
31 |
32 | func init() {
33 | mode := os.Getenv(ENV_GIN_MODE)
34 | if len(mode) == 0 {
35 | SetMode(DebugMode)
36 | } else {
37 | SetMode(mode)
38 | }
39 | }
40 |
41 | func SetMode(value string) {
42 | switch value {
43 | case DebugMode:
44 | ginMode = debugCode
45 | case ReleaseMode:
46 | ginMode = releaseCode
47 | case TestMode:
48 | ginMode = testCode
49 | default:
50 | panic("gin mode unknown: " + value)
51 | }
52 | modeName = value
53 | }
54 |
55 | func DisableBindValidation() {
56 | binding.Validator = nil
57 | }
58 |
59 | func Mode() string {
60 | return modeName
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/data.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import "net/http"
8 |
9 | type Data struct {
10 | ContentType string
11 | Data []byte
12 | }
13 |
14 | func (r Data) Render(w http.ResponseWriter) error {
15 | if len(r.ContentType) > 0 {
16 | w.Header()["Content-Type"] = []string{r.ContentType}
17 | }
18 | w.Write(r.Data)
19 | return nil
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/html.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "html/template"
9 | "net/http"
10 | )
11 |
12 | type (
13 | HTMLRender interface {
14 | Instance(string, interface{}) Render
15 | }
16 |
17 | HTMLProduction struct {
18 | Template *template.Template
19 | }
20 |
21 | HTMLDebug struct {
22 | Files []string
23 | Glob string
24 | }
25 |
26 | HTML struct {
27 | Template *template.Template
28 | Name string
29 | Data interface{}
30 | }
31 | )
32 |
33 | var htmlContentType = []string{"text/html; charset=utf-8"}
34 |
35 | func (r HTMLProduction) Instance(name string, data interface{}) Render {
36 | return HTML{
37 | Template: r.Template,
38 | Name: name,
39 | Data: data,
40 | }
41 | }
42 |
43 | func (r HTMLDebug) Instance(name string, data interface{}) Render {
44 | return HTML{
45 | Template: r.loadTemplate(),
46 | Name: name,
47 | Data: data,
48 | }
49 | }
50 | func (r HTMLDebug) loadTemplate() *template.Template {
51 | if len(r.Files) > 0 {
52 | return template.Must(template.ParseFiles(r.Files...))
53 | }
54 | if len(r.Glob) > 0 {
55 | return template.Must(template.ParseGlob(r.Glob))
56 | }
57 | panic("the HTML debug render was created without files or glob pattern")
58 | }
59 |
60 | func (r HTML) Render(w http.ResponseWriter) error {
61 | writeContentType(w, htmlContentType)
62 | if len(r.Name) == 0 {
63 | return r.Template.Execute(w, r.Data)
64 | } else {
65 | return r.Template.ExecuteTemplate(w, r.Name, r.Data)
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "encoding/json"
9 | "net/http"
10 | )
11 |
12 | type (
13 | JSON struct {
14 | Data interface{}
15 | }
16 |
17 | IndentedJSON struct {
18 | Data interface{}
19 | }
20 | )
21 |
22 | var jsonContentType = []string{"application/json; charset=utf-8"}
23 |
24 | func (r JSON) Render(w http.ResponseWriter) error {
25 | return WriteJSON(w, r.Data)
26 | }
27 |
28 | func (r IndentedJSON) Render(w http.ResponseWriter) error {
29 | writeContentType(w, jsonContentType)
30 | jsonBytes, err := json.MarshalIndent(r.Data, "", " ")
31 | if err != nil {
32 | return err
33 | }
34 | w.Write(jsonBytes)
35 | return nil
36 | }
37 |
38 | func WriteJSON(w http.ResponseWriter, obj interface{}) error {
39 | writeContentType(w, jsonContentType)
40 | return json.NewEncoder(w).Encode(obj)
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/redirect.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "fmt"
9 | "net/http"
10 | )
11 |
12 | type Redirect struct {
13 | Code int
14 | Request *http.Request
15 | Location string
16 | }
17 |
18 | func (r Redirect) Render(w http.ResponseWriter) error {
19 | if r.Code < 300 || r.Code > 308 {
20 | panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))
21 | }
22 | http.Redirect(w, r.Request, r.Location, r.Code)
23 | return nil
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/render.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import "net/http"
8 |
9 | type Render interface {
10 | Render(http.ResponseWriter) error
11 | }
12 |
13 | var (
14 | _ Render = JSON{}
15 | _ Render = IndentedJSON{}
16 | _ Render = XML{}
17 | _ Render = String{}
18 | _ Render = Redirect{}
19 | _ Render = Data{}
20 | _ Render = HTML{}
21 | _ HTMLRender = HTMLDebug{}
22 | _ HTMLRender = HTMLProduction{}
23 | )
24 |
25 | func writeContentType(w http.ResponseWriter, value []string) {
26 | header := w.Header()
27 | if val := header["Content-Type"]; len(val) == 0 {
28 | header["Content-Type"] = value
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/text.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | "net/http"
11 | )
12 |
13 | type String struct {
14 | Format string
15 | Data []interface{}
16 | }
17 |
18 | var plainContentType = []string{"text/plain; charset=utf-8"}
19 |
20 | func (r String) Render(w http.ResponseWriter) error {
21 | WriteString(w, r.Format, r.Data)
22 | return nil
23 | }
24 |
25 | func WriteString(w http.ResponseWriter, format string, data []interface{}) {
26 | writeContentType(w, plainContentType)
27 |
28 | if len(data) > 0 {
29 | fmt.Fprintf(w, format, data...)
30 | } else {
31 | io.WriteString(w, format)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/xml.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "encoding/xml"
9 | "net/http"
10 | )
11 |
12 | type XML struct {
13 | Data interface{}
14 | }
15 |
16 | var xmlContentType = []string{"application/xml; charset=utf-8"}
17 |
18 | func (r XML) Render(w http.ResponseWriter) error {
19 | writeContentType(w, xmlContentType)
20 | return xml.NewEncoder(w).Encode(r.Data)
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/wercker.yml:
--------------------------------------------------------------------------------
1 | box: wercker/default
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/audio.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type audio struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.AudioConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewAudioShare(chatID int, fileID string) *audio {
13 | return &audio{
14 | bot: b.Bot,
15 | config: tgbotapi.NewAudioShare(chatID, fileID),
16 | }
17 | }
18 |
19 | func (b *Base) NewAudioUpload(chatID int, file interface{}) *audio {
20 | return &audio{
21 | config: tgbotapi.NewAudioUpload(chatID, file),
22 | }
23 | }
24 |
25 | func (a *audio) FilePath(path string) *audio {
26 | a.config.FilePath = path
27 | return a
28 | }
29 |
30 | func (a *audio) Duration(duration int) *audio {
31 | a.config.Duration = duration
32 | return a
33 | }
34 |
35 | func (a *audio) Performer(performer string) *audio {
36 | a.config.Performer = performer
37 | return a
38 | }
39 |
40 | func (a *audio) Title(title string) *audio {
41 | a.config.Title = title
42 | return a
43 | }
44 |
45 | func (a *audio) ReplyMarkup(markup interface{}) *audio {
46 | a.config.ReplyMarkup = markup
47 | return a
48 | }
49 |
50 | func (a *audio) ReplyToMessageID(id int) *audio {
51 | a.config.ReplyToMessageID = id
52 | return a
53 | }
54 |
55 | func (a *audio) UseExistingAudio() *audio {
56 | a.config.UseExistingAudio = true
57 | return a
58 | }
59 |
60 | func (p *audio) Send() *audio {
61 | msg, err := p.bot.SendAudio(p.config)
62 | p.Ret = msg
63 | p.Err = err
64 | return p
65 | }
66 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/chatAction.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type action struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.ChatActionConfig
9 | }
10 |
11 | func (b *Base) NewChatAction(chatID int) *action {
12 | return &action{
13 | bot: b.Bot,
14 | config: tgbotapi.NewChatAction(chatID, ""),
15 | }
16 | }
17 |
18 | func (a *action) Typing() *action {
19 | a.config.Action = tgbotapi.ChatTyping
20 | return a
21 | }
22 |
23 | func (a *action) RecordAudio() *action {
24 | a.config.Action = tgbotapi.ChatRecordAudio
25 | return a
26 | }
27 |
28 | func (a *action) RecordVideo() *action {
29 | a.config.Action = tgbotapi.ChatRecordVideo
30 | return a
31 | }
32 |
33 | func (a *action) UploadAudio() *action {
34 | a.config.Action = tgbotapi.ChatUploadAudio
35 | return a
36 | }
37 |
38 | func (a *action) UploadDocument() *action {
39 | a.config.Action = tgbotapi.ChatUploadDocument
40 | return a
41 | }
42 |
43 | func (a *action) UploadPhoto() *action {
44 | a.config.Action = tgbotapi.ChatUploadPhoto
45 | return a
46 | }
47 |
48 | func (a *action) UploadVideo() *action {
49 | a.config.Action = tgbotapi.ChatUploadVideo
50 | return a
51 | }
52 |
53 | func (a *action) Send() *action {
54 | err := a.bot.SendChatAction(a.config)
55 | a.Err = err
56 | return a
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/document.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type doc struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.DocumentConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewDocumentShare(chatID int, fileID string) *doc {
13 | return &doc{
14 | bot: b.Bot,
15 | config: tgbotapi.NewDocumentShare(chatID, fileID),
16 | }
17 | }
18 |
19 | func (b *Base) NewDocumentUpload(chatID int, file interface{}) *doc {
20 | return &doc{
21 | config: tgbotapi.NewDocumentUpload(chatID, file),
22 | }
23 | }
24 |
25 | func (d *doc) FilePath(path string) *doc {
26 | d.config.FilePath = path
27 | return d
28 | }
29 |
30 | func (d *doc) ReplyMarkup(markup interface{}) *doc {
31 | d.config.ReplyMarkup = markup
32 | return d
33 | }
34 |
35 | func (d *doc) ReplyToMessageID(id int) *doc {
36 | d.config.ReplyToMessageID = id
37 | return d
38 | }
39 |
40 | func (d *doc) Send() *doc {
41 | msg, err := d.bot.SendDocument(d.config)
42 | d.Ret = msg
43 | d.Err = err
44 | return d
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/file.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | func (b *Base) GetLink(fileID string) (string, error) {
6 | file, err := b.Bot.GetFile(tgbotapi.FileConfig{fileID})
7 | if err != nil {
8 | return "", err
9 | }
10 | return file.Link(b.Bot.Token), nil
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/location.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type location struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.LocationConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewLocation(chatID int, latitude float64, longitude float64) *location {
13 | return &location{
14 | bot: b.Bot,
15 | config: tgbotapi.NewLocation(chatID, latitude, longitude),
16 | }
17 | }
18 |
19 | func (l *location) ReplyMarkup(markup interface{}) *location {
20 | l.config.ReplyMarkup = markup
21 | return l
22 | }
23 |
24 | func (l *location) ReplyToMessageID(id int) *location {
25 | l.config.ReplyToMessageID = id
26 | return l
27 | }
28 |
29 | func (l *location) Send() *location {
30 | msg, err := l.bot.SendLocation(l.config)
31 | l.Ret = msg
32 | l.Err = err
33 | return l
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/markup.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type replyKeyboardMarkup struct {
6 | config tgbotapi.ReplyKeyboardMarkup
7 | }
8 |
9 | func (b *Base) NewReplyKeyboardMarkup(keyboard [][]string) *replyKeyboardMarkup {
10 | return &replyKeyboardMarkup{
11 | tgbotapi.ReplyKeyboardMarkup{Keyboard: keyboard},
12 | }
13 | }
14 |
15 | func (r *replyKeyboardMarkup) ResizeKeyboard() *replyKeyboardMarkup {
16 | r.config.ResizeKeyboard = true
17 | return r
18 | }
19 |
20 | func (r *replyKeyboardMarkup) OneTimeKeyboard() *replyKeyboardMarkup {
21 | r.config.OneTimeKeyboard = true
22 | return r
23 | }
24 |
25 | func (r *replyKeyboardMarkup) Selective() *replyKeyboardMarkup {
26 | r.config.Selective = true
27 | return r
28 | }
29 |
30 | func (r *replyKeyboardMarkup) Done() tgbotapi.ReplyKeyboardMarkup {
31 | return r.config
32 | }
33 |
34 | type replyKeyboardHide struct {
35 | config tgbotapi.ReplyKeyboardHide
36 | }
37 |
38 | func (b *Base) NewReplyKeyboardHide() *replyKeyboardHide {
39 | return &replyKeyboardHide{
40 | tgbotapi.ReplyKeyboardHide{HideKeyboard: true},
41 | }
42 | }
43 |
44 | func (r *replyKeyboardHide) Selective() *replyKeyboardHide {
45 | r.config.Selective = true
46 | return r
47 | }
48 |
49 | func (r *replyKeyboardHide) Done() tgbotapi.ReplyKeyboardHide {
50 | return r.config
51 | }
52 |
53 | type forceReply struct {
54 | config tgbotapi.ForceReply
55 | }
56 |
57 | func (b *Base) NewForceReply() *forceReply {
58 | return &forceReply{
59 | tgbotapi.ForceReply{ForceReply: true},
60 | }
61 | }
62 |
63 | func (r *forceReply) Selective() *forceReply {
64 | r.config.Selective = true
65 | return r
66 | }
67 |
68 | func (r *forceReply) Done() tgbotapi.ForceReply {
69 | return r.config
70 | }
71 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/message.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type message struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.MessageConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewMessage(chatID int, text string) *message {
13 | return &message{
14 | bot: b.Bot,
15 | config: tgbotapi.NewMessage(chatID, text),
16 | }
17 | }
18 |
19 | func (m *message) DisableWebPagePreview() *message {
20 | m.config.DisableWebPagePreview = true
21 | return m
22 | }
23 |
24 | func (m *message) MarkdownMode() *message {
25 | m.config.ParseMode = tgbotapi.ModeMarkdown
26 | return m
27 | }
28 |
29 | func (m *message) ReplyToMessageID(ID int) *message {
30 | m.config.ReplyToMessageID = ID
31 | return m
32 | }
33 |
34 | func (m *message) ReplyMarkup(markup interface{}) *message {
35 | m.config.ReplyMarkup = markup
36 | return m
37 | }
38 |
39 | func (m *message) Send() *message {
40 | msg, err := m.bot.SendMessage(m.config)
41 | m.Ret = msg
42 | m.Err = err
43 | return m
44 | }
45 |
46 | type forward struct {
47 | Err error
48 | bot *tgbotapi.BotAPI
49 | config tgbotapi.ForwardConfig
50 | Ret tgbotapi.Message
51 | }
52 |
53 | func (b *Base) NewForward(chatID, fromChatID, messageID int) *forward {
54 | return &forward{
55 | bot: b.Bot,
56 | config: tgbotapi.NewForward(chatID, fromChatID, messageID),
57 | }
58 | }
59 |
60 | func (f *forward) Send() *forward {
61 | msg, err := f.bot.ForwardMessage(f.config)
62 | f.Ret = msg
63 | f.Err = err
64 | return f
65 | }
66 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/sticker.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type sticker struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.StickerConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewStickerShare(chatID int, fileID string) *sticker {
13 | return &sticker{
14 | bot: b.Bot,
15 | config: tgbotapi.NewStickerShare(chatID, fileID),
16 | }
17 | }
18 |
19 | func (b *Base) NewStickerUpload(chatID int, file interface{}) *sticker {
20 | return &sticker{
21 | bot: b.Bot,
22 | config: tgbotapi.NewStickerUpload(chatID, file),
23 | }
24 | }
25 |
26 | func (s *sticker) FilePath(path string) *sticker {
27 | s.config.FilePath = path
28 | return s
29 | }
30 |
31 | func (s *sticker) ReplyMarkup(markup interface{}) *sticker {
32 | s.config.ReplyMarkup = markup
33 | return s
34 | }
35 |
36 | func (s *sticker) ReplyToMessageID(id int) *sticker {
37 | s.config.ReplyToMessageID = id
38 | return s
39 | }
40 |
41 | func (s *sticker) Send() *sticker {
42 | msg, err := s.bot.SendSticker(s.config)
43 | s.Ret = msg
44 | s.Err = err
45 | return s
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/video.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type video struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.VideoConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewVideoShare(chatID int, fileID string) *video {
13 | return &video{
14 | bot: b.Bot,
15 | config: tgbotapi.NewVideoShare(chatID, fileID),
16 | }
17 | }
18 |
19 | func (b *Base) NewVideoUploadv(chatID int, file interface{}) *video {
20 | return &video{
21 | bot: b.Bot,
22 | config: tgbotapi.NewVideoUpload(chatID, file),
23 | }
24 | }
25 |
26 | func (v *video) FilePath(path string) *video {
27 | v.config.FilePath = path
28 | return v
29 | }
30 |
31 | func (v *video) Duration(duration int) *video {
32 | v.config.Duration = duration
33 | return v
34 | }
35 |
36 | func (v *video) Caption(caption string) *video {
37 | v.config.Caption = caption
38 | return v
39 | }
40 |
41 | func (v *video) ReplyMarkup(markup interface{}) *video {
42 | v.config.ReplyMarkup = markup
43 | return v
44 | }
45 |
46 | func (v *video) ReplyToMessageID(id int) *video {
47 | v.config.ReplyToMessageID = id
48 | return v
49 | }
50 |
51 | func (v *video) Send() *video {
52 | msg, err := v.bot.SendVideo(v.config)
53 | v.Ret = msg
54 | v.Err = err
55 | return v
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/github.com/jqs7/bb/voice.go:
--------------------------------------------------------------------------------
1 | package bb
2 |
3 | import "github.com/Syfaro/telegram-bot-api"
4 |
5 | type voice struct {
6 | Err error
7 | bot *tgbotapi.BotAPI
8 | config tgbotapi.VoiceConfig
9 | Ret tgbotapi.Message
10 | }
11 |
12 | func (b *Base) NewVoiceShare(chatID int, fileID string) *voice {
13 | return &voice{
14 | bot: b.Bot,
15 | config: tgbotapi.NewVoiceShare(chatID, fileID),
16 | }
17 | }
18 |
19 | func (b *Base) NewVoiceUpload(chatID int, file interface{}) *voice {
20 | return &voice{
21 | bot: b.Bot,
22 | config: tgbotapi.NewVoiceUpload(chatID, file),
23 | }
24 | }
25 |
26 | func (v *voice) FilePath(path string) *voice {
27 | v.config.FilePath = path
28 | return v
29 | }
30 |
31 | func (v *voice) Duration(duration int) *voice {
32 | v.config.Duration = duration
33 | return v
34 | }
35 |
36 | func (v *voice) ReplyMarkup(markup interface{}) *voice {
37 | v.config.ReplyMarkup = markup
38 | return v
39 | }
40 |
41 | func (v *voice) ReplyToMessageID(id int) *voice {
42 | v.config.ReplyToMessageID = id
43 | return v
44 | }
45 |
46 | func (v *voice) Send() *voice {
47 | msg, err := v.bot.SendVoice(v.config)
48 | v.Ret = msg
49 | v.Err = err
50 | return v
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/github.com/kylelemons/go-gypsy/yaml/Makefile:
--------------------------------------------------------------------------------
1 | include $(GOROOT)/src/Make.inc
2 |
3 | TARG=github.com/kylelemons/go-gypsy/yaml
4 | GOFILES=\
5 | types.go\
6 | parser.go\
7 | config.go\
8 |
9 | include $(GOROOT)/src/Make.pkg
10 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/feedreader/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Feedreader is a Go package for parsing RSS 2.0 and Atom 1.0 feed.
3 |
4 | Feedreader on github: http://github.com/m3ng9i/feedreader
5 |
6 | Below is an example, it parse a feed, then print feed title, number of items and all the title of items.
7 |
8 | package main
9 |
10 | import "fmt"
11 | import "os"
12 | import "github.com/m3ng9i/feedreader"
13 |
14 | func main() {
15 | feed, err := feedreader.Fetch("http://example.com/feed.xml")
16 | if err != nil {
17 | fmt.Fprintln(os.Stderr, err)
18 | } else {
19 | fmt.Println("feed title: ", feed.Title)
20 |
21 | fmt.Printf("There are %d item(s) in the feed\n", len(feed.Items))
22 | for _, i := range(feed.Items) {
23 | fmt.Println(i.Title)
24 | }
25 | }
26 | }
27 |
28 | Function `Fetch` could parse a feed whatever it is RSS or Atom, it return a `Feed` structure.
29 |
30 | For more information, just read the code. First you should read `Feed`, `FeedItem` and `FeedPerson` structure. If you want parse RSS or Atom from scratch, you need to read the rest code of the package.
31 |
32 | If you want to know more about RSS and Atom, read the specification below:
33 |
34 | RSS 2.0 Specification: http://www.rssboard.org/rss-specification
35 |
36 | The Atom Syndication Format: http://tools.ietf.org/html/rfc4287
37 | */
38 | package feedreader
39 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/feedreader/error.go:
--------------------------------------------------------------------------------
1 | package feedreader
2 |
3 | import "fmt"
4 |
5 | type FetchError struct {
6 | Url string
7 | Err error
8 | }
9 |
10 | type ParseError struct {
11 | Err error
12 | }
13 |
14 | func (this *FetchError) Error() string {
15 | return fmt.Sprintf("Error occurs when fetching feed from '%s': %s", this.Url, this.Err.Error())
16 | }
17 |
18 | func (this *ParseError) Error() string {
19 | return this.Err.Error()
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/feedreader/init.go:
--------------------------------------------------------------------------------
1 | package feedreader
2 |
3 | import httphelper "github.com/m3ng9i/go-utils/http"
4 |
5 |
6 | var defaultFetcher *httphelper.Fetcher
7 |
8 |
9 | func init() {
10 | header := make(map[string]string)
11 | header["User-Agent"] = "feedreader (http://github.com/m3ng9i/feedreader)"
12 |
13 | defaultFetcher = httphelper.NewFetcher(nil, header)
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/feedreader/utils.go:
--------------------------------------------------------------------------------
1 | package feedreader
2 |
3 | import "encoding/xml"
4 | import "bytes"
5 | import "io"
6 | import "html"
7 | import "strings"
8 | import myhtml "github.com/m3ng9i/go-utils/html"
9 |
10 |
11 | // convert content to html
12 | func transformContent(content string) string {
13 | if strings.ContainsAny(content, "<>") {
14 | return content
15 | } else {
16 | c := html.UnescapeString(content)
17 | if strings.ContainsAny(c, "<>") {
18 | return c
19 | } else {
20 | return myhtml.Text2Html(c)
21 | }
22 | }
23 | }
24 |
25 |
26 | // unmarshal xml bytes to interface value v, use this function to instead of xml.Unmarshal()
27 | func unmarshal(b []byte, v interface{}) error {
28 | decorder := xml.NewDecoder(bytes.NewReader(b))
29 | decorder.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) {
30 | return input, nil
31 | }
32 | return decorder.Decode(v)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/go-utils/encoding/utf8gbk.go:
--------------------------------------------------------------------------------
1 | package encoding
2 |
3 | import "bytes"
4 | import "io"
5 | import "io/ioutil"
6 | import "golang.org/x/text/encoding/simplifiedchinese"
7 | import "golang.org/x/text/transform"
8 |
9 |
10 | func GbkToUtf8Reader(r io.Reader) io.Reader {
11 | return transform.NewReader(r, simplifiedchinese.GBK.NewDecoder())
12 | }
13 |
14 |
15 | func Utf8ToGbkReader(r io.Reader) io.Reader {
16 | return transform.NewReader(r, simplifiedchinese.GBK.NewEncoder())
17 | }
18 |
19 |
20 | func GbkToUtf8BytesReader(b []byte) io.Reader {
21 | return GbkToUtf8Reader(bytes.NewReader(b))
22 | }
23 |
24 |
25 | func Utf8ToGbkBytesReader(b []byte) io.Reader {
26 | return Utf8ToGbkReader(bytes.NewReader(b))
27 | }
28 |
29 |
30 | func GbkToUtf8(b []byte) ([]byte, error) {
31 | d, e := ioutil.ReadAll(GbkToUtf8BytesReader(b))
32 | if e != nil {
33 | return nil, e
34 | }
35 | return d, nil
36 | }
37 |
38 |
39 | func Utf8ToGbk(b []byte) ([]byte, error) {
40 | d, e := ioutil.ReadAll(Utf8ToGbkBytesReader(b))
41 | if e != nil {
42 | return nil, e
43 | }
44 | return d, nil
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/go-utils/http/request_id.go:
--------------------------------------------------------------------------------
1 | package http
2 |
3 | import "fmt"
4 | import "time"
5 | import "crypto/rand"
6 | import "crypto/md5"
7 | import "io"
8 |
9 |
10 | // A string for identify each http request
11 | type RequestId string
12 |
13 |
14 | /*
15 | Create a function to generate random request ids.
16 | You can use parameter length to set the length of the result.
17 | The max length of result is 32.
18 | You can use request url as the parameter in the returned function to provide a more randomly result.
19 |
20 | Example:
21 | NewReqeustId := RequestIdGenerator(12)
22 | fmt.Println(NewReqeustId("http://example.com"))
23 | // Output: b08ea4a86fe3
24 | */
25 | func RequestIdGenerator(length int) func(url ...string) RequestId {
26 |
27 | if length < 0 {
28 | length = 0
29 | } else if length > 32 {
30 | length = 32
31 | }
32 |
33 | return func(url ...string) RequestId {
34 | if length == 0 {
35 | return ""
36 | }
37 |
38 | // 32 random bytes
39 | b := make([]byte, 32)
40 | rand.Read(b)
41 |
42 | hash := md5.New()
43 |
44 | var s string
45 | if len(url) > 0 {
46 | s = url[0]
47 | }
48 |
49 | io.WriteString(hash, fmt.Sprintf("%d%s", time.Now().UnixNano(), s))
50 | hash.Write(b)
51 |
52 | return RequestId(fmt.Sprintf("%x", hash.Sum(nil))[:length])
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/go-utils/possible/possible.go:
--------------------------------------------------------------------------------
1 | package possible
2 |
3 | type Possible string
4 |
5 | const Yes Possible = "yes"
6 | const No Possible = "no"
7 | const Maybe Possible = "maybe"
8 |
9 |
--------------------------------------------------------------------------------
/vendor/github.com/m3ng9i/go-utils/xml/xml.go:
--------------------------------------------------------------------------------
1 | package xml
2 |
3 | import "regexp"
4 |
5 | /*
6 | Remove invalid xml characters.
7 |
8 | When parsing some xml doc, encoding/xml package will return an error:
9 | XML syntax error on line XXX: illegal character code U+XXXX
10 | This function will solve the problem.
11 |
12 | The list of valid characters is in the XML specification:
13 | http://www.w3.org/TR/xml/#charsets
14 |
15 | Valid characters:
16 | #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
17 | */
18 | func RemoveInvalidChars(b []byte) []byte {
19 | re := regexp.MustCompile("[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]")
20 | return re.ReplaceAll(b, []byte{})
21 | }
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/vendor/github.com/manucorporat/sse/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Manuel Martínez-Almeida
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/manucorporat/sse/writer.go:
--------------------------------------------------------------------------------
1 | package sse
2 |
3 | import "io"
4 |
5 | type stringWriter interface {
6 | io.Writer
7 | WriteString(string) (int, error)
8 | }
9 |
10 | type stringWrapper struct {
11 | io.Writer
12 | }
13 |
14 | func (w stringWrapper) WriteString(str string) (int, error) {
15 | return w.Writer.Write([]byte(str))
16 | }
17 |
18 | func checkWriter(writer io.Writer) stringWriter {
19 | if w, ok := writer.(stringWriter); ok {
20 | return w
21 | } else {
22 | return stringWrapper{writer}
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/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 | 
11 |
12 |
13 | ## So Good!
14 |
15 | 
16 |
17 | ## Usage
18 |
19 | ```go
20 | logrus.SetOutput(colorable.NewColorableStdout())
21 |
22 | logrus.Info("succeeded")
23 | logrus.Warn("not correct")
24 | logrus.Error("something error")
25 | logrus.Fatal("panic")
26 | ```
27 |
28 | You can compile above code on non-windows OSs.
29 |
30 | ## Installation
31 |
32 | ```
33 | $ go get github.com/mattn/go-colorable
34 | ```
35 |
36 | # License
37 |
38 | MIT
39 |
40 | # Author
41 |
42 | Yasuhiro Matsumoto (a.k.a mattn)
43 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-colorable/colorable_others.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 |
3 | package colorable
4 |
5 | import (
6 | "io"
7 | "os"
8 | )
9 |
10 | func NewColorableStdout() io.Writer {
11 | return os.Stdout
12 | }
13 |
14 | func NewColorableStderr() io.Writer {
15 | return os.Stderr
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/doc.go:
--------------------------------------------------------------------------------
1 | // Package isatty implements interface to isatty
2 | package isatty
3 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/github.com/pyk/byten/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Bayu Aldi Yansyah
2 |
3 | MIT License
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/vendor/github.com/pyk/byten/README.md:
--------------------------------------------------------------------------------
1 | byten
2 | =====
3 | Bit the size of file and turn it into human readable format.
4 |
5 | This is a Go Package that convert size of file into human readable format.
6 |
7 | Another weekend project by [pyk](http://google.com/+bayualdiyansyah).
8 | ### Usage
9 | First thing first, get the remote package
10 | ```
11 | $ go get github.com/pyk/byten
12 | ```
13 | and import package into your project
14 | ```
15 | import "github.com/pyk/byten"
16 | ```
17 | then bite the bytes!
18 | ```
19 | byten.Size(1024) # => 1.0KB
20 | byten.Size(206848) # => 202KB
21 | byten.Size(10239999998976) # => 9.3TB
22 | byten.Size(6314666666666665984) # => 5.5EB
23 | ```
24 | easy huh? =))
25 |
26 | ### Docs
27 |
28 | Nothing fancy, but you can see [here](https://godoc.org/github.com/pyk/byten)
29 |
30 | ### License
31 | [MIT License](https://github.com/pyk/byten/blob/master/LICENSE)
32 |
--------------------------------------------------------------------------------
/vendor/github.com/pyk/byten/size.go:
--------------------------------------------------------------------------------
1 | package byten
2 |
3 | import (
4 | "fmt"
5 | "math"
6 | )
7 |
8 | func index(s int64) float64 {
9 | x := math.Log(float64(s)) / math.Log(1024)
10 | return math.Floor(x)
11 | }
12 |
13 | func countSize(s int64, i float64) float64 {
14 | return float64(s) / math.Pow(1024, math.Floor(i))
15 | }
16 |
17 | // Size return a formated string from file size
18 | func Size(s int64) string {
19 |
20 | symbols := []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"}
21 | i := index(s)
22 | if s < 10 {
23 | return fmt.Sprintf("%dB", s)
24 | }
25 | size := countSize(s, i)
26 | format := "%.0f"
27 | if size < 10 {
28 | format = "%.1f"
29 | }
30 |
31 | return fmt.Sprintf(format+"%s", size, symbols[int(i)])
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/LICENSE:
--------------------------------------------------------------------------------
1 | gopsutil is distributed under BSD license reproduced below.
2 |
3 | Copyright (c) 2014, WAKAYAMA Shirou
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification,
7 | are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 | * Neither the name of the gopsutil authors nor the names of its contributors
15 | may be used to endorse or promote products derived from this software without
16 | specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/common/common_darwin.go:
--------------------------------------------------------------------------------
1 | // +build darwin
2 |
3 | package common
4 |
5 | import (
6 | "os/exec"
7 | "strings"
8 | "syscall"
9 | "unsafe"
10 | )
11 |
12 | func DoSysctrl(mib string) ([]string, error) {
13 | out, err := exec.Command("/usr/sbin/sysctl", "-n", mib).Output()
14 | if err != nil {
15 | return []string{}, err
16 | }
17 | v := strings.Replace(string(out), "{ ", "", 1)
18 | v = strings.Replace(string(v), " }", "", 1)
19 | values := strings.Fields(string(v))
20 |
21 | return values, nil
22 | }
23 |
24 | func CallSyscall(mib []int32) ([]byte, uint64, error) {
25 | miblen := uint64(len(mib))
26 |
27 | // get required buffer size
28 | length := uint64(0)
29 | _, _, err := syscall.Syscall6(
30 | syscall.SYS___SYSCTL,
31 | uintptr(unsafe.Pointer(&mib[0])),
32 | uintptr(miblen),
33 | 0,
34 | uintptr(unsafe.Pointer(&length)),
35 | 0,
36 | 0)
37 | if err != 0 {
38 | var b []byte
39 | return b, length, err
40 | }
41 | if length == 0 {
42 | var b []byte
43 | return b, length, err
44 | }
45 | // get proc info itself
46 | buf := make([]byte, length)
47 | _, _, err = syscall.Syscall6(
48 | syscall.SYS___SYSCTL,
49 | uintptr(unsafe.Pointer(&mib[0])),
50 | uintptr(miblen),
51 | uintptr(unsafe.Pointer(&buf[0])),
52 | uintptr(unsafe.Pointer(&length)),
53 | 0,
54 | 0)
55 | if err != 0 {
56 | return buf, length, err
57 | }
58 |
59 | return buf, length, nil
60 | }
61 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/common/common_freebsd.go:
--------------------------------------------------------------------------------
1 | // +build freebsd
2 |
3 | package common
4 |
5 | import (
6 | "syscall"
7 | "os/exec"
8 | "strings"
9 | "unsafe"
10 | )
11 |
12 | func DoSysctrl(mib string) ([]string, error) {
13 | out, err := exec.Command("/sbin/sysctl", "-n", mib).Output()
14 | if err != nil {
15 | return []string{}, err
16 | }
17 | v := strings.Replace(string(out), "{ ", "", 1)
18 | v = strings.Replace(string(v), " }", "", 1)
19 | values := strings.Fields(string(v))
20 |
21 | return values, nil
22 | }
23 |
24 | func CallSyscall(mib []int32) ([]byte, uint64, error) {
25 | miblen := uint64(len(mib))
26 |
27 | // get required buffer size
28 | length := uint64(0)
29 | _, _, err := syscall.Syscall6(
30 | syscall.SYS___SYSCTL,
31 | uintptr(unsafe.Pointer(&mib[0])),
32 | uintptr(miblen),
33 | 0,
34 | uintptr(unsafe.Pointer(&length)),
35 | 0,
36 | 0)
37 | if err != 0 {
38 | var b []byte
39 | return b, length, err
40 | }
41 | if length == 0 {
42 | var b []byte
43 | return b, length, err
44 | }
45 | // get proc info itself
46 | buf := make([]byte, length)
47 | _, _, err = syscall.Syscall6(
48 | syscall.SYS___SYSCTL,
49 | uintptr(unsafe.Pointer(&mib[0])),
50 | uintptr(miblen),
51 | uintptr(unsafe.Pointer(&buf[0])),
52 | uintptr(unsafe.Pointer(&length)),
53 | 0,
54 | 0)
55 | if err != 0 {
56 | return buf, length, err
57 | }
58 |
59 | return buf, length, nil
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/cpu/cpu_unix.go:
--------------------------------------------------------------------------------
1 | // +build linux freebsd darwin
2 |
3 | package cpu
4 |
5 | import "time"
6 |
7 | func init() {
8 | lastCPUTimes, _ = CPUTimes(false)
9 | lastPerCPUTimes, _ = CPUTimes(true)
10 | }
11 |
12 | func CPUPercent(interval time.Duration, percpu bool) ([]float64, error) {
13 | getAllBusy := func(t CPUTimesStat) (float64, float64) {
14 | busy := t.User + t.System + t.Nice + t.Iowait + t.Irq +
15 | t.Softirq + t.Steal + t.Guest + t.GuestNice + t.Stolen
16 | return busy + t.Idle, busy
17 | }
18 |
19 | calculate := func(t1, t2 CPUTimesStat) float64 {
20 | t1All, t1Busy := getAllBusy(t1)
21 | t2All, t2Busy := getAllBusy(t2)
22 |
23 | if t2Busy <= t1Busy {
24 | return 0
25 | }
26 | if t2All <= t1All {
27 | return 1
28 | }
29 | return (t2Busy - t1Busy) / (t2All - t1All) * 100
30 | }
31 |
32 | cpuTimes, err := CPUTimes(percpu)
33 | if err != nil {
34 | return nil, err
35 | }
36 |
37 | if interval > 0 {
38 | if !percpu {
39 | lastCPUTimes = cpuTimes
40 | } else {
41 | lastPerCPUTimes = cpuTimes
42 | }
43 | time.Sleep(interval)
44 | cpuTimes, err = CPUTimes(percpu)
45 | if err != nil {
46 | return nil, err
47 | }
48 | }
49 |
50 | ret := make([]float64, len(cpuTimes))
51 | if !percpu {
52 | ret[0] = calculate(lastCPUTimes[0], cpuTimes[0])
53 | lastCPUTimes = cpuTimes
54 | } else {
55 | for i, t := range cpuTimes {
56 | ret[i] = calculate(lastPerCPUTimes[i], t)
57 | }
58 | lastPerCPUTimes = cpuTimes
59 | }
60 | return ret, nil
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/disk/disk.go:
--------------------------------------------------------------------------------
1 | package disk
2 |
3 | import (
4 | "encoding/json"
5 | )
6 |
7 | type DiskUsageStat struct {
8 | Path string `json:"path"`
9 | Fstype string `json:"fstype"`
10 | Total uint64 `json:"total"`
11 | Free uint64 `json:"free"`
12 | Used uint64 `json:"used"`
13 | UsedPercent float64 `json:"used_percent"`
14 | InodesTotal uint64 `json:"inodes_total"`
15 | InodesUsed uint64 `json:"inodes_used"`
16 | InodesFree uint64 `json:"inodes_free"`
17 | InodesUsedPercent float64 `json:"inodes_used_percent"`
18 | }
19 |
20 | type DiskPartitionStat struct {
21 | Device string `json:"device"`
22 | Mountpoint string `json:"mountpoint"`
23 | Fstype string `json:"fstype"`
24 | Opts string `json:"opts"`
25 | }
26 |
27 | type DiskIOCountersStat struct {
28 | ReadCount uint64 `json:"read_count"`
29 | WriteCount uint64 `json:"write_count"`
30 | ReadBytes uint64 `json:"read_bytes"`
31 | WriteBytes uint64 `json:"write_bytes"`
32 | ReadTime uint64 `json:"read_time"`
33 | WriteTime uint64 `json:"write_time"`
34 | Name string `json:"name"`
35 | IoTime uint64 `json:"io_time"`
36 | SerialNumber string `json:"serial_number"`
37 | }
38 |
39 | func (d DiskUsageStat) String() string {
40 | s, _ := json.Marshal(d)
41 | return string(s)
42 | }
43 |
44 | func (d DiskPartitionStat) String() string {
45 | s, _ := json.Marshal(d)
46 | return string(s)
47 | }
48 |
49 | func (d DiskIOCountersStat) String() string {
50 | s, _ := json.Marshal(d)
51 | return string(s)
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/disk/disk_unix.go:
--------------------------------------------------------------------------------
1 | // +build freebsd linux darwin
2 |
3 | package disk
4 |
5 | import "syscall"
6 |
7 | func DiskUsage(path string) (*DiskUsageStat, error) {
8 | stat := syscall.Statfs_t{}
9 | err := syscall.Statfs(path, &stat)
10 | if err != nil {
11 | return nil, err
12 | }
13 | bsize := stat.Bsize
14 |
15 | ret := &DiskUsageStat{
16 | Path: path,
17 | Fstype: getFsType(stat),
18 | Total: (uint64(stat.Blocks) * uint64(bsize)),
19 | Free: (uint64(stat.Bfree) * uint64(bsize)),
20 | InodesTotal: (uint64(stat.Files)),
21 | InodesFree: (uint64(stat.Ffree)),
22 | }
23 |
24 | ret.InodesUsed = (ret.InodesTotal - ret.InodesFree)
25 | ret.InodesUsedPercent = (float64(ret.InodesUsed) / float64(ret.InodesTotal)) * 100.0
26 | ret.Used = (uint64(stat.Blocks) - uint64(stat.Bfree)) * uint64(bsize)
27 | ret.UsedPercent = (float64(ret.Used) / float64(ret.Total)) * 100.0
28 |
29 | return ret, nil
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host.go:
--------------------------------------------------------------------------------
1 | package host
2 |
3 | import (
4 | "encoding/json"
5 | )
6 |
7 | // A HostInfoStat describes the host status.
8 | // This is not in the psutil but it useful.
9 | type HostInfoStat struct {
10 | Hostname string `json:"hostname"`
11 | Uptime uint64 `json:"uptime"`
12 | Procs uint64 `json:"procs"` // number of processes
13 | OS string `json:"os"` // ex: freebsd, linux
14 | Platform string `json:"platform"` // ex: ubuntu, linuxmint
15 | PlatformFamily string `json:"platform_family"` // ex: debian, rhel
16 | PlatformVersion string `json:"platform_version"`
17 | VirtualizationSystem string `json:"virtualization_system"`
18 | VirtualizationRole string `json:"virtualization_role"` // guest or host
19 |
20 | }
21 |
22 | type UserStat struct {
23 | User string `json:"user"`
24 | Terminal string `json:"terminal"`
25 | Host string `json:"host"`
26 | Started int `json:"started"`
27 | }
28 |
29 | func (h HostInfoStat) String() string {
30 | s, _ := json.Marshal(h)
31 | return string(s)
32 | }
33 |
34 | func (u UserStat) String() string {
35 | s, _ := json.Marshal(u)
36 | return string(s)
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_darwin_amd64.go:
--------------------------------------------------------------------------------
1 | // Created by cgo -godefs - DO NOT EDIT
2 | // cgo -godefs types_darwin.go
3 |
4 | package host
5 |
6 | type Utmpx struct {
7 | User [256]int8
8 | Id [4]int8
9 | Line [32]int8
10 | Pid int32
11 | Type int16
12 | Pad_cgo_0 [6]byte
13 | Tv Timeval
14 | Host [256]int8
15 | Pad [16]uint32
16 | }
17 | type Timeval struct {
18 | Sec int32
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_freebsd_amd64.go:
--------------------------------------------------------------------------------
1 | // Created by cgo -godefs - DO NOT EDIT
2 | // cgo -godefs types_freebsd.go
3 |
4 | package host
5 |
6 | const (
7 | sizeofPtr = 0x8
8 | sizeofShort = 0x2
9 | sizeofInt = 0x4
10 | sizeofLong = 0x8
11 | sizeofLongLong = 0x8
12 | )
13 |
14 | type (
15 | _C_short int16
16 | _C_int int32
17 | _C_long int64
18 | _C_long_long int64
19 | )
20 |
21 | type Utmp struct {
22 | Line [8]int8
23 | Name [16]int8
24 | Host [16]int8
25 | Time int32
26 | }
27 | type Utmpx struct {
28 | Type int16
29 | Tv Timeval
30 | Id [8]int8
31 | Pid int32
32 | User [32]int8
33 | Line [16]int8
34 | Host [125]int8
35 | // Host [128]int8
36 | // X__ut_spare [64]int8
37 | }
38 | type Timeval struct {
39 | Sec [4]byte
40 | Usec [3]byte
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_linux_386.go:
--------------------------------------------------------------------------------
1 | // ATTENTION - FILE MANUAL FIXED AFTER CGO.
2 | // Fixed line: Tv _Ctype_struct_timeval -> Tv UtTv
3 | // Created by cgo -godefs, MANUAL FIXED
4 | // cgo -godefs types_linux.go
5 |
6 | package host
7 |
8 | const (
9 | sizeofPtr = 0x4
10 | sizeofShort = 0x2
11 | sizeofInt = 0x4
12 | sizeofLong = 0x4
13 | sizeofLongLong = 0x8
14 | )
15 |
16 | type (
17 | _C_short int16
18 | _C_int int32
19 | _C_long int32
20 | _C_long_long int64
21 | )
22 |
23 | type utmp struct {
24 | Type int16
25 | Pad_cgo_0 [2]byte
26 | Pid int32
27 | Line [32]int8
28 | Id [4]int8
29 | User [32]int8
30 | Host [256]int8
31 | Exit exit_status
32 | Session int32
33 | Tv UtTv
34 | Addr_v6 [4]int32
35 | X__unused [20]int8
36 | }
37 | type exit_status struct {
38 | Termination int16
39 | Exit int16
40 | }
41 | type UtTv struct {
42 | TvSec int32
43 | TvUsec int32
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_linux_amd64.go:
--------------------------------------------------------------------------------
1 | // Created by cgo -godefs - DO NOT EDIT
2 | // cgo -godefs types_linux.go
3 |
4 | package host
5 |
6 | const (
7 | sizeofPtr = 0x8
8 | sizeofShort = 0x2
9 | sizeofInt = 0x4
10 | sizeofLong = 0x8
11 | sizeofLongLong = 0x8
12 | )
13 |
14 | type (
15 | _C_short int16
16 | _C_int int32
17 | _C_long int64
18 | _C_long_long int64
19 | )
20 |
21 | type utmp struct {
22 | Type int16
23 | Pad_cgo_0 [2]byte
24 | Pid int32
25 | Line [32]int8
26 | Id [4]int8
27 | User [32]int8
28 | Host [256]int8
29 | Exit exit_status
30 | Session int32
31 | Tv UtTv
32 | Addr_v6 [4]int32
33 | X__glibc_reserved [20]int8
34 | }
35 | type exit_status struct {
36 | Termination int16
37 | Exit int16
38 | }
39 | type UtTv struct {
40 | TvSec int32
41 | TvUsec int32
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_linux_arm.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build arm
3 |
4 | package host
5 |
6 | type exitStatus struct {
7 | Etermination int16 // Process termination status.
8 | Eexit int16 // Process exit status.
9 | }
10 | type timeval struct {
11 | TvSec uint32 // Seconds.
12 | TvUsec uint32 // Microseconds.
13 | }
14 |
15 | type utmp struct {
16 | Type int16 // Type of login.
17 | Pid int32 // Process ID of login process.
18 | Line [32]byte // Devicename.
19 | ID [4]byte // Inittab ID.
20 | User [32]byte // Username.
21 | Host [256]byte // Hostname for remote login.
22 | Exit exitStatus // Exit status of a process marked
23 | Session int32 // Session ID, used for windowing.
24 | Tv timeval // Time entry was made.
25 | AddrV6 [16]byte // Internet address of remote host.
26 | Unused [20]byte // Reserved for future use. // original is 20
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/host_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 |
3 | package host
4 |
5 | import (
6 | "os"
7 | "time"
8 |
9 | "github.com/StackExchange/wmi"
10 |
11 | common "github.com/shirou/gopsutil/common"
12 | process "github.com/shirou/gopsutil/process"
13 | )
14 |
15 | var (
16 | procGetSystemTimeAsFileTime = common.Modkernel32.NewProc("GetSystemTimeAsFileTime")
17 | )
18 |
19 | type Win32_OperatingSystem struct {
20 | LastBootUpTime time.Time
21 | }
22 |
23 | func HostInfo() (*HostInfoStat, error) {
24 | ret := &HostInfoStat{}
25 | hostname, err := os.Hostname()
26 | if err != nil {
27 | return ret, err
28 | }
29 |
30 | ret.Hostname = hostname
31 | uptime, err := BootTime()
32 | if err == nil {
33 | ret.Uptime = uptime
34 | }
35 |
36 | procs, err := process.Pids()
37 | if err != nil {
38 | return ret, err
39 | }
40 |
41 | ret.Procs = uint64(len(procs))
42 |
43 | return ret, nil
44 | }
45 |
46 | func BootTime() (uint64, error) {
47 | now := time.Now()
48 |
49 | var dst []Win32_OperatingSystem
50 | q := wmi.CreateQuery(&dst, "")
51 | err := wmi.Query(q, &dst)
52 | if err != nil {
53 | return 0, err
54 | }
55 | t := dst[0].LastBootUpTime.Local()
56 | return uint64(now.Sub(t).Seconds()), nil
57 | }
58 |
59 | func Users() ([]UserStat, error) {
60 |
61 | var ret []UserStat
62 |
63 | return ret, nil
64 | }
65 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/types_darwin.go:
--------------------------------------------------------------------------------
1 | // +build ignore
2 | // plus hand editing about timeval
3 |
4 | /*
5 | Input to cgo -godefs.
6 | */
7 |
8 | package host
9 |
10 | /*
11 | #include
12 | #include
13 | */
14 | import "C"
15 |
16 | type Utmpx C.struct_utmpx
17 | type Timeval C.struct_timeval
18 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/types_freebsd.go:
--------------------------------------------------------------------------------
1 | // +build ignore
2 |
3 | /*
4 | Input to cgo -godefs.
5 | */
6 |
7 | package host
8 |
9 | /*
10 | #define KERNEL
11 | #include
12 | #include
13 | #include
14 |
15 | enum {
16 | sizeofPtr = sizeof(void*),
17 | };
18 |
19 | */
20 | import "C"
21 |
22 | // Machine characteristics; for internal use.
23 |
24 | const (
25 | sizeofPtr = C.sizeofPtr
26 | sizeofShort = C.sizeof_short
27 | sizeofInt = C.sizeof_int
28 | sizeofLong = C.sizeof_long
29 | sizeofLongLong = C.sizeof_longlong
30 | )
31 |
32 | // Basic types
33 |
34 | type (
35 | _C_short C.short
36 | _C_int C.int
37 | _C_long C.long
38 | _C_long_long C.longlong
39 | )
40 |
41 | type Utmp C.struct_utmp
42 | type Utmpx C.struct_utmpx
43 | type Timeval C.struct_timeval
44 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/host/types_linux.go:
--------------------------------------------------------------------------------
1 | // +build ignore
2 |
3 | /*
4 | Input to cgo -godefs.
5 | */
6 |
7 | package host
8 |
9 | /*
10 | #define KERNEL
11 | #include
12 | #include
13 |
14 | enum {
15 | sizeofPtr = sizeof(void*),
16 | };
17 |
18 | */
19 | import "C"
20 |
21 | // Machine characteristics; for internal use.
22 |
23 | const (
24 | sizeofPtr = C.sizeofPtr
25 | sizeofShort = C.sizeof_short
26 | sizeofInt = C.sizeof_int
27 | sizeofLong = C.sizeof_long
28 | sizeofLongLong = C.sizeof_longlong
29 | )
30 |
31 | // Basic types
32 |
33 | type (
34 | _C_short C.short
35 | _C_int C.int
36 | _C_long C.long
37 | _C_long_long C.longlong
38 | )
39 |
40 | type utmp C.struct_utmp
41 | type exit_status C.struct_exit_status
42 | type UtTv struct {
43 | TvSec int32
44 | TvUsec int32
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/load/load.go:
--------------------------------------------------------------------------------
1 | package load
2 |
3 | import (
4 | "encoding/json"
5 | )
6 |
7 | type LoadAvgStat struct {
8 | Load1 float64 `json:"load1"`
9 | Load5 float64 `json:"load5"`
10 | Load15 float64 `json:"load15"`
11 | }
12 |
13 | func (l LoadAvgStat) String() string {
14 | s, _ := json.Marshal(l)
15 | return string(s)
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/load/load_darwin.go:
--------------------------------------------------------------------------------
1 | // +build darwin
2 |
3 | package load
4 |
5 | import (
6 | "strconv"
7 |
8 | common "github.com/shirou/gopsutil/common"
9 | )
10 |
11 | func LoadAvg() (*LoadAvgStat, error) {
12 | values, err := common.DoSysctrl("vm.loadavg")
13 | if err != nil {
14 | return nil, err
15 | }
16 |
17 | load1, err := strconv.ParseFloat(values[0], 64)
18 | if err != nil {
19 | return nil, err
20 | }
21 | load5, err := strconv.ParseFloat(values[1], 64)
22 | if err != nil {
23 | return nil, err
24 | }
25 | load15, err := strconv.ParseFloat(values[2], 64)
26 | if err != nil {
27 | return nil, err
28 | }
29 |
30 | ret := &LoadAvgStat{
31 | Load1: float64(load1),
32 | Load5: float64(load5),
33 | Load15: float64(load15),
34 | }
35 |
36 | return ret, nil
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/load/load_freebsd.go:
--------------------------------------------------------------------------------
1 | // +build freebsd
2 |
3 | package load
4 |
5 | import (
6 | "strconv"
7 |
8 | common "github.com/shirou/gopsutil/common"
9 | )
10 |
11 | func LoadAvg() (*LoadAvgStat, error) {
12 | values, err := common.DoSysctrl("vm.loadavg")
13 | if err != nil {
14 | return nil, err
15 | }
16 |
17 | load1, err := strconv.ParseFloat(values[0], 64)
18 | if err != nil {
19 | return nil, err
20 | }
21 | load5, err := strconv.ParseFloat(values[1], 64)
22 | if err != nil {
23 | return nil, err
24 | }
25 | load15, err := strconv.ParseFloat(values[2], 64)
26 | if err != nil {
27 | return nil, err
28 | }
29 |
30 | ret := &LoadAvgStat{
31 | Load1: float64(load1),
32 | Load5: float64(load5),
33 | Load15: float64(load15),
34 | }
35 |
36 | return ret, nil
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/load/load_linux.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 |
3 | package load
4 |
5 | import (
6 | "io/ioutil"
7 | "strconv"
8 | "strings"
9 | )
10 |
11 | func LoadAvg() (*LoadAvgStat, error) {
12 | filename := "/proc/loadavg"
13 | line, err := ioutil.ReadFile(filename)
14 | if err != nil {
15 | return nil, err
16 | }
17 |
18 | values := strings.Fields(string(line))
19 |
20 | load1, err := strconv.ParseFloat(values[0], 64)
21 | if err != nil {
22 | return nil, err
23 | }
24 | load5, err := strconv.ParseFloat(values[1], 64)
25 | if err != nil {
26 | return nil, err
27 | }
28 | load15, err := strconv.ParseFloat(values[2], 64)
29 | if err != nil {
30 | return nil, err
31 | }
32 |
33 | ret := &LoadAvgStat{
34 | Load1: load1,
35 | Load5: load5,
36 | Load15: load15,
37 | }
38 |
39 | return ret, nil
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/load/load_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 |
3 | package load
4 |
5 | import (
6 | common "github.com/shirou/gopsutil/common"
7 | )
8 |
9 | func LoadAvg() (*LoadAvgStat, error) {
10 | ret := LoadAvgStat{}
11 |
12 | return &ret, common.NotImplementedError
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/mem/mem.go:
--------------------------------------------------------------------------------
1 | package mem
2 |
3 | import (
4 | "encoding/json"
5 | )
6 |
7 | type VirtualMemoryStat struct {
8 | Total uint64 `json:"total"`
9 | Available uint64 `json:"available"`
10 | Used uint64 `json:"used"`
11 | UsedPercent float64 `json:"used_percent"`
12 | Free uint64 `json:"free"`
13 | Active uint64 `json:"active"`
14 | Inactive uint64 `json:"inactive"`
15 | Buffers uint64 `json:"buffers"`
16 | Cached uint64 `json:"cached"`
17 | Wired uint64 `json:"wired"`
18 | Shared uint64 `json:"shared"`
19 | }
20 |
21 | type SwapMemoryStat struct {
22 | Total uint64 `json:"total"`
23 | Used uint64 `json:"used"`
24 | Free uint64 `json:"free"`
25 | UsedPercent float64 `json:"used_percent"`
26 | Sin uint64 `json:"sin"`
27 | Sout uint64 `json:"sout"`
28 | }
29 |
30 | func (m VirtualMemoryStat) String() string {
31 | s, _ := json.Marshal(m)
32 | return string(s)
33 | }
34 |
35 | func (m SwapMemoryStat) String() string {
36 | s, _ := json.Marshal(m)
37 | return string(s)
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/mem/mem_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 |
3 | package mem
4 |
5 | import (
6 | "syscall"
7 | "unsafe"
8 |
9 | common "github.com/shirou/gopsutil/common"
10 | )
11 |
12 | var (
13 | procGlobalMemoryStatusEx = common.Modkernel32.NewProc("GlobalMemoryStatusEx")
14 | )
15 |
16 | type MEMORYSTATUSEX struct {
17 | cbSize uint32
18 | dwMemoryLoad uint32
19 | ullTotalPhys uint64 // in bytes
20 | ullAvailPhys uint64
21 | ullTotalPageFile uint64
22 | ullAvailPageFile uint64
23 | ullTotalVirtual uint64
24 | ullAvailVirtual uint64
25 | ullAvailExtendedVirtual uint64
26 | }
27 |
28 | func VirtualMemory() (*VirtualMemoryStat, error) {
29 | var memInfo MEMORYSTATUSEX
30 | memInfo.cbSize = uint32(unsafe.Sizeof(memInfo))
31 | mem, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo)))
32 | if mem == 0 {
33 | return nil, syscall.GetLastError()
34 | }
35 |
36 | ret := &VirtualMemoryStat{
37 | Total: memInfo.ullTotalPhys,
38 | Available: memInfo.ullAvailPhys,
39 | UsedPercent: float64(memInfo.dwMemoryLoad),
40 | }
41 |
42 | ret.Used = ret.Total - ret.Available
43 | return ret, nil
44 | }
45 |
46 | func SwapMemory() (*SwapMemoryStat, error) {
47 | ret := &SwapMemoryStat{}
48 |
49 | return ret, nil
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/net/net_darwin.go:
--------------------------------------------------------------------------------
1 | // +build darwin
2 |
3 | package net
4 |
5 | import (
6 | "os/exec"
7 | "strconv"
8 | "strings"
9 |
10 | "github.com/shirou/gopsutil/common"
11 | )
12 |
13 | func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
14 | out, err := exec.Command("/usr/sbin/netstat", "-ibdn").Output()
15 | if err != nil {
16 | return nil, err
17 | }
18 |
19 | lines := strings.Split(string(out), "\n")
20 | ret := make([]NetIOCountersStat, 0, len(lines)-1)
21 | exists := make([]string, 0, len(ret))
22 |
23 | for _, line := range lines {
24 | values := strings.Fields(line)
25 | if len(values) < 1 || values[0] == "Name" {
26 | // skip first line
27 | continue
28 | }
29 | if common.StringsHas(exists, values[0]) {
30 | // skip if already get
31 | continue
32 | }
33 | exists = append(exists, values[0])
34 |
35 | base := 1
36 | // sometimes Address is ommitted
37 | if len(values) < 11 {
38 | base = 0
39 | }
40 |
41 | parsed := make([]uint64, 0, 3)
42 | vv := []string{
43 | values[base+3], // PacketsRecv
44 | values[base+4], // Errin
45 | values[base+5], // Dropin
46 | }
47 | for _, target := range vv {
48 | if target == "-" {
49 | parsed = append(parsed, 0)
50 | continue
51 | }
52 |
53 | t, err := strconv.ParseUint(target, 10, 64)
54 | if err != nil {
55 | return nil, err
56 | }
57 | parsed = append(parsed, t)
58 | }
59 |
60 | n := NetIOCountersStat{
61 | Name: values[0],
62 | PacketsRecv: parsed[0],
63 | Errin: parsed[1],
64 | Dropin: parsed[2],
65 | }
66 | ret = append(ret, n)
67 | }
68 |
69 | if pernic == false {
70 | return getNetIOCountersAll(ret)
71 | }
72 |
73 | return ret, nil
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/process/process_linux_386.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build 386
3 |
4 | package process
5 |
6 | const (
7 | ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
8 | PageSize = 4096 // C.sysconf(C._SC_PAGE_SIZE)
9 | )
10 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/process/process_linux_amd64.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build amd64
3 |
4 | package process
5 |
6 | const (
7 | ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
8 | PageSize = 4096 // C.sysconf(C._SC_PAGE_SIZE)
9 | )
10 |
--------------------------------------------------------------------------------
/vendor/github.com/shirou/gopsutil/process/process_linux_arm.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build arm
3 |
4 | package process
5 |
6 | const (
7 | ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
8 | PageSize = 4096 // C.sysconf(C._SC_PAGE_SIZE)
9 | )
10 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/tracerr/README.md:
--------------------------------------------------------------------------------
1 | tracerr
2 | =======
3 |
4 | [](https://travis-ci.org/st3v/tracerr)
5 |
6 | [](http://godoc.org/github.com/st3v/tracerr)
7 |
8 | Traceable errors in Go.
9 |
10 | #### Example:
11 |
12 | ```go
13 | package main
14 |
15 | import (
16 | "errors"
17 | "fmt"
18 |
19 | "github.com/st3v/tracerr"
20 | )
21 |
22 | func main() {
23 | foo := &foo{}
24 |
25 | err := nested(4, func() error {
26 | return foo.bar()
27 | })
28 |
29 | if err != nil {
30 | fmt.Println(err.Error())
31 | }
32 | }
33 |
34 | func nested(depth int, fn func() error) error {
35 | if depth <= 1 {
36 | return fn()
37 | }
38 | return nested(depth-1, fn)
39 | }
40 |
41 | type foo struct{}
42 |
43 | func (f *foo) bar() error {
44 | return tracerr.Wrap(errors.New("FooBarError"))
45 | }
46 | ```
47 |
48 | #### Output:
49 |
50 | ```
51 | $ ./example
52 | FooBarError
53 | at (*foo).bar (main/tracerr_example.go:32)
54 | at func·001 (main/tracerr_example.go:14)
55 | at nested (main/tracerr_example.go:24)
56 | at nested (main/tracerr_example.go:26)
57 | at nested (main/tracerr_example.go:26)
58 | at nested (main/tracerr_example.go:26)
59 | at main (main/tracerr_example.go:15)
60 | at main (runtime/proc.c:255)
61 | at goexit (runtime/proc.c:1445)
62 | ```
63 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/http/authenticator.go:
--------------------------------------------------------------------------------
1 | package http
2 |
3 | import "net/http"
4 |
5 | // Authenticator is used to authenticate HTTP requests to API endpoints.
6 | type Authenticator interface {
7 | // Authenticate a given HTTP request.
8 | Authenticate(request *http.Request) error
9 | }
10 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/http/client.go:
--------------------------------------------------------------------------------
1 | package http
2 |
3 | import (
4 | "io"
5 | "net/http"
6 |
7 | "github.com/st3v/tracerr"
8 | )
9 |
10 | // Client sends authenticated HTTP requests to API endpoints
11 | type Client interface {
12 | SendRequest(method, uri string, body io.Reader, contentType string) (*http.Response, error)
13 | }
14 |
15 | type client struct {
16 | client *http.Client
17 | authenticator Authenticator
18 | }
19 |
20 | // NewClient instantiates a Client and initializes it with the passed Authenticator.
21 | func NewClient(authenticator Authenticator) Client {
22 | return &client{
23 | client: &http.Client{},
24 | authenticator: authenticator,
25 | }
26 | }
27 |
28 | func (h *client) SendRequest(method, uri string, body io.Reader, contentType string) (*http.Response, error) {
29 | request, err := http.NewRequest(method, uri, body)
30 | if err != nil {
31 | return nil, tracerr.Wrap(err)
32 | }
33 |
34 | request.Header.Add("Content-Type", contentType)
35 |
36 | err = h.authenticator.Authenticate(request)
37 | if err != nil {
38 | return nil, tracerr.Wrap(err)
39 | }
40 |
41 | response, err := h.client.Do(request)
42 | if err != nil {
43 | return nil, tracerr.Wrap(err)
44 | }
45 |
46 | return response, nil
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/http/mocks.go:
--------------------------------------------------------------------------------
1 | package http
2 |
3 | import "net/http"
4 |
5 | // NewAuthenticatedClient returns an HTTP client with a mocked-out authenticator.
6 | func NewAuthenticatedClient() Client {
7 | authenticator := newMockAuthenticator(func(request *http.Request) error {
8 | request.Header.Set("Authorization", "fake-authorization")
9 | return nil
10 | })
11 |
12 | return NewClient(authenticator)
13 | }
14 |
15 | func newMockAuthenticator(authenticate func(request *http.Request) error) *mockAuthenticator {
16 | return &mockAuthenticator{
17 | authenticate: authenticate,
18 | }
19 | }
20 |
21 | type mockAuthenticator struct {
22 | authenticate func(request *http.Request) error
23 | }
24 |
25 | func (a *mockAuthenticator) Authenticate(request *http.Request) error {
26 | if a.authenticate != nil {
27 | return a.authenticate(request)
28 | }
29 | return nil
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/api.go:
--------------------------------------------------------------------------------
1 | package microsoft
2 |
3 | import (
4 | "github.com/st3v/translator"
5 | msauth "github.com/st3v/translator/microsoft/auth"
6 | )
7 |
8 | type api struct {
9 | languageCatalog LanguageCatalog
10 | translationProvider TranslationProvider
11 | }
12 |
13 | // NewTranslator returns a struct that implements the Translator
14 | // interface by exposing a Translate and a Languages function that
15 | // are backed by Microsoft's translation API.
16 | // The function takes the clientID and clientSecret for an existing
17 | // app registered in Microsoft's Azure DataMarket.
18 | func NewTranslator(clientID, clientSecret string) translator.Translator {
19 | scope := "http://api.microsofttranslator.com"
20 | router := newRouter()
21 | authenticator := msauth.NewAuthenticator(clientID, clientSecret, scope, router.AuthURL())
22 | return &api{
23 | languageCatalog: newLanguageCatalog(newLanguageProvider(authenticator, router)),
24 | translationProvider: newTranslationProvider(authenticator, router),
25 | }
26 | }
27 |
28 | func (a *api) Translate(text, from, to string) (string, error) {
29 | return a.translationProvider.Translate(text, from, to)
30 | }
31 |
32 | func (a *api) Languages() ([]translator.Language, error) {
33 | return a.languageCatalog.Languages()
34 | }
35 |
36 | func (a *api) Detect(text string) (string, error) {
37 | return a.translationProvider.Detect(text)
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/auth/access_token.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import "time"
4 |
5 | type accessToken struct {
6 | Token string `json:"access_token"`
7 | Type string `json:"token_type"`
8 | Scope string `json:"scope"`
9 | ExpiresIn string `json:"expires_in"`
10 | ExpiresAt time.Time
11 | }
12 |
13 | func newAccessToken(scope string) *accessToken {
14 | return &accessToken{
15 | Scope: scope,
16 | }
17 | }
18 |
19 | func (t *accessToken) expired() bool {
20 | // be conservative and expire 10 seconds early
21 | return t.ExpiresAt.Before(time.Now().Add(time.Second * 10))
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/auth/authenticator.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import (
4 | "net/http"
5 |
6 | "github.com/st3v/tracerr"
7 | _http "github.com/st3v/translator/http"
8 | )
9 |
10 | type authenticator struct {
11 | accessTokenProvider AccessTokenProvider
12 | accessTokenChan chan *accessToken
13 | }
14 |
15 | // NewAuthenticator returns an autheticator for Microsoft API endpoints.
16 | func NewAuthenticator(clientID, clientSecret, scope, authURL string) _http.Authenticator {
17 | // make buffered accessToken channel and pre-fill it with an expired token
18 | tokenChan := make(chan *accessToken, 1)
19 | tokenChan <- newAccessToken(scope)
20 |
21 | // return new authenticator that uses the above accessToken channel
22 | return &authenticator{
23 | accessTokenProvider: newAccessTokenProvider(clientID, clientSecret, authURL),
24 | accessTokenChan: tokenChan,
25 | }
26 | }
27 |
28 | func (a *authenticator) Authenticate(request *http.Request) error {
29 | authToken, err := a.authToken()
30 | if err != nil {
31 | return tracerr.Wrap(err)
32 | }
33 |
34 | request.Header.Add("Authorization", authToken)
35 | return nil
36 | }
37 |
38 | func (a *authenticator) authToken() (string, error) {
39 | // grab the token
40 | accessToken := <-a.accessTokenChan
41 |
42 | // make sure it's valid, otherwise request a new one
43 | if accessToken == nil || accessToken.expired() {
44 | err := a.accessTokenProvider.RefreshToken(accessToken)
45 | if err != nil || accessToken == nil {
46 | a.accessTokenChan <- nil
47 | return "", tracerr.Wrap(err)
48 | }
49 | }
50 |
51 | // put the token back on the channel
52 | a.accessTokenChan <- accessToken
53 |
54 | // return authToken
55 | return "Bearer " + accessToken.Token, nil
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/language_catalog.go:
--------------------------------------------------------------------------------
1 | package microsoft
2 |
3 | import (
4 | "github.com/st3v/tracerr"
5 | "github.com/st3v/translator"
6 | )
7 |
8 | // The LanguageCatalog provides a slice of languages representing all
9 | // languages supported by Microsoft's Translation API.
10 | type LanguageCatalog interface {
11 | Languages() ([]translator.Language, error)
12 | }
13 |
14 | type languageCatalog struct {
15 | provider LanguageProvider
16 | languages []translator.Language
17 | }
18 |
19 | func newLanguageCatalog(provider LanguageProvider) LanguageCatalog {
20 | return &languageCatalog{
21 | provider: provider,
22 | }
23 | }
24 |
25 | func (c *languageCatalog) Languages() ([]translator.Language, error) {
26 | if c.languages == nil {
27 | codes, err := c.provider.Codes()
28 | if err != nil {
29 | return nil, tracerr.Wrap(err)
30 | }
31 |
32 | names, err := c.provider.Names(codes)
33 | if err != nil {
34 | return nil, tracerr.Wrap(err)
35 | }
36 |
37 | for i := range codes {
38 | c.languages = append(
39 | c.languages,
40 | translator.Language{
41 | Code: codes[i],
42 | Name: names[i],
43 | })
44 | }
45 | }
46 | return c.languages, nil
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/router.go:
--------------------------------------------------------------------------------
1 | package microsoft
2 |
3 | const (
4 | authURL = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13"
5 | serviceURL = "http://api.microsofttranslator.com/v2/Http.svc/"
6 | translationURL = serviceURL + "Translate"
7 | detectURL = serviceURL + "Detect"
8 | languageNamesURL = serviceURL + "GetLanguageNames"
9 | languageCodesURL = serviceURL + "GetLanguagesForTranslate"
10 | )
11 |
12 | // The Router provides necessary URLs to communicate with
13 | // Microsoft's API.
14 | type Router interface {
15 | AuthURL() string
16 | TranslationURL() string
17 | DetectURL() string
18 | LanguageNamesURL() string
19 | LanguageCodesURL() string
20 | }
21 |
22 | type router struct{}
23 |
24 | func newRouter() Router {
25 | return &router{}
26 | }
27 |
28 | func (r *router) AuthURL() string {
29 | return authURL
30 | }
31 |
32 | func (r *router) TranslationURL() string {
33 | return translationURL
34 | }
35 |
36 | func (r *router) DetectURL() string {
37 | return detectURL
38 | }
39 |
40 | func (r *router) LanguageNamesURL() string {
41 | return languageNamesURL
42 | }
43 |
44 | func (r *router) LanguageCodesURL() string {
45 | return languageCodesURL
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/microsoft/xml.go:
--------------------------------------------------------------------------------
1 | package microsoft
2 |
3 | import "encoding/xml"
4 |
5 | type xmlString struct {
6 | XMLName xml.Name `xml:"string"`
7 | Namespace string `xml:"xmlns,attr"`
8 | Value string `xml:",innerxml"`
9 | }
10 |
11 | func newXMLString(value string) *xmlString {
12 | return &xmlString{
13 | Namespace: "http://schemas.microsoft.com/2003/10/Serialization/",
14 | Value: value,
15 | }
16 | }
17 |
18 | type xmlArrayOfStrings struct {
19 | XMLName xml.Name `xml:"ArrayOfstring"`
20 | Namespace string `xml:"xmlns,attr"`
21 | InstanceNamespace string `xml:"xmlns:i,attr"`
22 | Strings []string `xml:"string"`
23 | }
24 |
25 | func newXMLArrayOfStrings(values []string) *xmlArrayOfStrings {
26 | return &xmlArrayOfStrings{
27 | Namespace: "http://schemas.microsoft.com/2003/10/Serialization/Arrays",
28 | InstanceNamespace: "http://www.w3.org/2001/XMLSchema-instance",
29 | Strings: values,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/st3v/translator/translator.go:
--------------------------------------------------------------------------------
1 | package translator
2 |
3 | // The Language struct represents a given language by its
4 | // name and code.
5 | type Language struct {
6 | Code string
7 | Name string
8 | }
9 |
10 | // The Translator interface represents a translation service.
11 | type Translator interface {
12 | // Languages returns a slice of language structs that are supported
13 | // by the given translator.
14 | Languages() ([]Language, error)
15 |
16 | // Translate takes a string in a given language and returns its translation
17 | // to another language. Source and destination languages are specified by their
18 | // corresponding language codes.
19 | Translate(text, from, to string) (string, error)
20 |
21 | // Detect identifies the language of the given text and returns the
22 | // corresponding language code.
23 | Detect(text string) (string, error)
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/technoweenie/multipartstreamer/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013-* rick olson
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 |
--------------------------------------------------------------------------------
/vendor/github.com/technoweenie/multipartstreamer/README.md:
--------------------------------------------------------------------------------
1 | # multipartstreamer
2 |
3 | Package multipartstreamer helps you encode large files in MIME multipart format
4 | without reading the entire content into memory. It uses io.MultiReader to
5 | combine an inner multipart.Reader with a file handle.
6 |
7 | ```go
8 | package main
9 |
10 | import (
11 | "github.com/technoweenie/multipartstreamer.go"
12 | "net/http"
13 | )
14 |
15 | func main() {
16 | ms := multipartstreamer.New()
17 |
18 | ms.WriteFields(map[string]string{
19 | "key": "some-key",
20 | "AWSAccessKeyId": "ABCDEF",
21 | "acl": "some-acl",
22 | })
23 |
24 | // Add any io.Reader to the multipart.Reader.
25 | ms.WriteReader("file", "filename", some_ioReader, size)
26 |
27 | // Shortcut for adding local file.
28 | ms.WriteFile("file", "path/to/file")
29 |
30 | req, _ := http.NewRequest("POST", "someurl", nil)
31 | ms.SetupRequest(req)
32 |
33 | res, _ := http.DefaultClient.Do(req)
34 | }
35 | ```
36 |
37 | One limitation: You can only write a single file.
38 |
39 | ## TODO
40 |
41 | * Multiple files?
42 |
43 | ## Credits
44 |
45 | Heavily inspired by James
46 |
47 | https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/Zjg5l4nKcQ0
48 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 The Go Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the Go project.
5 |
6 | Google hereby grants to You a perpetual, worldwide, non-exclusive,
7 | no-charge, royalty-free, irrevocable (except as stated in this section)
8 | patent license to make, have made, use, offer to sell, sell, import,
9 | transfer and otherwise run, modify and propagate the contents of this
10 | implementation of Go, where such license applies only to those patent
11 | claims, both currently owned or controlled by Google and acquired in
12 | the future, licensable by Google that are necessarily infringed by this
13 | implementation of Go. This grant does not include claims that would be
14 | infringed only as a consequence of further modification of this
15 | implementation. If you or your agent or exclusive licensee institute or
16 | order or agree to the institution of patent litigation against any
17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging
18 | that this implementation of Go or any code incorporated within this
19 | implementation of Go constitutes direct or contributory patent
20 | infringement, or inducement of patent infringement, then any patent
21 | rights granted to you under this License for this implementation of Go
22 | shall terminate as of the date such litigation is filed.
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/bcrypt/base64.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 bcrypt
6 |
7 | import "encoding/base64"
8 |
9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
10 |
11 | var bcEncoding = base64.NewEncoding(alphabet)
12 |
13 | func base64Encode(src []byte) []byte {
14 | n := bcEncoding.EncodedLen(len(src))
15 | dst := make([]byte, n)
16 | bcEncoding.Encode(dst, src)
17 | for dst[n-1] == '=' {
18 | n--
19 | }
20 | return dst[:n]
21 | }
22 |
23 | func base64Decode(src []byte) ([]byte, error) {
24 | numOfEquals := 4 - (len(src) % 4)
25 | for i := 0; i < numOfEquals; i++ {
26 | src = append(src, '=')
27 | }
28 |
29 | dst := make([]byte, bcEncoding.DecodedLen(len(src)))
30 | n, err := bcEncoding.Decode(dst, src)
31 | if err != nil {
32 | return nil, err
33 | }
34 | return dst[:n], nil
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 The Go Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the Go project.
5 |
6 | Google hereby grants to You a perpetual, worldwide, non-exclusive,
7 | no-charge, royalty-free, irrevocable (except as stated in this section)
8 | patent license to make, have made, use, offer to sell, sell, import,
9 | transfer and otherwise run, modify and propagate the contents of this
10 | implementation of Go, where such license applies only to those patent
11 | claims, both currently owned or controlled by Google and acquired in
12 | the future, licensable by Google that are necessarily infringed by this
13 | implementation of Go. This grant does not include claims that would be
14 | infringed only as a consequence of further modification of this
15 | implementation. If you or your agent or exclusive licensee institute or
16 | order or agree to the institution of patent litigation against any
17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging
18 | that this implementation of Go or any code incorporated within this
19 | implementation of Go constitutes direct or contributory patent
20 | infringement, or inducement of patent infringement, then any patent
21 | rights granted to you under this License for this implementation of Go
22 | shall terminate as of the date such litigation is filed.
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/proxy/direct.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package proxy
6 |
7 | import (
8 | "net"
9 | )
10 |
11 | type direct struct{}
12 |
13 | // Direct is a direct proxy: one that makes network connections directly.
14 | var Direct = direct{}
15 |
16 | func (direct) Dial(network, addr string) (net.Conn, error) {
17 | return net.Dial(network, addr)
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 The Go Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the Go project.
5 |
6 | Google hereby grants to You a perpetual, worldwide, non-exclusive,
7 | no-charge, royalty-free, irrevocable (except as stated in this section)
8 | patent license to make, have made, use, offer to sell, sell, import,
9 | transfer and otherwise run, modify and propagate the contents of this
10 | implementation of Go, where such license applies only to those patent
11 | claims, both currently owned or controlled by Google and acquired in
12 | the future, licensable by Google that are necessarily infringed by this
13 | implementation of Go. This grant does not include claims that would be
14 | infringed only as a consequence of further modification of this
15 | implementation. If you or your agent or exclusive licensee institute or
16 | order or agree to the institution of patent litigation against any
17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging
18 | that this implementation of Go or any code incorporated within this
19 | implementation of Go constitutes direct or contributory patent
20 | infringement, or inducement of patent infringement, then any patent
21 | rights granted to you under this License for this implementation of Go
22 | shall terminate as of the date such litigation is filed.
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm.s:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | TEXT ·use(SB),NOSPLIT,$0
10 | RET
11 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, Darwin
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, Darwin
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-32
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-44
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-56
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-32
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-44
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, DragonFly
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-64
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s:
--------------------------------------------------------------------------------
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 !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for ARM, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | B syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | B syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | B syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for 386, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
23 | JMP syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
26 | JMP syscall·RawSyscall6(SB)
27 |
28 | TEXT ·socketcall(SB),NOSPLIT,$0-36
29 | JMP syscall·socketcall(SB)
30 |
31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
32 | JMP syscall·rawsocketcall(SB)
33 |
34 | TEXT ·seek(SB),NOSPLIT,$0-28
35 | JMP syscall·seek(SB)
36 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for AMD64, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
23 | JMP syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
26 | JMP syscall·RawSyscall6(SB)
27 |
28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16
29 | JMP syscall·gettimeofday(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_arm.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for arm, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
23 | B syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
26 | B syscall·RawSyscall6(SB)
27 |
28 | TEXT ·seek(SB),NOSPLIT,$0-32
29 | B syscall·seek(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_arm.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 !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for ARM, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | B syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | B syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | B syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_openbsd_386.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, OpenBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s:
--------------------------------------------------------------------------------
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 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, OpenBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | //
8 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.goc
9 | //
10 |
11 | TEXT ·sysvicall6(SB), 7, $0-64
12 | JMP syscall·sysvicall6(SB)
13 |
14 | TEXT ·rawSysvicall6(SB), 7, $0-64
15 | JMP syscall·rawSysvicall6(SB)
16 |
17 | TEXT ·dlopen(SB), 7, $0-16
18 | JMP syscall·dlopen(SB)
19 |
20 | TEXT ·dlclose(SB), 7, $0-8
21 | JMP syscall·dlclose(SB)
22 |
23 | TEXT ·dlsym(SB), 7, $0-16
24 | JMP syscall·dlsym(SB)
25 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/constants.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 darwin dragonfly freebsd linux netbsd openbsd solaris
6 |
7 | package unix
8 |
9 | const (
10 | R_OK = 0x4
11 | W_OK = 0x2
12 | X_OK = 0x1
13 | )
14 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/env_unix.go:
--------------------------------------------------------------------------------
1 | // Copyright 2010 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 |
7 | // Unix environment variables.
8 |
9 | package unix
10 |
11 | import "syscall"
12 |
13 | func Getenv(key string) (value string, found bool) {
14 | return syscall.Getenv(key)
15 | }
16 |
17 | func Setenv(key, value string) error {
18 | return syscall.Setenv(key, value)
19 | }
20 |
21 | func Clearenv() {
22 | syscall.Clearenv()
23 | }
24 |
25 | func Environ() []string {
26 | return syscall.Environ()
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/env_unset.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.4
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | func Unsetenv(key string) error {
12 | // This was added in Go 1.4.
13 | return syscall.Unsetenv(key)
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/flock.go:
--------------------------------------------------------------------------------
1 | // +build linux darwin freebsd openbsd netbsd dragonfly
2 |
3 | // Copyright 2014 The Go Authors. All rights reserved.
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file.
6 |
7 | // +build darwin dragonfly freebsd linux netbsd openbsd
8 |
9 | package unix
10 |
11 | import "unsafe"
12 |
13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64.
15 | var fcntl64Syscall uintptr = SYS_FCNTL
16 |
17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
20 | if errno == 0 {
21 | return nil
22 | }
23 | return errno
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/flock_linux_32bit.go:
--------------------------------------------------------------------------------
1 | // +build linux,386 linux,arm
2 |
3 | // Copyright 2014 The Go Authors. All rights reserved.
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file.
6 |
7 | package unix
8 |
9 | func init() {
10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's
11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
12 | fcntl64Syscall = SYS_FCNTL64
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo.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 gccgo
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | // We can't use the gc-syntax .s files for gccgo. On the plus side
12 | // much of the functionality can be written directly in Go.
13 |
14 | //extern gccgoRealSyscall
15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6 uintptr) (r, errno uintptr)
16 |
17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
18 | syscall.Entersyscall()
19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0)
20 | syscall.Exitsyscall()
21 | return r, 0, syscall.Errno(errno)
22 | }
23 |
24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
25 | syscall.Entersyscall()
26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6)
27 | syscall.Exitsyscall()
28 | return r, 0, syscall.Errno(errno)
29 | }
30 |
31 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
32 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0)
33 | return r, 0, syscall.Errno(errno)
34 | }
35 |
36 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6)
38 | return r, 0, syscall.Errno(errno)
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo_c.c:
--------------------------------------------------------------------------------
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 gccgo
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #define _STRINGIFY2_(x) #x
12 | #define _STRINGIFY_(x) _STRINGIFY2_(x)
13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
14 |
15 | // Call syscall from C code because the gccgo support for calling from
16 | // Go to C does not support varargs functions.
17 |
18 | struct ret {
19 | uintptr_t r;
20 | uintptr_t err;
21 | };
22 |
23 | struct ret
24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6)
25 | {
26 | struct ret r;
27 |
28 | errno = 0;
29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6);
30 | r.err = errno;
31 | return r;
32 | }
33 |
34 | // Define the use function in C so that it is not inlined.
35 |
36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
37 |
38 | void
39 | use(void *p __attribute__ ((unused)))
40 | {
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.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 gccgo,linux,amd64
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | //extern gettimeofday
12 | func realGettimeofday(*Timeval, *byte) int32
13 |
14 | func gettimeofday(tv *Timeval) (err syscall.Errno) {
15 | r := realGettimeofday(tv, nil)
16 | if r < 0 {
17 | return syscall.GetErrno()
18 | }
19 | return 0
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | # Copyright 2009 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 | # Generate system call table for Darwin from sys/syscall.h
7 |
8 | use strict;
9 |
10 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
11 |
12 | print <){
22 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
23 | my $name = $1;
24 | my $num = $2;
25 | $name =~ y/a-z/A-Z/;
26 | print " SYS_$name = $num;"
27 | }
28 | }
29 |
30 | print <){
23 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
24 | my $num = $1;
25 | my $proto = $2;
26 | my $name = "SYS_$3";
27 | $name =~ y/a-z/A-Z/;
28 |
29 | # There are multiple entries for enosys and nosys, so comment them out.
30 | if($name =~ /^SYS_E?NOSYS$/){
31 | $name = "// $name";
32 | }
33 | if($name eq 'SYS_SYS_EXIT'){
34 | $name = 'SYS_EXIT';
35 | }
36 |
37 | print " $name = $num; // $proto\n";
38 | }
39 | }
40 |
41 | print <){
23 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
24 | my $num = $1;
25 | my $proto = $2;
26 | my $name = "SYS_$3";
27 | $name =~ y/a-z/A-Z/;
28 |
29 | # There are multiple entries for enosys and nosys, so comment them out.
30 | if($name =~ /^SYS_E?NOSYS$/){
31 | $name = "// $name";
32 | }
33 | if($name eq 'SYS_SYS_EXIT'){
34 | $name = 'SYS_EXIT';
35 | }
36 | if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){
37 | next
38 | }
39 |
40 | print " $name = $num; // $proto\n";
41 |
42 | # We keep Capsicum syscall numbers for FreeBSD
43 | # 9-STABLE here because we are not sure whether they
44 | # are mature and stable.
45 | if($num == 513){
46 | print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n";
47 | print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n";
48 | print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n";
49 | print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n";
50 | }
51 | }
52 | }
53 |
54 | print <){
27 | if(/^#define __NR_(\w+)\s+([0-9]+)/){
28 | $prev = $2;
29 | fmt($1, $2);
30 | }
31 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){
32 | fmt($1, $prev+$2)
33 | }
34 | }
35 |
36 | print <){
24 | if($line =~ /^(.*)\\$/) {
25 | # Handle continuation
26 | $line = $1;
27 | $_ =~ s/^\s+//;
28 | $line .= $_;
29 | } else {
30 | # New line
31 | $line = $_;
32 | }
33 | next if $line =~ /\\$/;
34 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
35 | my $num = $1;
36 | my $proto = $6;
37 | my $compat = $8;
38 | my $name = "$7_$9";
39 |
40 | $name = "$7_$11" if $11 ne '';
41 | $name =~ y/a-z/A-Z/;
42 |
43 | if($compat eq '' || $compat eq '30' || $compat eq '50') {
44 | print " $name = $num; // $proto\n";
45 | }
46 | }
47 | }
48 |
49 | print <){
23 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
24 | my $num = $1;
25 | my $proto = $3;
26 | my $name = $4;
27 | $name =~ y/a-z/A-Z/;
28 |
29 | # There are multiple entries for enosys and nosys, so comment them out.
30 | if($name =~ /^SYS_E?NOSYS$/){
31 | $name = "// $name";
32 | }
33 | if($name eq 'SYS_SYS_EXIT'){
34 | $name = 'SYS_EXIT';
35 | }
36 |
37 | print " $name = $num; // $proto\n";
38 | }
39 | }
40 |
41 | print <= 10 {
16 | buf[i] = byte(val%10 + '0')
17 | i--
18 | val /= 10
19 | }
20 | buf[i] = byte(val + '0')
21 | return string(buf[i:])
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | import (
8 | "syscall"
9 | "unsafe"
10 | )
11 |
12 | func Getpagesize() int { return 4096 }
13 |
14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15 |
16 | func NsecToTimespec(nsec int64) (ts Timespec) {
17 | ts.Sec = nsec / 1e9
18 | ts.Nsec = nsec % 1e9
19 | return
20 | }
21 |
22 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
23 |
24 | func NsecToTimeval(nsec int64) (tv Timeval) {
25 | nsec += 999 // round up to microsecond
26 | tv.Usec = nsec % 1e9 / 1e3
27 | tv.Sec = int64(nsec / 1e9)
28 | return
29 | }
30 |
31 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
32 | k.Ident = uint64(fd)
33 | k.Filter = int16(mode)
34 | k.Flags = uint16(flags)
35 | }
36 |
37 | func (iov *Iovec) SetLen(length int) {
38 | iov.Len = uint64(length)
39 | }
40 |
41 | func (msghdr *Msghdr) SetControllen(length int) {
42 | msghdr.Controllen = uint32(length)
43 | }
44 |
45 | func (cmsg *Cmsghdr) SetLen(length int) {
46 | cmsg.Len = uint32(length)
47 | }
48 |
49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
50 | var writtenOut uint64 = 0
51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
52 |
53 | written = int(writtenOut)
54 |
55 | if e1 != 0 {
56 | err = e1
57 | }
58 | return
59 | }
60 |
61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
62 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | import (
8 | "syscall"
9 | "unsafe"
10 | )
11 |
12 | func Getpagesize() int { return 4096 }
13 |
14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
15 |
16 | func NsecToTimespec(nsec int64) (ts Timespec) {
17 | ts.Sec = nsec / 1e9
18 | ts.Nsec = nsec % 1e9
19 | return
20 | }
21 |
22 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
23 |
24 | func NsecToTimeval(nsec int64) (tv Timeval) {
25 | nsec += 999 // round up to microsecond
26 | tv.Usec = nsec % 1e9 / 1e3
27 | tv.Sec = int64(nsec / 1e9)
28 | return
29 | }
30 |
31 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
32 | k.Ident = uint64(fd)
33 | k.Filter = int16(mode)
34 | k.Flags = uint16(flags)
35 | }
36 |
37 | func (iov *Iovec) SetLen(length int) {
38 | iov.Len = uint64(length)
39 | }
40 |
41 | func (msghdr *Msghdr) SetControllen(length int) {
42 | msghdr.Controllen = uint32(length)
43 | }
44 |
45 | func (cmsg *Cmsghdr) SetLen(length int) {
46 | cmsg.Len = uint32(length)
47 | }
48 |
49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
50 | var writtenOut uint64 = 0
51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
52 |
53 | written = int(writtenOut)
54 |
55 | if e1 != 0 {
56 | err = e1
57 | }
58 | return
59 | }
60 |
61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
62 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.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 unix
6 |
7 | import (
8 | "syscall"
9 | "unsafe"
10 | )
11 |
12 | func Getpagesize() int { return 4096 }
13 |
14 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) }
15 |
16 | func NsecToTimespec(nsec int64) (ts Timespec) {
17 | ts.Sec = nsec / 1e9
18 | ts.Nsec = int32(nsec % 1e9)
19 | return
20 | }
21 |
22 | func TimevalToNsec(tv Timeval) int64 { return tv.Sec*1e9 + int64(tv.Usec)*1e3 }
23 |
24 | func NsecToTimeval(nsec int64) (tv Timeval) {
25 | nsec += 999 // round up to microsecond
26 | tv.Usec = int32(nsec % 1e9 / 1e3)
27 | tv.Sec = nsec / 1e9
28 | return
29 | }
30 |
31 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
32 | k.Ident = uint32(fd)
33 | k.Filter = int16(mode)
34 | k.Flags = uint16(flags)
35 | }
36 |
37 | func (iov *Iovec) SetLen(length int) {
38 | iov.Len = uint32(length)
39 | }
40 |
41 | func (msghdr *Msghdr) SetControllen(length int) {
42 | msghdr.Controllen = uint32(length)
43 | }
44 |
45 | func (cmsg *Cmsghdr) SetLen(length int) {
46 | cmsg.Len = uint32(length)
47 | }
48 |
49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
50 | var writtenOut uint64 = 0
51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
52 |
53 | written = int(writtenOut)
54 |
55 | if e1 != 0 {
56 | err = e1
57 | }
58 | return
59 | }
60 |
61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
62 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = int64(nsec / 1e9)
13 | ts.Nsec = int32(nsec % 1e9)
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = int64(nsec / 1e9)
13 | ts.Nsec = int64(nsec % 1e9)
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint64(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint64(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.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 unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = int64(nsec / 1e9)
13 | ts.Nsec = int32(nsec % 1e9)
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_no_getwd.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 dragonfly freebsd netbsd openbsd
6 |
7 | package unix
8 |
9 | const ImplementsGetwd = false
10 |
11 | func Getwd() (string, error) { return "", ENOTSUP }
12 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = int64(nsec / 1e9)
13 | ts.Nsec = int32(nsec % 1e9)
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = int16(mode)
29 | k.Flags = uint16(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = nsec / 1e9
13 | ts.Nsec = nsec % 1e9
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = nsec % 1e9 / 1e3
22 | tv.Sec = nsec / 1e9
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint64(fd)
28 | k.Filter = int16(mode)
29 | k.Flags = uint16(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint64(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go:
--------------------------------------------------------------------------------
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 | package unix
6 |
7 | func Getpagesize() int { return 4096 }
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = nsec / 1e9
13 | ts.Nsec = nsec % 1e9
14 | return
15 | }
16 |
17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = nsec % 1e9 / 1e3
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func (iov *Iovec) SetLen(length int) {
27 | iov.Len = uint64(length)
28 | }
29 |
30 | func (cmsg *Cmsghdr) SetLen(length int) {
31 | cmsg.Len = uint32(length)
32 | }
33 |
34 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
35 | // TODO(aram): implement this, see issue 5847.
36 | panic("unimplemented")
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.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 unix
6 |
7 | // TODO(aram): remove these before Go 1.3.
8 | const (
9 | SYS_EXECVE = 59
10 | SYS_FCNTL = 62
11 | )
12 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/text/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 The Go Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/text/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the Go project.
5 |
6 | Google hereby grants to You a perpetual, worldwide, non-exclusive,
7 | no-charge, royalty-free, irrevocable (except as stated in this section)
8 | patent license to make, have made, use, offer to sell, sell, import,
9 | transfer and otherwise run, modify and propagate the contents of this
10 | implementation of Go, where such license applies only to those patent
11 | claims, both currently owned or controlled by Google and acquired in
12 | the future, licensable by Google that are necessarily infringed by this
13 | implementation of Go. This grant does not include claims that would be
14 | infringed only as a consequence of further modification of this
15 | implementation. If you or your agent or exclusive licensee institute or
16 | order or agree to the institution of patent litigation against any
17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging
18 | that this implementation of Go or any code incorporated within this
19 | implementation of Go constitutes direct or contributory patent
20 | infringement, or inducement of patent infringement, then any patent
21 | rights granted to you under this License for this implementation of Go
22 | shall terminate as of the date such litigation is filed.
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/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 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/bluesuncorp/validator.v5/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Dean Karn
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/bsm/ratelimit.v1/Makefile:
--------------------------------------------------------------------------------
1 | default: test
2 |
3 | testdeps:
4 | @go get github.com/onsi/ginkgo
5 | @go get github.com/onsi/gomega
6 |
7 | test: testdeps
8 | @go test ./...
9 |
10 | testrace: testdeps
11 | @go test ./... -race
12 |
13 | testall: test testrace
14 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/bufio.v1/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 The bufio Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/bufio.v1/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | go test gopkg.in/bufio.v1
3 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/bufio.v1/README.md:
--------------------------------------------------------------------------------
1 | bufio
2 | =====
3 |
4 | This is a fork of the http://golang.org/pkg/bufio/ package. It adds `ReadN` method that allows reading next `n` bytes from the internal buffer without allocating intermediate buffer. This method works just like the [Buffer.Next](http://golang.org/pkg/bytes/#Buffer.Next) method, but has slightly different signature.
5 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) Tomas Aparicio
4 |
5 | Permission is hereby granted, free of charge, to any person
6 | obtaining a copy of this software and associated documentation
7 | files (the "Software"), to deal in the Software without
8 | restriction, including without limitation the rights to use,
9 | copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the
11 | Software is furnished to do so, subject to the following
12 | conditions:
13 |
14 | The above copyright notice and this permission notice shall be
15 | included in all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 | OTHER DEALINGS IN THE SOFTWARE.
25 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/match.go:
--------------------------------------------------------------------------------
1 | package filetype
2 |
3 | import (
4 | "gopkg.in/h2non/filetype.v0/matchers"
5 | "gopkg.in/h2non/filetype.v0/types"
6 | )
7 |
8 | // Map of registered file matchers
9 | var Matchers = matchers.Matchers
10 |
11 | // Create and register a new matcher
12 | var NewMatcher = matchers.NewMatcher
13 |
14 | // Infer the file type of a given buffer inspecting its magic numbers signature
15 | func Match(buf []byte) (types.Type, error) {
16 | length := len(buf)
17 | if length == 0 {
18 | return types.Unknown, EmptyBufferErr
19 | }
20 |
21 | for _, checker := range Matchers {
22 | match := checker(buf)
23 | if match != types.Unknown && match.Extension != "" {
24 | return match, nil
25 | }
26 | }
27 |
28 | return types.Unknown, nil
29 | }
30 |
31 | // Alias to Match()
32 | func Get(buf []byte) (types.Type, error) {
33 | return Match(buf)
34 | }
35 |
36 | // Register a new matcher type
37 | func AddMatcher(fileType types.Type, matcher matchers.Matcher) matchers.TypeMatcher {
38 | return matchers.NewMatcher(fileType, matcher)
39 | }
40 |
41 | // Checks if the given buffer matches with some supported file type
42 | func Matches(buf []byte) bool {
43 | kind, _ := Match(buf)
44 | return kind != types.Unknown
45 | }
46 |
47 | // Perform a file matching againts a map of match functions
48 | func MatchMap(buf []byte, matchers matchers.Map) types.Type {
49 | for kind, matcher := range matchers {
50 | if matcher(buf) {
51 | return kind
52 | }
53 | }
54 | return types.Unknown
55 | }
56 |
57 | // Same as Matches(), but using matching againts a map of match functions
58 | func MatchesMap(buf []byte, matchers matchers.Map) bool {
59 | return MatchMap(buf, matchers) != types.Unknown
60 | }
61 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/matchers/audio.go:
--------------------------------------------------------------------------------
1 | package matchers
2 |
3 | var (
4 | TypeMidi = newType("mid", "audio/midi")
5 | TypeMp3 = newType("mp3", "audio/mpeg")
6 | TypeM4a = newType("m4a", "audio/m4a")
7 | TypeOgg = newType("ogg", "audio/ogg")
8 | TypeFlac = newType("flac", "audio/x-flac")
9 | TypeWav = newType("wav", "audio/x-wav")
10 | )
11 |
12 | var Audio = Map{
13 | TypeMidi: Midi,
14 | TypeMp3: Mp3,
15 | TypeM4a: M4a,
16 | TypeOgg: Ogg,
17 | TypeFlac: Flac,
18 | TypeWav: Wav,
19 | }
20 |
21 | func Midi(buf []byte) bool {
22 | return len(buf) > 3 &&
23 | buf[0] == 0x4D && buf[1] == 0x54 &&
24 | buf[2] == 0x68 && buf[3] == 0x64
25 | }
26 |
27 | func Mp3(buf []byte) bool {
28 | return len(buf) > 2 &&
29 | (buf[0] == 0x49 && buf[1] == 0x44 && buf[2] == 0x33) ||
30 | (buf[0] == 0xFF && buf[1] == 0xfb)
31 | }
32 |
33 | func M4a(buf []byte) bool {
34 | return len(buf) > 10 &&
35 | (buf[4] == 0x66 && buf[5] == 0x74 && buf[6] == 0x79 &&
36 | buf[7] == 0x70 && buf[8] == 0x4D && buf[9] == 0x34 && buf[10] == 0x41) ||
37 | (buf[0] == 0x4D && buf[1] == 0x34 && buf[2] == 0x41 && buf[3] == 0x20)
38 | }
39 |
40 | func Ogg(buf []byte) bool {
41 | return len(buf) > 3 &&
42 | buf[0] == 0x4F && buf[1] == 0x67 &&
43 | buf[2] == 0x67 && buf[3] == 0x53
44 | }
45 |
46 | func Flac(buf []byte) bool {
47 | return len(buf) > 3 &&
48 | buf[0] == 0x66 && buf[1] == 0x4C &&
49 | buf[2] == 0x61 && buf[3] == 0x43
50 | }
51 |
52 | func Wav(buf []byte) bool {
53 | return len(buf) > 11 &&
54 | buf[0] == 0x52 && buf[1] == 0x49 && buf[2] == 0x46 && buf[3] == 0x46 &&
55 | buf[8] == 0x57 && buf[9] == 0x41 && buf[10] == 0x56 && buf[11] == 0x45
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/matchers/font.go:
--------------------------------------------------------------------------------
1 | package matchers
2 |
3 | var (
4 | TypeWoff = newType("woff", "application/font-woff")
5 | TypeWoff2 = newType("woff2", "application/font-woff")
6 | TypeTtf = newType("ttf", "application/font-sfnt")
7 | TypeOtf = newType("otf", "application/font-sfnt")
8 | )
9 |
10 | var Font = Map{
11 | TypeWoff: Woff,
12 | TypeWoff2: Woff2,
13 | TypeTtf: Ttf,
14 | TypeOtf: Otf,
15 | }
16 |
17 | func Woff(buf []byte) bool {
18 | return len(buf) > 7 &&
19 | buf[0] == 0x77 && buf[1] == 0x4F && buf[2] == 0x46 && buf[3] == 0x46 &&
20 | buf[4] == 0x00 && buf[5] == 0x01 && buf[6] == 0x00 && buf[7] == 0x00
21 | }
22 |
23 | func Woff2(buf []byte) bool {
24 | return len(buf) > 7 &&
25 | buf[0] == 0x77 && buf[1] == 0x4F && buf[2] == 0x46 && buf[3] == 0x32 &&
26 | buf[4] == 0x00 && buf[5] == 0x01 && buf[6] == 0x00 && buf[7] == 0x00
27 | }
28 |
29 | func Ttf(buf []byte) bool {
30 | return len(buf) > 4 &&
31 | buf[0] == 0x00 && buf[1] == 0x01 &&
32 | buf[2] == 0x00 && buf[3] == 0x00 &&
33 | buf[4] == 0x00
34 | }
35 |
36 | func Otf(buf []byte) bool {
37 | return len(buf) > 4 &&
38 | buf[0] == 0x4F && buf[1] == 0x54 &&
39 | buf[2] == 0x54 && buf[3] == 0x4F &&
40 | buf[4] == 0x00
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/matchers/matchers.go:
--------------------------------------------------------------------------------
1 | package matchers
2 |
3 | import "gopkg.in/h2non/filetype.v0/types"
4 |
5 | // Internal shortcut to NewType
6 | var newType = types.NewType
7 |
8 | // Matcher function interface as type alias
9 | type Matcher func([]byte) bool
10 |
11 | // Type interface to store pairs of type with its matcher function
12 | type Map map[types.Type]Matcher
13 |
14 | // Type specific matcher function interface
15 | type TypeMatcher func([]byte) types.Type
16 |
17 | // Store registered file type matchers
18 | var Matchers = make(map[types.Type]TypeMatcher)
19 |
20 | // Create and register a new type matcher function
21 | func NewMatcher(kind types.Type, fn Matcher) TypeMatcher {
22 | matcher := func(buf []byte) types.Type {
23 | if fn(buf) {
24 | return kind
25 | }
26 | return types.Unknown
27 | }
28 |
29 | Matchers[kind] = matcher
30 | return matcher
31 | }
32 |
33 | func register(matchers ...Map) {
34 | for _, m := range matchers {
35 | for kind, matcher := range m {
36 | NewMatcher(kind, matcher)
37 | }
38 | }
39 | }
40 |
41 | func init() {
42 | // Arguments order is intentional
43 | register(Image, Video, Audio, Font, Archive)
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/types/defaults.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | var Unknown = NewType("unknown", "")
4 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/types/mime.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | type MIME struct {
4 | Type string
5 | Subtype string
6 | Value string
7 | }
8 |
9 | // Creates a new MIME type
10 | func NewMIME(mime string) MIME {
11 | kind, subtype := splitMime(mime)
12 | return MIME{Type: kind, Subtype: subtype, Value: mime}
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/types/split.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | import "strings"
4 |
5 | func splitMime(s string) (string, string) {
6 | x := strings.Split(s, "/")
7 | if len(x) > 1 {
8 | return x[0], x[1]
9 | }
10 | return x[0], ""
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/types/type.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | type Type struct {
4 | MIME MIME
5 | Extension string
6 | }
7 |
8 | func NewType(ext, mime string) Type {
9 | t := Type{
10 | MIME: NewMIME(mime),
11 | Extension: ext,
12 | }
13 | return Add(t)
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/h2non/filetype.v0/types/types.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | var Types = make(map[string]Type)
4 |
5 | // Register a new type
6 | func Add(t Type) Type {
7 | Types[t.Extension] = t
8 | return t
9 | }
10 |
11 | // Retrieve a Type by extension
12 | func Get(ext string) Type {
13 | kind := Types[ext]
14 | if kind.Extension != "" {
15 | return kind
16 | }
17 | return Unknown
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/LICENSE:
--------------------------------------------------------------------------------
1 | mgo - MongoDB driver for Go
2 |
3 | Copyright (c) 2010-2013 - Gustavo Niemeyer
4 |
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/Makefile:
--------------------------------------------------------------------------------
1 | startdb:
2 | @testdb/setup.sh start
3 |
4 | stopdb:
5 | @testdb/setup.sh stop
6 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/bson/LICENSE:
--------------------------------------------------------------------------------
1 | BSON library for Go
2 |
3 | Copyright (c) 2010-2012 - Gustavo Niemeyer
4 |
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/doc.go:
--------------------------------------------------------------------------------
1 | // Package mgo offers a rich MongoDB driver for Go.
2 | //
3 | // Details about the mgo project (pronounced as "mango") are found
4 | // in its web page:
5 | //
6 | // http://labix.org/mgo
7 | //
8 | // Usage of the driver revolves around the concept of sessions. To
9 | // get started, obtain a session using the Dial function:
10 | //
11 | // session, err := mgo.Dial(url)
12 | //
13 | // This will establish one or more connections with the cluster of
14 | // servers defined by the url parameter. From then on, the cluster
15 | // may be queried with multiple consistency rules (see SetMode) and
16 | // documents retrieved with statements such as:
17 | //
18 | // c := session.DB(database).C(collection)
19 | // err := c.Find(query).One(&result)
20 | //
21 | // New sessions are typically created by calling session.Copy on the
22 | // initial session obtained at dial time. These new sessions will share
23 | // the same cluster information and connection pool, and may be easily
24 | // handed into other methods and functions for organizing logic.
25 | // Every session created must have its Close method called at the end
26 | // of its life time, so its resources may be put back in the pool or
27 | // collected, depending on the case.
28 | //
29 | // For more details, see the documentation for the types and methods.
30 | //
31 | package mgo
32 |
--------------------------------------------------------------------------------
/vendor/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, char* target);
7 | int sspi_send_client_authz_id(CtxtHandle* context, PVOID* buffer, ULONG* buffer_length, char* user_plus_realm);
8 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/raceoff.go:
--------------------------------------------------------------------------------
1 | // +build !race
2 |
3 | package mgo
4 |
5 | const raceDetector = false
6 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/mgo.v2/raceon.go:
--------------------------------------------------------------------------------
1 | // +build race
2 |
3 | package mgo
4 |
5 | const raceDetector = true
6 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/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 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 The Redis Go Client Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/Makefile:
--------------------------------------------------------------------------------
1 | all: testdeps
2 | go test ./... -v=1 -cpu=1,2,4
3 | go test ./... -short -race
4 |
5 | test: testdeps
6 | go test ./... -v=1
7 |
8 | testdeps: .test/redis/src/redis-server
9 |
10 | .PHONY: all test testdeps
11 |
12 | .test/redis:
13 | mkdir -p $@
14 | wget -qO- https://github.com/antirez/redis/archive/3.0.tar.gz | tar xvz --strip-components=1 -C $@
15 |
16 | .test/redis/src/redis-server: .test/redis
17 | cd $< && make all
18 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Package redis implements a Redis client.
3 | */
4 | package redis
5 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/error.go:
--------------------------------------------------------------------------------
1 | package redis
2 |
3 | import (
4 | "fmt"
5 | "io"
6 | "net"
7 | "strings"
8 | )
9 |
10 | // Redis nil reply, .e.g. when key does not exist.
11 | var Nil = errorf("redis: nil")
12 |
13 | // Redis transaction failed.
14 | var TxFailedErr = errorf("redis: transaction failed")
15 |
16 | type redisError struct {
17 | s string
18 | }
19 |
20 | func errorf(s string, args ...interface{}) redisError {
21 | return redisError{s: fmt.Sprintf(s, args...)}
22 | }
23 |
24 | func (err redisError) Error() string {
25 | return err.s
26 | }
27 |
28 | func isNetworkError(err error) bool {
29 | if _, ok := err.(net.Error); ok || err == io.EOF {
30 | return true
31 | }
32 | return false
33 | }
34 |
35 | func isMovedError(err error) (moved bool, ask bool, addr string) {
36 | if _, ok := err.(redisError); !ok {
37 | return
38 | }
39 |
40 | parts := strings.SplitN(err.Error(), " ", 3)
41 | if len(parts) != 3 {
42 | return
43 | }
44 |
45 | switch parts[0] {
46 | case "MOVED":
47 | moved = true
48 | addr = parts[2]
49 | case "ASK":
50 | ask = true
51 | addr = parts[2]
52 | }
53 |
54 | return
55 | }
56 |
57 | // shouldRetry reports whether failed command should be retried.
58 | func shouldRetry(err error) bool {
59 | if err == nil {
60 | return false
61 | }
62 | return isNetworkError(err)
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/script.go:
--------------------------------------------------------------------------------
1 | package redis
2 |
3 | import (
4 | "crypto/sha1"
5 | "encoding/hex"
6 | "io"
7 | "strings"
8 | )
9 |
10 | type scripter interface {
11 | Eval(script string, keys []string, args []string) *Cmd
12 | EvalSha(sha1 string, keys []string, args []string) *Cmd
13 | ScriptExists(scripts ...string) *BoolSliceCmd
14 | ScriptLoad(script string) *StringCmd
15 | }
16 |
17 | type Script struct {
18 | src, hash string
19 | }
20 |
21 | func NewScript(src string) *Script {
22 | h := sha1.New()
23 | io.WriteString(h, src)
24 | return &Script{
25 | src: src,
26 | hash: hex.EncodeToString(h.Sum(nil)),
27 | }
28 | }
29 |
30 | func (s *Script) Load(c scripter) *StringCmd {
31 | return c.ScriptLoad(s.src)
32 | }
33 |
34 | func (s *Script) Exists(c scripter) *BoolSliceCmd {
35 | return c.ScriptExists(s.src)
36 | }
37 |
38 | func (s *Script) Eval(c scripter, keys []string, args []string) *Cmd {
39 | return c.Eval(s.src, keys, args)
40 | }
41 |
42 | func (s *Script) EvalSha(c scripter, keys []string, args []string) *Cmd {
43 | return c.EvalSha(s.hash, keys, args)
44 | }
45 |
46 | func (s *Script) Run(c scripter, keys []string, args []string) *Cmd {
47 | r := s.EvalSha(c, keys, args)
48 | if err := r.Err(); err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") {
49 | return s.Eval(c, keys, args)
50 | }
51 | return r
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/redis.v3/unsafe.go:
--------------------------------------------------------------------------------
1 | package redis
2 |
3 | import (
4 | "reflect"
5 | "unsafe"
6 | )
7 |
8 | func bytesToString(b []byte) string {
9 | bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b))
10 | strHeader := reflect.StringHeader{bytesHeader.Data, bytesHeader.Len}
11 | return *(*string)(unsafe.Pointer(&strHeader))
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/unrolled/render.v1/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Cory Jacobsen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/unrolled/render.v1/buffer.go:
--------------------------------------------------------------------------------
1 | package render
2 |
3 | import "bytes"
4 |
5 | // bufPool represents a reusable buffer pool for executing templates into.
6 | var bufPool *BufferPool
7 |
8 | // BufferPool implements a pool of bytes.Buffers in the form of a bounded channel.
9 | // Pulled from the github.com/oxtoacart/bpool package (Apache licensed).
10 | type BufferPool struct {
11 | c chan *bytes.Buffer
12 | }
13 |
14 | // NewBufferPool creates a new BufferPool bounded to the given size.
15 | func NewBufferPool(size int) (bp *BufferPool) {
16 | return &BufferPool{
17 | c: make(chan *bytes.Buffer, size),
18 | }
19 | }
20 |
21 | // Get gets a Buffer from the BufferPool, or creates a new one if none are
22 | // available in the pool.
23 | func (bp *BufferPool) Get() (b *bytes.Buffer) {
24 | select {
25 | case b = <-bp.c:
26 | // reuse existing buffer
27 | default:
28 | // create new buffer
29 | b = bytes.NewBuffer([]byte{})
30 | }
31 | return
32 | }
33 |
34 | // Put returns the given Buffer to the BufferPool.
35 | func (bp *BufferPool) Put(b *bytes.Buffer) {
36 | b.Reset()
37 | select {
38 | case bp.c <- b:
39 | default: // Discard the buffer if the pool is full.
40 | }
41 | }
42 |
--------------------------------------------------------------------------------