├── ext ├── README.md ├── import.go └── demo │ └── init.go ├── teaconfigs ├── agents │ ├── item_test.go │ ├── init.go │ ├── source_variable.go │ ├── source_category.go │ ├── source_utils_test.go │ ├── source_date_test.go │ ├── source_memory_test.go │ ├── source_processes_test.go │ ├── source_connections_test.go │ ├── source_test.go │ ├── agent_list_test.go │ ├── source_docker_test.go │ ├── source_file_change_test.go │ ├── source_load_unix_like.go │ ├── source_cpu_test.go │ ├── source_nginx_status_test.go │ ├── schedule_range.go │ └── source_teaweb_test.go ├── mime_type_rule.go ├── ssl_acme_dns_record.go ├── notices │ ├── format.go │ ├── notice_test.go │ ├── media_webhook_test.go │ ├── media_dingtalk_test.go │ └── meida_qy_weixin_test.go ├── scheduling │ └── candidate.go ├── api │ ├── api_version.go │ ├── api_param.go │ ├── api_request_limit.go │ ├── api_test_script_result.go │ ├── api_data_limit.go │ ├── api_script_test.go │ └── api_auth_none.go ├── node_test.go ├── server_group_list_test.go ├── backend_ftp.go ├── forward_http.go ├── db │ ├── mysql_test.go │ ├── postgres_test.go │ └── db_test.go ├── forms │ ├── presentation.go │ └── utils.go ├── shared │ ├── var.go │ ├── header_list_test.go │ └── regexp_test.go ├── widgets │ ├── line.go │ ├── chart_url.go │ ├── chart_html.go │ ├── chart_javascript_test.go │ └── widget_test.go ├── scheduling.go ├── shutdown.go ├── node_role.go ├── time_pass_test.go ├── ssl_acme_dns_provider.go └── web_test.go ├── tealogs ├── access_logger_test.go ├── accesslogs │ └── README.md ├── tests │ ├── mysql_storage.sql │ └── command_storage.php ├── init.go └── storage_types.go ├── .gitignore ├── vendor └── github.com │ └── go-acme │ └── lego │ ├── docs │ ├── .gitignore │ ├── layouts │ │ └── partials │ │ │ └── logo.html │ ├── static │ │ └── images │ │ │ ├── logo.png │ │ │ └── logo-white.png │ ├── archetypes │ │ └── default.md │ ├── content │ │ └── usage │ │ │ └── _index.md │ └── Makefile │ ├── providers │ └── dns │ │ ├── transip │ │ └── fixtures │ │ │ └── private.key │ │ └── gcloud │ │ └── fixtures │ │ └── gce_account_service_file.json │ ├── vendor │ ├── go.opencensus.io │ │ └── AUTHORS │ ├── github.com │ │ ├── modern-go │ │ │ ├── reflect2 │ │ │ │ ├── relfect2_386.s │ │ │ │ ├── relfect2_arm.s │ │ │ │ ├── reflect2_amd64.s │ │ │ │ ├── relfect2_amd64p32.s │ │ │ │ ├── relfect2_arm64.s │ │ │ │ ├── relfect2_mips64x.s │ │ │ │ ├── relfect2_mipsx.s │ │ │ │ ├── relfect2_ppc64x.s │ │ │ │ ├── relfect2_s390x.s │ │ │ │ ├── go_below_17.go │ │ │ │ ├── go_above_17.go │ │ │ │ ├── go_below_19.go │ │ │ │ └── go_above_19.go │ │ │ └── concurrent │ │ │ │ ├── go_above_19.go │ │ │ │ └── log.go │ │ ├── linode │ │ │ └── linodego │ │ │ │ ├── managed.go │ │ │ │ ├── profile.go │ │ │ │ └── util.go │ │ ├── miekg │ │ │ └── dns │ │ │ │ ├── AUTHORS │ │ │ │ ├── CONTRIBUTORS │ │ │ │ ├── version.go │ │ │ │ └── fuzz.go │ │ ├── akamai │ │ │ └── AkamaiOPEN-edgegrid-golang │ │ │ │ ├── jsonhooks-v1 │ │ │ │ └── errors.go │ │ │ │ └── configdns-v1 │ │ │ │ └── service.go │ │ ├── exoscale │ │ │ └── egoscale │ │ │ │ ├── version.go │ │ │ │ └── AUTHORS │ │ ├── sacloud │ │ │ └── libsacloud │ │ │ │ ├── sacloud │ │ │ │ ├── doc.go │ │ │ │ ├── host.go │ │ │ │ ├── member.go │ │ │ │ ├── prop_cpu.go │ │ │ │ ├── account.go │ │ │ │ ├── prop_class.go │ │ │ │ ├── prop_storage.go │ │ │ │ ├── delete_cache_result.go │ │ │ │ ├── product_internet.go │ │ │ │ ├── prop_assigned_cpu.go │ │ │ │ ├── prop_host_name.go │ │ │ │ ├── prop_service_class.go │ │ │ │ ├── prop_storage_class.go │ │ │ │ ├── prop_name.go │ │ │ │ ├── prop_job_status.go │ │ │ │ ├── product_license.go │ │ │ │ ├── ipaddress.go │ │ │ │ ├── product_privatehost.go │ │ │ │ ├── prop_description.go │ │ │ │ ├── prop_host.go │ │ │ │ ├── region.go │ │ │ │ ├── private_host.go │ │ │ │ ├── ftp_server.go │ │ │ │ ├── cdrom.go │ │ │ │ ├── storage.go │ │ │ │ └── prop_disks.go │ │ │ │ ├── libsacloud.go │ │ │ │ └── api │ │ │ │ ├── bridge.go │ │ │ │ ├── note.go │ │ │ │ ├── region.go │ │ │ │ ├── subnet.go │ │ │ │ ├── license.go │ │ │ │ ├── zone.go │ │ │ │ ├── ipv6net.go │ │ │ │ ├── public_price.go │ │ │ │ ├── private_host.go │ │ │ │ ├── product_disk.go │ │ │ │ ├── packet_filter.go │ │ │ │ ├── product_license.go │ │ │ │ └── product_internet.go │ │ ├── rainycape │ │ │ └── memcache │ │ │ │ ├── util_safe.go │ │ │ │ ├── util_unsafe.go │ │ │ │ └── addr.go │ │ ├── aws │ │ │ └── aws-sdk-go │ │ │ │ ├── NOTICE.txt │ │ │ │ ├── aws │ │ │ │ ├── context_1_7.go │ │ │ │ ├── signer │ │ │ │ │ └── v4 │ │ │ │ │ │ ├── options.go │ │ │ │ │ │ └── uri_path.go │ │ │ │ ├── request │ │ │ │ │ ├── connection_reset_error_other.go │ │ │ │ │ ├── connection_reset_error.go │ │ │ │ │ ├── request_context_1_6.go │ │ │ │ │ ├── http_request.go │ │ │ │ │ └── request_context.go │ │ │ │ ├── version.go │ │ │ │ ├── url.go │ │ │ │ ├── jsonvalue.go │ │ │ │ └── client │ │ │ │ │ └── metadata │ │ │ │ │ └── client_info.go │ │ │ │ ├── internal │ │ │ │ └── sdkio │ │ │ │ │ ├── io_go1.6.go │ │ │ │ │ └── io_go1.7.go │ │ │ │ └── service │ │ │ │ └── sts │ │ │ │ └── customizations.go │ │ ├── google │ │ │ └── uuid │ │ │ │ ├── CONTRIBUTORS │ │ │ │ └── doc.go │ │ ├── Azure │ │ │ └── azure-sdk-for-go │ │ │ │ └── NOTICE │ │ ├── dgrijalva │ │ │ └── jwt-go │ │ │ │ └── doc.go │ │ ├── golang │ │ │ └── protobuf │ │ │ │ ├── AUTHORS │ │ │ │ └── CONTRIBUTORS │ │ ├── gophercloud │ │ │ └── gophercloud │ │ │ │ ├── pagination │ │ │ │ └── pkg.go │ │ │ │ └── openstack │ │ │ │ ├── identity │ │ │ │ ├── v3 │ │ │ │ │ └── tokens │ │ │ │ │ │ └── urls.go │ │ │ │ └── v2 │ │ │ │ │ └── tokens │ │ │ │ │ └── urls.go │ │ │ │ └── dns │ │ │ │ └── v2 │ │ │ │ ├── zones │ │ │ │ └── urls.go │ │ │ │ └── recordsets │ │ │ │ └── urls.go │ │ ├── aliyun │ │ │ └── alibaba-cloud-sdk-go │ │ │ │ └── sdk │ │ │ │ └── auth │ │ │ │ └── signers │ │ │ │ └── session_credential.go │ │ ├── dnsimple │ │ │ └── dnsimple-go │ │ │ │ └── dnsimple │ │ │ │ └── users.go │ │ ├── sirupsen │ │ │ └── logrus │ │ │ │ ├── terminal_check_appengine.go │ │ │ │ ├── terminal_bsd.go │ │ │ │ ├── terminal_check_notappengine.go │ │ │ │ └── terminal_linux.go │ │ ├── stretchr │ │ │ ├── objx │ │ │ │ ├── security.go │ │ │ │ ├── constants.go │ │ │ │ └── tests.go │ │ │ └── testify │ │ │ │ ├── assert │ │ │ │ ├── errors.go │ │ │ │ └── forward_assertions.go │ │ │ │ └── require │ │ │ │ └── forward_requirements.go │ │ ├── cpu │ │ │ └── goacmedns │ │ │ │ └── account.go │ │ ├── go-resty │ │ │ └── resty │ │ │ │ └── resty.go │ │ ├── ovh │ │ │ └── go-ovh │ │ │ │ └── ovh │ │ │ │ ├── logger.go │ │ │ │ └── error.go │ │ ├── kolo │ │ │ └── xmlrpc │ │ │ │ └── xmlrpc.go │ │ ├── OpenDNS │ │ │ └── vegadns2client │ │ │ │ └── main.go │ │ └── transip │ │ │ └── gotransip │ │ │ └── api.go │ ├── google.golang.org │ │ ├── grpc │ │ │ └── AUTHORS │ │ ├── appengine │ │ │ └── internal │ │ │ │ └── main.go │ │ └── api │ │ │ ├── AUTHORS │ │ │ └── gensupport │ │ │ └── doc.go │ ├── gopkg.in │ │ └── ns1 │ │ │ └── ns1-go.v2 │ │ │ └── rest │ │ │ ├── doc.go │ │ │ └── model │ │ │ ├── dns │ │ │ └── doc.go │ │ │ ├── filter │ │ │ └── doc.go │ │ │ ├── data │ │ │ ├── doc.go │ │ │ └── region.go │ │ │ ├── monitor │ │ │ ├── doc.go │ │ │ └── config.go │ │ │ └── account │ │ │ ├── doc.go │ │ │ ├── team.go │ │ │ └── apikey.go │ └── golang.org │ │ └── x │ │ ├── net │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── internal │ │ │ └── socket │ │ │ │ ├── sys_darwin.go │ │ │ │ ├── sys_dragonfly.go │ │ │ │ ├── sys_linux_amd64.go │ │ │ │ ├── sys_linux_arm.go │ │ │ │ ├── sys_linux_arm64.go │ │ │ │ ├── sys_linux_ppc64.go │ │ │ │ ├── sys_linux_mips.go │ │ │ │ ├── sys_linux_mips64.go │ │ │ │ ├── sys_linux_mips64le.go │ │ │ │ ├── sys_linux_mipsle.go │ │ │ │ ├── sys_linux_ppc64le.go │ │ │ │ ├── iovec_stub.go │ │ │ │ ├── msghdr_openbsd.go │ │ │ │ ├── sys_linux_386.s │ │ │ │ ├── sys_bsdvar.go │ │ │ │ ├── sys_linux_s390x.s │ │ │ │ ├── sys_solaris_amd64.s │ │ │ │ ├── cmsghdr_bsd.go │ │ │ │ ├── cmsghdr_solaris_64bit.go │ │ │ │ ├── cmsghdr_linux_32bit.go │ │ │ │ ├── msghdr_bsdvar.go │ │ │ │ ├── cmsghdr_linux_64bit.go │ │ │ │ ├── cmsghdr.go │ │ │ │ └── iovec_solaris_64bit.go │ │ ├── bpf │ │ │ └── setter.go │ │ ├── ipv4 │ │ │ ├── sys_stub.go │ │ │ ├── sys_bpf_stub.go │ │ │ ├── control_windows.go │ │ │ └── control_stub.go │ │ ├── ipv6 │ │ │ ├── sys_stub.go │ │ │ ├── sys_bpf_stub.go │ │ │ ├── control_windows.go │ │ │ └── control_stub.go │ │ └── http2 │ │ │ ├── not_go19.go │ │ │ ├── go16.go │ │ │ └── go19.go │ │ ├── sys │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── unix │ │ │ ├── endian_big.go │ │ │ ├── endian_little.go │ │ │ ├── constants.go │ │ │ ├── syscall_linux_amd64_gc.go │ │ │ ├── aliases.go │ │ │ ├── pagesize_unix.go │ │ │ └── fcntl_linux_32bit.go │ │ └── windows │ │ │ ├── mksyscall.go │ │ │ ├── aliases.go │ │ │ ├── asm_windows_386.s │ │ │ └── asm_windows_amd64.s │ │ ├── text │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── language │ │ │ ├── go1_2.go │ │ │ └── common.go │ │ └── secure │ │ │ └── bidirule │ │ │ ├── bidirule10.0.0.go │ │ │ └── bidirule9.0.0.go │ │ ├── time │ │ ├── AUTHORS │ │ └── CONTRIBUTORS │ │ ├── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ └── ssh │ │ │ └── terminal │ │ │ ├── util_linux.go │ │ │ └── util_bsd.go │ │ └── oauth2 │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── internal │ │ ├── doc.go │ │ └── client_appengine.go │ │ └── google │ │ ├── appengineflex_hook.go │ │ └── appengine_hook.go │ ├── .gitignore │ ├── .dockerignore │ ├── .gitcookies.enc │ ├── e2e │ ├── fixtures │ │ ├── csr.raw │ │ ├── certs │ │ │ └── localhost │ │ │ │ └── README.md │ │ ├── pebble-config.json │ │ └── pebble-config-dns.json │ └── readme.md │ ├── challenge │ └── dns01 │ │ ├── fixtures │ │ └── resolv.conf.1 │ │ ├── cname.go │ │ └── fqdn.go │ ├── cmd │ └── cmd.go │ ├── registration │ ├── user.go │ └── user_test.go │ ├── Dockerfile │ └── acme │ └── api │ └── internal │ └── sender │ └── useragent.go ├── teaevents ├── event_type.go ├── locker.go ├── event_interface.go ├── event_reload.go └── event_config_changed.go ├── teadb ├── expr.go ├── sql_cond.go ├── dao_base.go ├── expr_avg.go ├── expr_max.go ├── expr_min.go ├── expr_sum.go ├── sql_action.go ├── table_stat.go ├── shared │ ├── index_field.go │ └── id.go ├── driver_sql_interface.go ├── sort_field.go ├── util_test.go ├── hook.go ├── driver_base.go ├── sql_params_holder_test.go └── dao_audit_log.go ├── teamemory ├── README.md ├── stat.go ├── cell_stat.go ├── opt_compress.go ├── opt_limit_size.go ├── opt_limit_count.go └── opt_recycle_interval.go ├── teawaf ├── action_instance.go ├── checkpoints │ ├── option.go │ ├── checkpoint_definition.go │ ├── response_status_test.go │ ├── param_option.go │ ├── checkpoint.go │ ├── response_header_test.go │ ├── request_path_test.go │ └── request_scheme_test.go ├── requests │ └── response.go ├── action_definition.go ├── action_log.go ├── action_allow.go └── rule_operator_test.go ├── teaweb ├── actions │ └── default │ │ ├── index │ │ ├── init.go │ │ └── index.go │ │ ├── proxy │ │ ├── board │ │ │ ├── scripts │ │ │ │ ├── init.go │ │ │ │ └── context.go │ │ │ └── refreshData.go │ │ ├── import.go │ │ ├── proxyutils │ │ │ └── stat_test.go │ │ ├── certs │ │ │ ├── certutils │ │ │ │ └── acme_test.go │ │ │ ├── helper.go │ │ │ ├── acmeUsers.go │ │ │ └── acmeDeleteTask.go │ │ ├── log │ │ │ ├── helper.go │ │ │ └── policies │ │ │ │ └── helper.go │ │ ├── settings │ │ │ ├── index.go │ │ │ └── helper.go │ │ ├── status.go │ │ ├── tunnel │ │ │ └── generateSecret.go │ │ ├── rewrite │ │ │ └── helper.go │ │ ├── servergroups │ │ │ ├── helper.go │ │ │ └── delete.go │ │ ├── notices │ │ │ └── helper.go │ │ ├── clientDisconnect.go │ │ ├── restart.go │ │ └── frontend.go │ │ ├── agents │ │ ├── agentutils │ │ │ ├── item_state.go │ │ │ └── agent_event.go │ │ ├── menu.go │ │ ├── index.go │ │ ├── apps │ │ │ ├── helper.go │ │ │ └── detail.go │ │ ├── board │ │ │ └── helper.go │ │ ├── cluster │ │ │ └── helper.go │ │ ├── notices │ │ │ ├── helper.go │ │ │ └── init.go │ │ ├── helper.go │ │ └── groups │ │ │ └── move.go │ │ ├── notices │ │ ├── noticeutils │ │ │ ├── init.go │ │ │ └── task_test.go │ │ └── sound.go │ │ ├── settings │ │ ├── mongo │ │ │ ├── data.go │ │ │ └── clean.go │ │ ├── mysql │ │ │ ├── data.go │ │ │ └── clean.go │ │ ├── postgres │ │ │ ├── data.go │ │ │ └── clean.go │ │ ├── backup │ │ │ ├── backup.go │ │ │ └── index.go │ │ ├── cluster │ │ │ └── connect.go │ │ ├── database │ │ │ ├── index.go │ │ │ └── deleteTable.go │ │ ├── update │ │ │ └── init.go │ │ └── server │ │ │ └── http.go │ │ ├── dashboard │ │ ├── index.go │ │ └── init.go │ │ ├── install │ │ ├── index.go │ │ ├── skip.go │ │ └── init.go │ │ ├── logout │ │ └── index.go │ │ ├── ui │ │ └── init.go │ │ ├── search │ │ └── init.go │ │ ├── mongo │ │ ├── test.go │ │ └── init.go │ │ ├── api │ │ ├── agent │ │ │ ├── ip.go │ │ │ └── README.md │ │ ├── v1 │ │ │ ├── reset.go │ │ │ ├── stop.go │ │ │ ├── backup │ │ │ │ └── files.go │ │ │ └── helper.go │ │ └── monitor │ │ │ └── init.go │ │ ├── cache │ │ └── helper.go │ │ ├── plugins │ │ └── init.go │ │ └── login │ │ └── init.go ├── cmd │ ├── web_shell_test.go │ ├── web_shell_others.go │ └── web_shell_windows.go └── utils │ └── menu_item.go ├── teacluster ├── const.go ├── action_interface.go ├── action_fail.go ├── manager_test.go ├── action_ping.go ├── action_success.go ├── action_utils_test.go ├── action_notify.go ├── codes.go ├── action_pull.go ├── configs │ └── item_action.go └── action.go ├── teaproxy ├── mitm │ └── README.md ├── named_server.go ├── http_client_pool_test.go ├── ftp_response_body.go ├── http_serve_mux.go ├── tunnel_response_body.go ├── request_proxy.go └── utils.go ├── teaconst ├── vars.go └── const.go ├── teautils ├── command.go ├── http_1.11.go ├── process_test.go ├── http_1.12.go ├── map_test.go ├── rlimit_others.go ├── file.go ├── panic.go ├── ticker_utils.go ├── match_test.go ├── file_windows.go ├── service_test.go ├── file_others.go ├── service_others.go ├── signal.go ├── copy.go └── match.go ├── main ├── main.go └── pprof.go ├── teaplugins ├── init.go └── plugin.go ├── teatesting ├── require_test.go └── utils.go ├── teacache └── init.go ├── teastats ├── counter_value.go └── variable.go ├── README.md └── teageo └── init.go /ext/README.md: -------------------------------------------------------------------------------- 1 | Add your extensions here. -------------------------------------------------------------------------------- /teaconfigs/agents/item_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | -------------------------------------------------------------------------------- /tealogs/access_logger_test.go: -------------------------------------------------------------------------------- 1 | package tealogs 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | teaweb/actions/default/plus 2 | teaweb/plus.go -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/.gitignore: -------------------------------------------------------------------------------- 1 | themes/ 2 | public/ 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/providers/dns/transip/fixtures/private.key: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /teaevents/event_type.go: -------------------------------------------------------------------------------- 1 | package teaevents 2 | 3 | type EventType = string 4 | -------------------------------------------------------------------------------- /tealogs/accesslogs/README.md: -------------------------------------------------------------------------------- 1 | ~~~bash 2 | easyjson -all access_log.go 3 | ~~~ -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/go.opencensus.io/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_386.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_arm.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /teadb/expr.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 查询中使用的特殊表达式 4 | type Expr interface { 5 | } 6 | -------------------------------------------------------------------------------- /teamemory/README.md: -------------------------------------------------------------------------------- 1 | # Memory Grid 2 | Cache items in memory, using partitions and LRU. -------------------------------------------------------------------------------- /teawaf/action_instance.go: -------------------------------------------------------------------------------- 1 | package teawaf 2 | 3 | type Action struct { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /teaweb/actions/default/index/init.go: -------------------------------------------------------------------------------- 1 | package index 2 | 3 | func init() { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/reflect2_amd64.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_arm64.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_mips64x.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_mipsx.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/relfect2_s390x.s: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/google.golang.org/grpc/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /teacluster/const.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | const ( 4 | ClusterEnabled = true 5 | ) 6 | -------------------------------------------------------------------------------- /teaproxy/mitm/README.md: -------------------------------------------------------------------------------- 1 | The code is from: 2 | https://github.com/google/martian/blob/master/mitm/ -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/linode/linodego/managed.go: -------------------------------------------------------------------------------- 1 | package linodego 2 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/linode/linodego/profile.go: -------------------------------------------------------------------------------- 1 | package linodego 2 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/miekg/dns/AUTHORS: -------------------------------------------------------------------------------- 1 | Miek Gieben 2 | -------------------------------------------------------------------------------- /teaconfigs/agents/init.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | func init() { 4 | RegisterAllDataSources() 5 | } 6 | -------------------------------------------------------------------------------- /teaevents/locker.go: -------------------------------------------------------------------------------- 1 | package teaevents 2 | 3 | import "sync" 4 | 5 | var locker = sync.Mutex{} 6 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/board/scripts/init.go: -------------------------------------------------------------------------------- 1 | package scripts 2 | 3 | func init() { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/.gitignore: -------------------------------------------------------------------------------- 1 | .lego 2 | .gitcookies 3 | .idea 4 | .vscode/ 5 | dist/ 6 | builds/ 7 | -------------------------------------------------------------------------------- /teaevents/event_interface.go: -------------------------------------------------------------------------------- 1 | package teaevents 2 | 3 | type EventInterface interface { 4 | Type() string 5 | } 6 | -------------------------------------------------------------------------------- /teamemory/stat.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type Stat struct { 4 | TotalBytes int64 5 | CountItems int 6 | } 7 | -------------------------------------------------------------------------------- /teawaf/checkpoints/option.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | type OptionInterface interface { 4 | Type() string 5 | } 6 | -------------------------------------------------------------------------------- /teaconst/vars.go: -------------------------------------------------------------------------------- 1 | package teaconst 2 | 3 | var PlusEnabled = false 4 | var DemoEnabled = false 5 | var AgentEnabled = true 6 | -------------------------------------------------------------------------------- /teamemory/cell_stat.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type CellStat struct { 4 | TotalBytes int64 5 | CountItems int 6 | } 7 | -------------------------------------------------------------------------------- /teautils/command.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | // 命令定义 4 | type Command struct { 5 | Name string 6 | Args []string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/errors.go: -------------------------------------------------------------------------------- 1 | package jsonhooks 2 | -------------------------------------------------------------------------------- /ext/import.go: -------------------------------------------------------------------------------- 1 | package ext 2 | 3 | // import your extension packages here 4 | import ( 5 | _ "github.com/TeaWeb/code/ext/demo" 6 | ) 7 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/.dockerignore: -------------------------------------------------------------------------------- 1 | lego.exe 2 | .lego 3 | .gitcookies 4 | .idea 5 | .vscode/ 6 | dist/ 7 | builds/ 8 | docs/ 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/layouts/partials/logo.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /teadb/sql_cond.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // SQL条件 4 | type SQLCond struct { 5 | Expr string 6 | Params map[string]interface{} 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/.gitcookies.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeaWeb/code/HEAD/vendor/github.com/go-acme/lego/.gitcookies.enc -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/e2e/fixtures/csr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeaWeb/code/HEAD/vendor/github.com/go-acme/lego/e2e/fixtures/csr.raw -------------------------------------------------------------------------------- /teaweb/actions/default/agents/agentutils/item_state.go: -------------------------------------------------------------------------------- 1 | package agentutils 2 | 3 | // 监控项状态 4 | type ItemState struct { 5 | IsFailed bool // 是否已失败 6 | } 7 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/import.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | _ "github.com/TeaWeb/code/teaweb/actions/default/proxy/servergroups" 5 | ) 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeaWeb/code/HEAD/vendor/github.com/go-acme/lego/docs/static/images/logo.png -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/exoscale/egoscale/version.go: -------------------------------------------------------------------------------- 1 | package egoscale 2 | 3 | // Version of the library 4 | const Version = "0.14.0" 5 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/doc.go: -------------------------------------------------------------------------------- 1 | // Package sacloud is define models for SakuraCloud. 2 | // 3 | package sacloud 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/doc.go: -------------------------------------------------------------------------------- 1 | // Package rest defines the api services used to communicate with NS1. 2 | package rest 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/dns/doc.go: -------------------------------------------------------------------------------- 1 | // Package dns contains definitions for NS1 zones/records/answers/etc. 2 | package dns 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/filter/doc.go: -------------------------------------------------------------------------------- 1 | // Package filter contains definitions for NS1 filter chains. 2 | package filter 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/static/images/logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TeaWeb/code/HEAD/vendor/github.com/go-acme/lego/docs/static/images/logo-white.png -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/data/doc.go: -------------------------------------------------------------------------------- 1 | // Package data contains definitions for NS1 metadata/sources/feeds/etc. 2 | package data 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/monitor/doc.go: -------------------------------------------------------------------------------- 1 | // Package monitor contains definitions for NS1 monitoring jobs. 2 | package monitor 3 | -------------------------------------------------------------------------------- /teaweb/cmd/web_shell_test.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import "testing" 4 | 5 | func TestWebShell_CheckPid(t *testing.T) { 6 | shell := &WebShell{} 7 | t.Log(shell.checkPid()) 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/account/doc.go: -------------------------------------------------------------------------------- 1 | // Package account contains definitions for NS1 apikeys/teams/users/etc. 2 | package account 3 | -------------------------------------------------------------------------------- /main/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "github.com/TeaWeb/code/ext" 5 | "github.com/TeaWeb/code/teaweb" 6 | ) 7 | 8 | func main() { 9 | teaweb.Start() 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/host.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // Host さくらのクラウド ホスト(物理) 4 | type Host struct { 5 | propName // 名称 6 | } 7 | -------------------------------------------------------------------------------- /teaconfigs/mime_type_rule.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import "regexp" 4 | 5 | // mime type 6 | type MimeTypeRule struct { 7 | Value string 8 | Regexp *regexp.Regexp 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/rainycape/memcache/util_safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package memcache 4 | 5 | func stobs(s string) []byte { 6 | return []byte(s) 7 | } 8 | -------------------------------------------------------------------------------- /teautils/http_1.11.go: -------------------------------------------------------------------------------- 1 | // +build !go1.12 2 | 3 | package teautils 4 | 5 | import "net/http" 6 | 7 | // 关闭客户端连接 8 | func CloseHTTPClient(client *http.Client) { 9 | // do nothing 10 | } 11 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/board/scripts/context.go: -------------------------------------------------------------------------------- 1 | package scripts 2 | 3 | import "github.com/TeaWeb/code/teaconfigs" 4 | 5 | type Context struct { 6 | Server *teaconfigs.ServerConfig 7 | } 8 | -------------------------------------------------------------------------------- /teaconfigs/ssl_acme_dns_record.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | // ACME DNS记录 4 | type ACMEDNSRecord struct { 5 | FQDN string `yaml:"fqdn" json:"fqdn"` 6 | Value string `yaml:"value" json:"value"` 7 | } 8 | -------------------------------------------------------------------------------- /teadb/dao_base.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | type BaseDAO struct { 4 | driver DriverInterface 5 | } 6 | 7 | func (this *BaseDAO) SetDriver(driver DriverInterface) { 8 | this.driver = driver 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /teaconfigs/notices/format.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | // 内容文本格式类型定义 4 | type TextFormat = string 5 | 6 | // 常用的内容文本格式 7 | const ( 8 | FormatText = "text" 9 | FormatMarkdown = "markdown" 10 | ) 11 | -------------------------------------------------------------------------------- /teaplugins/init.go: -------------------------------------------------------------------------------- 1 | package teaplugins 2 | 3 | import ( 4 | "github.com/iwind/TeaGo" 5 | ) 6 | 7 | func init() { 8 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 9 | load() 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/content/usage/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Usage" 3 | date: 2019-03-03T16:39:46+01:00 4 | draft: false 5 | weight: 2 6 | --- 7 | 8 | {{%children style="h2" description="true" %}} 9 | -------------------------------------------------------------------------------- /teaconfigs/scheduling/candidate.go: -------------------------------------------------------------------------------- 1 | package scheduling 2 | 3 | // 候选对象接口 4 | type CandidateInterface interface { 5 | // 权重 6 | CandidateWeight() uint 7 | 8 | // 代号 9 | CandidateCodes() []string 10 | } 11 | -------------------------------------------------------------------------------- /teadb/expr_avg.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 平均值表达式 4 | type AvgExpr struct { 5 | Field string 6 | } 7 | 8 | func NewAvgExpr(field string) *AvgExpr { 9 | return &AvgExpr{ 10 | Field: field, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /teadb/expr_max.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 最大值表达式 4 | type MaxExpr struct { 5 | Field string 6 | } 7 | 8 | func NewMaxExpr(field string) *MaxExpr { 9 | return &MaxExpr{ 10 | Field: field, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /teadb/expr_min.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 最小值表达式 4 | type MinExpr struct { 5 | Field string 6 | } 7 | 8 | func NewMinExpr(field string) *MinExpr { 9 | return &MinExpr{ 10 | Field: field, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /teadb/expr_sum.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 总和表达式 4 | type SumExpr struct { 5 | Field string 6 | } 7 | 8 | func NewSumExpr(field string) *SumExpr { 9 | return &SumExpr{ 10 | Field: field, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /teautils/process_test.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/Tea" 5 | "testing" 6 | ) 7 | 8 | func TestCheckPid(t *testing.T) { 9 | t.Log(CheckPid(Tea.Root + "/bin/pid")) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/challenge/dns01/fixtures/resolv.conf.1: -------------------------------------------------------------------------------- 1 | domain company.com 2 | nameserver 10.200.3.249 3 | nameserver 10.200.3.250:5353 4 | nameserver 2001:4860:4860::8844 5 | nameserver [10.0.0.1]:5353 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package aws 4 | 5 | import "context" 6 | 7 | var ( 8 | backgroundCtx = context.Background() 9 | ) 10 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_variable.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | // 数据源变量 4 | type SourceVariable struct { 5 | Code string `yaml:"code" json:"code"` 6 | Description string `yaml:"description" json:"description"` 7 | } 8 | -------------------------------------------------------------------------------- /teaconfigs/api/api_version.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // API版本定义 4 | type APIVersion struct { 5 | Name string `yaml:"name" json:"name"` 6 | Code string `yaml:"code" json:"code"` 7 | On bool `yaml:"on" json:"on"` 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/google/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | bmatsuo 3 | shawnps 4 | theory 5 | jboverfelt 6 | dsymonds 7 | cd1 8 | wallclockbuilder 9 | dansouza 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/monitor/config.go: -------------------------------------------------------------------------------- 1 | package monitor 2 | 3 | // Config is a flat mapping where values are simple (no slices/maps). 4 | type Config map[string]interface{} 5 | -------------------------------------------------------------------------------- /teamemory/opt_compress.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type CompressOpt struct { 4 | Level int 5 | } 6 | 7 | func NewCompressOpt(level int) *CompressOpt { 8 | return &CompressOpt{ 9 | Level: level, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /teautils/http_1.12.go: -------------------------------------------------------------------------------- 1 | // +build go1.12 2 | 3 | package teautils 4 | 5 | import ( 6 | "net/http" 7 | ) 8 | 9 | // 关闭客户端连接 10 | func CloseHTTPClient(client *http.Client) { 11 | client.CloseIdleConnections() 12 | } 13 | -------------------------------------------------------------------------------- /teaweb/actions/default/notices/noticeutils/init.go: -------------------------------------------------------------------------------- 1 | package noticeutils 2 | 3 | import "github.com/iwind/TeaGo" 4 | 5 | func init() { 6 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 7 | RunTasks() 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/libsacloud.go: -------------------------------------------------------------------------------- 1 | // Package libsacloud is the SAKURA CLOUD API v1.1 Client for Go. 2 | package libsacloud 3 | 4 | // Version バージョン 5 | const Version = "1.19.0" 6 | -------------------------------------------------------------------------------- /teamemory/opt_limit_size.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type LimitSizeOpt struct { 4 | Size int64 5 | } 6 | 7 | func NewLimitSizeOpt(size int64) *LimitSizeOpt { 8 | return &LimitSizeOpt{ 9 | Size: size, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /teatesting/require_test.go: -------------------------------------------------------------------------------- 1 | package teatesting 2 | 3 | import "testing" 4 | 5 | func TestRequireServer(t *testing.T) { 6 | t.Log(RequireHTTPServer()) 7 | t.Log(RequireHTTPServer()) 8 | t.Log(RequireHTTPServer()) 9 | } 10 | -------------------------------------------------------------------------------- /tealogs/tests/mysql_storage.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `accessLogs` ( 2 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 3 | `log` text COLLATE utf8mb4_bin, 4 | PRIMARY KEY (`id`) 5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; -------------------------------------------------------------------------------- /teamemory/opt_limit_count.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type LimitCountOpt struct { 4 | Count int 5 | } 6 | 7 | func NewLimitCountOpt(count int) *LimitCountOpt { 8 | return &LimitCountOpt{ 9 | Count: count, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /teaconst/const.go: -------------------------------------------------------------------------------- 1 | package teaconst 2 | 3 | const ( 4 | TeaVersion = "0.1.12" 5 | 6 | TeaProcessName = "teaweb" // 进程名 7 | TeaProductName = "TeaWeb" // 产品名 8 | TeaProductCode = "TeaWeb" // 产品代号,会用在一些对外访问的User-Agent里面,一定要是英文 9 | ) 10 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/menu.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import "github.com/iwind/TeaGo/actions" 4 | 5 | type MenuAction actions.Action 6 | 7 | // 菜单 8 | func (this *MenuAction) Run(params struct{}) { 9 | this.Success() 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/time/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /teadb/sql_action.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // SQL动作类型 4 | type SQLAction = int 5 | 6 | // SQL动作列表 7 | const ( 8 | SQLInsert SQLAction = 1 9 | SQLSelect SQLAction = 2 10 | SQLDelete SQLAction = 3 11 | SQLUpdate SQLAction = 4 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/time/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /teaconfigs/node_test.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestNode(t *testing.T) { 8 | config := SharedNodeConfig() 9 | t.Log(config) 10 | 11 | config = SharedNodeConfig() 12 | t.Log(config) 13 | } 14 | -------------------------------------------------------------------------------- /teaconfigs/server_group_list_test.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestSharedServerGroupList(t *testing.T) { 9 | logs.PrintAsJSON(SharedServerGroupList(), t) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/Azure/azure-sdk-for-go/NOTICE: -------------------------------------------------------------------------------- 1 | Microsoft Azure-SDK-for-Go 2 | Copyright 2014-2017 Microsoft 3 | 4 | This product includes software developed at 5 | the Microsoft Corporation (https://www.microsoft.com). 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/dgrijalva/jwt-go/doc.go: -------------------------------------------------------------------------------- 1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html 2 | // 3 | // See README.md for more info. 4 | package jwt 5 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/gophercloud/gophercloud/pagination/pkg.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package pagination contains utilities and convenience structs that implement common pagination idioms within OpenStack APIs. 3 | */ 4 | package pagination 5 | -------------------------------------------------------------------------------- /teaconfigs/api/api_param.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // API参数定义 4 | type APIParam struct { 5 | Name string `yaml:"name" json:"name"` 6 | Type string `yaml:"type" json:"type"` 7 | Description string `yaml:"description" json:"description"` 8 | } 9 | -------------------------------------------------------------------------------- /teaproxy/named_server.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | import "github.com/TeaWeb/code/teaconfigs" 4 | 5 | // 域名和服务映射 6 | type NamedServer struct { 7 | Name string // 匹配后的域名 8 | Server *teaconfigs.ServerConfig // 匹配后的服务配置 9 | } 10 | -------------------------------------------------------------------------------- /teautils/map_test.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestObjectToMapJSON(t *testing.T) { 8 | var a interface{} = nil 9 | m := map[string]interface{}{} 10 | t.Log(ObjectToMapJSON(a, &m)) 11 | t.Log(m) 12 | } 13 | -------------------------------------------------------------------------------- /teaweb/cmd/web_shell_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package cmd 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | // 启动服务模式 10 | func (this *WebShell) ExecService(writer io.Writer) bool { 11 | // do nothing beyond windows 12 | return true 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /teadb/table_stat.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // 表格统计 4 | type TableStat struct { 5 | Count int64 `yaml:"count" json:"count"` 6 | Size int64 `yaml:"size" json:"size"` 7 | FormattedSize string `yaml:"formattedSize" json:"formattedSize"` 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/session_credential.go: -------------------------------------------------------------------------------- 1 | package signers 2 | 3 | type SessionCredential struct { 4 | AccessKeyId string 5 | AccessKeySecret string 6 | StsToken string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/dnsimple/dnsimple-go/dnsimple/users.go: -------------------------------------------------------------------------------- 1 | package dnsimple 2 | 3 | // User represents a DNSimple user. 4 | type User struct { 5 | ID int64 `json:"id,omitempty"` 6 | Email string `json:"email,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/go_below_17.go: -------------------------------------------------------------------------------- 1 | //+build !go1.7 2 | 3 | package reflect2 4 | 5 | import "unsafe" 6 | 7 | func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer { 8 | return nil 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine gopherjs 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return true 11 | } 12 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_category.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | // 数据源分类 4 | type SourceCategory = string 5 | 6 | const ( 7 | SourceCategoryBasic = "basic" // 基础 8 | SourceCategoryCommon = "common" // 常用 9 | SourceCategoryPlugin = "plugin" // 插件 10 | ) 11 | -------------------------------------------------------------------------------- /teautils/rlimit_others.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!darwin 2 | 3 | package teautils 4 | 5 | // set resource limit 6 | func SetRLimit(limit uint64) error { 7 | return nil 8 | } 9 | 10 | // set best resource limit value 11 | func SetSuitableRLimit() { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/mongo/data.go: -------------------------------------------------------------------------------- 1 | package mongo 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | ) 6 | 7 | type DataAction actions.Action 8 | 9 | // 数据清理 10 | func (this *DataAction) Run(params struct{}) { 11 | this.Show() 12 | } 13 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/mysql/data.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | ) 6 | 7 | type DataAction actions.Action 8 | 9 | // 数据清理 10 | func (this *DataAction) Run(params struct{}) { 11 | this.Show() 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/miekg/dns/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alex A. Skinner 2 | Andrew Tunnell-Jones 3 | Ask Bjørn Hansen 4 | Dave Cheney 5 | Dusty Wilson 6 | Marek Majkowski 7 | Peter van Dijk 8 | Omri Bahumi 9 | Alex Sergeyev 10 | James Hartig 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/rainycape/memcache/util_unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package memcache 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | func stobs(s string) []byte { 10 | return *(*[]byte)(unsafe.Pointer(&s)) 11 | } 12 | -------------------------------------------------------------------------------- /teacluster/action_interface.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | type ActionInterface interface { 4 | Name() string 5 | Execute() error 6 | OnSuccess(success *SuccessAction) error 7 | OnFail(fail *FailAction) error 8 | TypeId() int8 9 | BaseAction() *Action 10 | } 11 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_utils_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import "testing" 4 | 5 | func TestConvertSourceToMap(t *testing.T) { 6 | source := NewDNSSource() 7 | source.Type = "A" 8 | source.Domain = "teaos.cn" 9 | t.Log(ConvertSourceToMap(source)) 10 | } 11 | -------------------------------------------------------------------------------- /teamemory/opt_recycle_interval.go: -------------------------------------------------------------------------------- 1 | package teamemory 2 | 3 | type RecycleIntervalOpt struct { 4 | Interval int 5 | } 6 | 7 | func NewRecycleIntervalOpt(interval int) *RecycleIntervalOpt { 8 | return &RecycleIntervalOpt{ 9 | Interval: interval, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /teautils/file.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/Tea" 5 | "path/filepath" 6 | ) 7 | 8 | // 临时文件 9 | func TmpFile(path string) string { 10 | return filepath.Clean(Tea.Root + Tea.DS + "web" + Tea.DS + "tmp" + Tea.DS + path) 11 | } 12 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/postgres/data.go: -------------------------------------------------------------------------------- 1 | package postgres 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | ) 6 | 7 | type DataAction actions.Action 8 | 9 | // 数据清理 10 | func (this *DataAction) Run(params struct{}) { 11 | this.Show() 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/exoscale/egoscale/AUTHORS: -------------------------------------------------------------------------------- 1 | Pierre-Yves Ritschard 2 | Vincent Bernat 3 | Chris Baumbauer 4 | Marc-Aurèle Brothier 5 | Sebastien Goasguen 6 | Yoan Blanc 7 | Stefano Marengo 8 | Pierre-Emmanuel Jacquier 9 | Fabrizio Steiner 10 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/proxyutils/stat_test.go: -------------------------------------------------------------------------------- 1 | package proxyutils 2 | 3 | import "testing" 4 | 5 | func TestCheckChartChanges(t *testing.T) { 6 | t.Log(CheckChartChanges()) 7 | } 8 | 9 | func TestApplyChartChanges(t *testing.T) { 10 | t.Log(ApplyChartChanges()) 11 | } -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/go_above_17.go: -------------------------------------------------------------------------------- 1 | //+build go1.7 2 | 3 | package reflect2 4 | 5 | import "unsafe" 6 | 7 | //go:linkname resolveTypeOff reflect.resolveTypeOff 8 | func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer 9 | -------------------------------------------------------------------------------- /teaconfigs/backend_ftp.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | // backend 4 | type FTPBackendConfig struct { 5 | Username string `yaml:"username" json:"username"` // 用户名 6 | Password string `yaml:"password" json:"password"` // 密码 7 | Dir string `yaml:"dir" json:"dir"` // 目录 8 | } 9 | -------------------------------------------------------------------------------- /teaconfigs/forward_http.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | // 正向代理设置 4 | type ForwardHTTPConfig struct { 5 | EnableMITM bool `yaml:"enableMITM" json:"enableMITM"` 6 | } 7 | 8 | // 获取新对象 9 | func NewForwardHTTPConfig() *ForwardHTTPConfig { 10 | return &ForwardHTTPConfig{} 11 | } 12 | -------------------------------------------------------------------------------- /teaproxy/http_client_pool_test.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | import ( 4 | "sync" 5 | "testing" 6 | ) 7 | 8 | func BenchmarkClientLock(b *testing.B) { 9 | locker := sync.RWMutex{} 10 | for i := 0; i < b.N; i++ { 11 | locker.RLock() 12 | locker.RUnlock() 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /teawaf/requests/response.go: -------------------------------------------------------------------------------- 1 | package requests 2 | 3 | import "net/http" 4 | 5 | type Response struct { 6 | *http.Response 7 | 8 | BodyData []byte 9 | } 10 | 11 | func NewResponse(resp *http.Response) *Response { 12 | return &Response{ 13 | Response: resp, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | // WithUnsignedPayload will enable and set the UnsignedPayload field to 4 | // true of the signer. 5 | func WithUnsignedPayload(v4 *Signer) { 6 | v4.UnsignedPayload = true 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go: -------------------------------------------------------------------------------- 1 | package tokens 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func tokenURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("auth", "tokens") 7 | } 8 | -------------------------------------------------------------------------------- /teacluster/action_fail.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | type FailAction struct { 4 | Action 5 | 6 | Message string 7 | } 8 | 9 | func (this *FailAction) Name() string { 10 | return "fail" 11 | } 12 | 13 | func (this *FailAction) TypeId() int8 { 14 | return ActionCodeFail 15 | } 16 | -------------------------------------------------------------------------------- /teawaf/action_definition.go: -------------------------------------------------------------------------------- 1 | package teawaf 2 | 3 | import "reflect" 4 | 5 | // action definition 6 | type ActionDefinition struct { 7 | Name string 8 | Code ActionString 9 | Description string 10 | Instance ActionInterface 11 | Type reflect.Type 12 | } 13 | -------------------------------------------------------------------------------- /teadb/shared/index_field.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | // 索引字段定义 4 | type IndexField struct { 5 | Name string 6 | Asc bool 7 | } 8 | 9 | // 创建新索引定义 10 | func NewIndexField(name string, asc bool) *IndexField { 11 | return &IndexField{ 12 | Name: name, 13 | Asc: asc, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /teautils/panic.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "runtime/debug" 6 | ) 7 | 8 | // 记录panic日志 9 | func Recover() { 10 | p := recover() 11 | if p != nil { 12 | logs.Println("panic:", p) 13 | logs.Println(string(debug.Stack())) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/index.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | ) 6 | 7 | type IndexAction actions.Action 8 | 9 | // 所有Apps 10 | func (this *IndexAction) Run(params struct{}) { 11 | this.RedirectURL("/agents/board?agentId=local") 12 | } 13 | -------------------------------------------------------------------------------- /teacache/init.go: -------------------------------------------------------------------------------- 1 | package teacache 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaproxy" 5 | ) 6 | 7 | func init() { 8 | hook := &teaproxy.RequestHook{ 9 | BeforeRequest: ProcessBeforeRequest, 10 | AfterRequest: ProcessAfterRequest, 11 | } 12 | teaproxy.AddRequestHook(hook) 13 | } 14 | -------------------------------------------------------------------------------- /teaconfigs/db/mysql_test.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestLoadMySQLConfig(t *testing.T) { 9 | config, err := LoadMySQLConfig() 10 | if err != nil { 11 | t.Fatal(err) 12 | } 13 | logs.PrintAsJSON(config, t) 14 | } 15 | -------------------------------------------------------------------------------- /teawaf/checkpoints/checkpoint_definition.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | // check point definition 4 | type CheckpointDefinition struct { 5 | Name string 6 | Description string 7 | Prefix string 8 | HasParams bool // has sub params 9 | Instance CheckpointInterface 10 | } 11 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/certs/certutils/acme_test.go: -------------------------------------------------------------------------------- 1 | package certutils 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "testing" 6 | ) 7 | 8 | func TestRenewACMECerts(t *testing.T) { 9 | if teatesting.IsGlobal() { 10 | return 11 | } 12 | 13 | RenewACMECerts() 14 | } 15 | -------------------------------------------------------------------------------- /teastats/counter_value.go: -------------------------------------------------------------------------------- 1 | package teastats 2 | 3 | // 数值增长型的统计值 4 | type CounterValue struct { 5 | Timestamp int64 `json:"timestamp"` // 时间戳 6 | Params map[string]string `json:"params"` // 参数,用来区分单个统计项内的不同的项目 7 | Value map[string]interface{} `json:"value"` // 数值 8 | } 9 | -------------------------------------------------------------------------------- /teacluster/manager_test.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | import "testing" 4 | 5 | func TestManager_Start(t *testing.T) { 6 | err := SharedManager.Start() 7 | if err != nil { 8 | t.Fatal(err) 9 | } 10 | } 11 | 12 | func TestManager_PullItems(t *testing.T) { 13 | SharedManager.PullItems() 14 | } 15 | -------------------------------------------------------------------------------- /teaconfigs/db/postgres_test.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestLoadPostgresConfig(t *testing.T) { 9 | config, err := LoadPostgresConfig() 10 | if err != nil { 11 | t.Fatal(err) 12 | } 13 | logs.PrintAsJSON(config, t) 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/dashboard/index.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | ) 6 | 7 | type IndexAction actions.Action 8 | 9 | // 仪表板 10 | func (this *IndexAction) Run(params struct{}) { 11 | this.Data["teaMenu"] = "dashboard" 12 | this.Show() 13 | } 14 | 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/notices/noticeutils/task_test.go: -------------------------------------------------------------------------------- 1 | package noticeutils 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/notices" 5 | "testing" 6 | ) 7 | 8 | func TestAddTask(t *testing.T) { 9 | AddTask(notices.NoticeLevelWarning, []*notices.NoticeReceiver{}, "subject", "message") 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/member.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // Member 会員情報 4 | type Member struct { 5 | Class string `json:",omitempty"` // クラス 6 | Code string `json:",omitempty"` // 会員コード 7 | 8 | // Errors [unknown type] `json:",omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_cpu.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propCPU CPUコア数内包型 4 | type propCPU struct { 5 | CPU int `json:",omitempty"` // CPUコア数 6 | } 7 | 8 | // GetCPU CPUコア数 取得 9 | func (p *propCPU) GetCPU() int { 10 | return p.CPU 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 重大提示: 我们已经使用go mod重新构建了项目结构,在v0.2.0以后请使用 [https://github.com/TeaWeb/build](https://github.com/TeaWeb/build) 源码代替! 2 | 3 | 这里是TeaWeb Go源码,以下是一些有用的链接: 4 | * [构建自己的二进制版本](http://teaos.cn/doc/main/Build.md) 5 | * [可以直接使用的二进制版本](http://teaos.cn/download) 6 | * [实现自己的插件](http://teaos.cn/doc/plugins/Write.md) 7 | -------------------------------------------------------------------------------- /teacluster/action_ping.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | // node -> cluster 4 | type PingAction struct { 5 | Action 6 | 7 | Version int64 8 | } 9 | 10 | func (this *PingAction) Name() string { 11 | return "ping" 12 | } 13 | 14 | func (this *PingAction) TypeId() int8 { 15 | return ActionCodePing 16 | } 17 | -------------------------------------------------------------------------------- /teautils/ticker_utils.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import "time" 4 | 5 | // 定时运行某个函数 6 | func Every(duration time.Duration, f func(ticker *Ticker)) *Ticker { 7 | ticker := NewTicker(duration) 8 | go func() { 9 | for ticker.Next() { 10 | f(ticker) 11 | } 12 | }() 13 | 14 | return ticker 15 | } 16 | -------------------------------------------------------------------------------- /teawaf/action_log.go: -------------------------------------------------------------------------------- 1 | package teawaf 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | ) 7 | 8 | type LogAction struct { 9 | } 10 | 11 | func (this *LogAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) { 12 | return true 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/e2e/fixtures/certs/localhost/README.md: -------------------------------------------------------------------------------- 1 | # certs/localhost 2 | 3 | This directory contains an end-entity (leaf) certificate (`cert.pem`) and 4 | a private key (`key.pem`) for the Pebble HTTPS server. It includes `127.0.0.1` 5 | as an IP address SAN, and `[localhost, pebble]` as DNS SANs. 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/e2e/fixtures/pebble-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "pebble": { 3 | "listenAddress": "0.0.0.0:14000", 4 | "certificate": "fixtures/certs/localhost/cert.pem", 5 | "privateKey": "fixtures/certs/localhost/key.pem", 6 | "httpPort": 5002, 7 | "tlsPort": 5001 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /teatesting/utils.go: -------------------------------------------------------------------------------- 1 | package teatesting 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | ) 7 | 8 | // 是否是全局测试:go test ./... 9 | func IsGlobal() bool { 10 | if len(os.Args) == 0 { 11 | return false 12 | } 13 | return strings.HasSuffix(os.Args[0], ".test") || strings.HasSuffix(os.Args[0], ".test.exe") 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/install/index.go: -------------------------------------------------------------------------------- 1 | package install 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | "runtime" 6 | ) 7 | 8 | type IndexAction actions.Action 9 | 10 | // 安装 11 | func (this *IndexAction) RunGet(params struct { 12 | }) { 13 | this.Data["os"] = runtime.GOOS 14 | this.Show() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/e2e/fixtures/pebble-config-dns.json: -------------------------------------------------------------------------------- 1 | { 2 | "pebble": { 3 | "listenAddress": "0.0.0.0:15000", 4 | "certificate": "fixtures/certs/localhost/cert.pem", 5 | "privateKey": "fixtures/certs/localhost/key.pem", 6 | "httpPort": 5004, 7 | "tlsPort": 5003 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine,!gopherjs 3 | 4 | package logrus 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | const ioctlReadTermios = unix.TIOCGETA 9 | 10 | type Termios unix.Termios 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/account.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // Account さくらのクラウド アカウント 4 | type Account struct { 5 | *Resource 6 | propName // 名称 7 | Class string `json:",omitempty"` // リソースクラス 8 | Code string `json:",omitempty"` // アカウントコード 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_class.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propClass クラス内包型 4 | type propClass struct { 5 | Class string `json:",omitempty"` // サービスクラス 6 | } 7 | 8 | // GetClass クラス 取得 9 | func (p *propClass) GetClass() string { 10 | return p.Class 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/log/helper.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | "net/http" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 12 | if action.Request.Method != http.MethodGet { 13 | return 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go: -------------------------------------------------------------------------------- 1 | // +build appengine plan9 2 | 3 | package request 4 | 5 | import ( 6 | "strings" 7 | ) 8 | 9 | func isErrConnectionReset(err error) bool { 10 | return strings.Contains(err.Error(), "connection reset") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.15.23" 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/internal/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 internal contains support packages for oauth2 package. 6 | package internal 7 | -------------------------------------------------------------------------------- /teautils/match_test.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/assert" 5 | "testing" 6 | ) 7 | 8 | func TestMatchKeyword(t *testing.T) { 9 | a := assert.NewAssertion(t) 10 | a.IsTrue(MatchKeyword("a b c", "a")) 11 | a.IsFalse(MatchKeyword("a b c", "")) 12 | a.IsTrue(MatchKeyword("abc", "BC")) 13 | } 14 | -------------------------------------------------------------------------------- /teawaf/action_allow.go: -------------------------------------------------------------------------------- 1 | package teawaf 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | ) 7 | 8 | type AllowAction struct { 9 | } 10 | 11 | func (this *AllowAction) Perform(waf *WAF, request *requests.Request, writer http.ResponseWriter) (allow bool) { 12 | // do nothing 13 | return true 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/account/team.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | // Team wraps an NS1 /accounts/teams resource 4 | type Team struct { 5 | ID string `json:"id,omitempty"` 6 | Name string `json:"name"` 7 | Permissions PermissionsMap `json:"permissions"` 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/cmd/cmd.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import "github.com/urfave/cli" 4 | 5 | // CreateCommands Creates all CLI commands 6 | func CreateCommands() []cli.Command { 7 | return []cli.Command{ 8 | createRun(), 9 | createRevoke(), 10 | createRenew(), 11 | createDNSHelp(), 12 | createList(), 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_storage.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propStorage ストーレジ内包型 4 | type propStorage struct { 5 | Storage *Storage `json:",omitempty"` // ストレージ 6 | } 7 | 8 | // GetStorage ストレージ 取得 9 | func (p *propStorage) GetStorage() *Storage { 10 | return p.Storage 11 | } 12 | -------------------------------------------------------------------------------- /ext/demo/init.go: -------------------------------------------------------------------------------- 1 | package demo 2 | 3 | // init the extension 4 | func init() { 5 | // add request hook 6 | /**teaproxy.AddRequestHook(&teaproxy.RequestHook{ 7 | BeforeRequest: func(req *teaproxy.Request, writer *teaproxy.ResponseWriter) (goNext bool) { 8 | writer.WriteString("hello") 9 | return false 10 | }, 11 | })**/ 12 | } 13 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_date_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestDateSource_Execute(t *testing.T) { 9 | source := NewDateSource() 10 | value, err := source.Execute(nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | logs.PrintAsJSON(value, t) 15 | } 16 | -------------------------------------------------------------------------------- /teaconfigs/forms/presentation.go: -------------------------------------------------------------------------------- 1 | package forms 2 | 3 | // 界面显示信息 4 | type Presentation struct { 5 | HTML string `yaml:"html" json:"html"` 6 | CSS string `yaml:"css" json:"css"` 7 | Javascript string `yaml:"javascript" json:"javascript"` 8 | } 9 | 10 | func NewPresentation() *Presentation { 11 | return &Presentation{} 12 | } 13 | -------------------------------------------------------------------------------- /teadb/shared/id.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import "go.mongodb.org/mongo-driver/bson/primitive" 4 | 5 | type ObjectId = primitive.ObjectID 6 | 7 | func NewObjectId() primitive.ObjectID { 8 | return primitive.NewObjectID() 9 | } 10 | 11 | func ObjectIdFromHex(hex string) (ObjectId, error) { 12 | return primitive.ObjectIDFromHex(hex) 13 | } 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/apps/helper.go: -------------------------------------------------------------------------------- 1 | package apps 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action actions.ActionWrapper) { 12 | agentutils.AddTabbar(action) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/delete_cache_result.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // DeleteCacheResult ウェブアクセラレータ キャッシュ削除APIレスポンス 4 | type DeleteCacheResult struct { 5 | URL string `json:",omitempty"` // URL 6 | Status int `json:",omitempty"` // ステータス 7 | Result string `json:",omitempty"` // 結果 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /teadb/driver_sql_interface.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | // SQL相关接口 4 | type SQLDriverInterface interface { 5 | // 创建表格 6 | CreateTable(table string, definitionSQL string) error 7 | 8 | // 修改多条记录 9 | UpdateOnes(query *Query, values map[string]interface{}) error 10 | 11 | // 读取JSON字段 12 | JSONExtract(field string, path string) string 13 | } 14 | -------------------------------------------------------------------------------- /teautils/file_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package teautils 4 | 5 | import ( 6 | "errors" 7 | "os" 8 | ) 9 | 10 | // lock file 11 | func LockFile(fp *os.File) error { 12 | return errors.New("not implemented on windows") 13 | } 14 | 15 | func UnlockFile(fp *os.File) error { 16 | return errors.New("not implemented on windows") 17 | } 18 | -------------------------------------------------------------------------------- /teautils/service_test.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconst" 5 | "testing" 6 | ) 7 | 8 | func TestServiceManager_Log(t *testing.T) { 9 | manager := NewServiceManager(teaconst.TeaProductName, teaconst.TeaProductName+" Server") 10 | manager.Log("Hello, World") 11 | manager.LogError("Hello, World") 12 | } 13 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/board/helper.go: -------------------------------------------------------------------------------- 1 | package apps 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action actions.ActionWrapper) { 12 | agentutils.AddTabbar(action) 13 | } 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/backup/backup.go: -------------------------------------------------------------------------------- 1 | package backup 2 | 3 | import "github.com/iwind/TeaGo/actions" 4 | 5 | type BackupAction actions.Action 6 | 7 | // 立即备份 8 | func (this *BackupAction) Run(params struct{}) { 9 | err := backupTask() 10 | if err != nil { 11 | this.Fail("备份失败:" + err.Error()) 12 | } 13 | this.Success() 14 | } 15 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_memory_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestMemorySource_Execute(t *testing.T) { 9 | source := NewMemorySource() 10 | value, err := source.Execute(nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | 15 | logs.PrintAsJSON(value, t) 16 | } 17 | -------------------------------------------------------------------------------- /teaconfigs/shared/var.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | // 变量 4 | type Variable struct { 5 | Name string `yaml:"name" json:"name"` // 变量名 6 | Value string `yaml:"value" json:"value"` // 变量值 7 | } 8 | 9 | // 创建新变量 10 | func NewVariable(name string, value string) *Variable { 11 | return &Variable{ 12 | Name: name, 13 | Value: value, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /teageo/init.go: -------------------------------------------------------------------------------- 1 | package teageo 2 | 3 | import ( 4 | "github.com/iwind/TeaGo" 5 | "github.com/iwind/TeaGo/logs" 6 | "github.com/oschwald/geoip2-golang" 7 | ) 8 | 9 | var DB *geoip2.Reader = nil 10 | 11 | func init() { 12 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 13 | logs.Println("[proxy]start geo db") 14 | SetupDB() 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/cluster/helper.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action actions.ActionWrapper) { 12 | agentutils.AddTabbar(action) 13 | } 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/notices/helper.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action actions.ActionWrapper) { 12 | agentutils.AddTabbar(action) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x12b 9 | sysSENDMMSG = 0x133 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x16d 9 | sysSENDMMSG = 0x176 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0xf3 9 | sysSENDMMSG = 0x10d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/language/go1_2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | var sortStable = sort.Stable 12 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_processes_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestProcessesSource_Execute(t *testing.T) { 9 | source := NewProcessesSource() 10 | value, err := source.Execute(nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | logs.PrintAsJSON(value, t) 15 | } 16 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/settings/index.go: -------------------------------------------------------------------------------- 1 | package settings 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type IndexAction actions.Action 9 | 10 | func (this *IndexAction) RunGet(params struct{}) { 11 | this.Data["setting"] = teaconfigs.LoadProxySetting() 12 | 13 | this.Show() 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/status.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type StatusAction actions.Action 9 | 10 | func (this *StatusAction) Run() { 11 | this.Data["changed"] = proxyutils.ProxyIsChanged() 12 | this.Success() 13 | } 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/cluster/connect.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teacluster" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type ConnectAction actions.Action 9 | 10 | // 连接到集群 11 | func (this *ConnectAction) RunPost(params struct{}) { 12 | teacluster.SharedManager.Restart() 13 | this.Success() 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/concurrent/go_above_19.go: -------------------------------------------------------------------------------- 1 | //+build go1.9 2 | 3 | package concurrent 4 | 5 | import "sync" 6 | 7 | // Map is a wrapper for sync.Map introduced in go1.9 8 | type Map struct { 9 | sync.Map 10 | } 11 | 12 | // NewMap creates a thread safe Map 13 | func NewMap() *Map { 14 | return &Map{} 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_connections_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestConnectionsSource_Execute(t *testing.T) { 9 | source := NewConnectionsSource() 10 | value, err := source.Execute(nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | logs.PrintAsJSON(value, t) 15 | } 16 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import "testing" 4 | 5 | func TestFindDataSourceInstance(t *testing.T) { 6 | t.Logf("%p", FindDataSourceInstance("file", map[string]interface{}{})) 7 | t.Logf("%p", FindDataSourceInstance("file", map[string]interface{}{})) 8 | t.Logf("%p", FindDataSourceInstance("file", map[string]interface{}{})) 9 | } 10 | -------------------------------------------------------------------------------- /teaconfigs/widgets/line.go: -------------------------------------------------------------------------------- 1 | package widgets 2 | 3 | // 线定义 4 | type Line struct { 5 | Param string `yaml:"param" json:"param"` 6 | IsFilled bool `yaml:"isFilled" json:"isFilled"` 7 | Color string `yaml:"color" json:"color"` 8 | Name string `yaml:"name" json:"name"` 9 | } 10 | 11 | // 获取新对象 12 | func NewLine() *Line { 13 | return &Line{} 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/helper.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | // 筛选Action调用之前 12 | func (this *Helper) BeforeAction(action actions.ActionWrapper) { 13 | agentutils.AddTabbar(action) 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/logout/index.go: -------------------------------------------------------------------------------- 1 | package logout 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | ) 7 | 8 | type IndexAction actions.Action 9 | 10 | func (this *IndexAction) Run(params struct { 11 | Auth *helpers.UserShouldAuth 12 | }) { 13 | params.Auth.Logout() 14 | this.RedirectURL("/") 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/providers/dns/gcloud/fixtures/gce_account_service_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_id": "A", 3 | "type": "service_account", 4 | "client_email": "foo@bar.com", 5 | "private_key_id": "pki", 6 | "private_key": "pk", 7 | "token_uri": "/token", 8 | "client_secret": "secret", 9 | "client_id": "C", 10 | "refresh_token": "D" 11 | } -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/objx/security.go: -------------------------------------------------------------------------------- 1 | package objx 2 | 3 | import ( 4 | "crypto/sha1" 5 | "encoding/hex" 6 | ) 7 | 8 | // HashWithKey hashes the specified string using the security key 9 | func HashWithKey(data, key string) string { 10 | d := sha1.Sum([]byte(data + ":" + key)) 11 | return hex.EncodeToString(d[:]) 12 | } 13 | -------------------------------------------------------------------------------- /teaproxy/ftp_response_body.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | import "io" 4 | 5 | // FTP响应内容 6 | type FTPResponseBody struct { 7 | io.ReadCloser 8 | callback func() // 关闭时回调 9 | } 10 | 11 | // 关闭 12 | func (this *FTPResponseBody) Close() error { 13 | err := this.ReadCloser.Close() 14 | if this.callback != nil { 15 | this.callback() 16 | } 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/agentutils/agent_event.go: -------------------------------------------------------------------------------- 1 | package agentutils 2 | 3 | // Agent事件 4 | type AgentEvent struct { 5 | Name string `json:"name"` 6 | Data interface{} `json:"data"` 7 | } 8 | 9 | // 获取新对象 10 | func NewAgentEvent(name string, data interface{}) *AgentEvent { 11 | return &AgentEvent{ 12 | Name: name, 13 | Data: data, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/linode/linodego/util.go: -------------------------------------------------------------------------------- 1 | package linodego 2 | 3 | import "time" 4 | 5 | const ( 6 | dateLayout = "2006-01-02T15:04:05" 7 | ) 8 | 9 | func parseDates(dateStr string) (*time.Time, error) { 10 | d, err := time.Parse(dateLayout, dateStr) 11 | if err != nil { 12 | return nil, err 13 | } 14 | return &d, nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/product_internet.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // ProductInternet ルータープラン 4 | type ProductInternet struct { 5 | *Resource // ID 6 | propName // 名称 7 | propAvailability // 有功状態 8 | propServiceClass // サービスクラス 9 | 10 | BandWidthMbps int `json:",omitempty"` // 帯域幅 11 | 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_assigned_cpu.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propAssignedCPU CPUコア数内包型 4 | type propAssignedCPU struct { 5 | AssignedCPU int `json:",omitempty"` // CPUコア数 6 | } 7 | 8 | // GetAssignedCPU CPUコア数 取得 9 | func (p *propAssignedCPU) GetAssignedCPU() int { 10 | return p.AssignedCPU 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_host_name.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propHostName ホスト名内包型 4 | type propHostName struct { 5 | HostName string `json:",omitempty"` // ホスト名 (ディスクの修正実施時に指定した初期ホスト名) 6 | } 7 | 8 | // GetHostName (初期)ホスト名 取得 9 | func (p *propHostName) GetHostName() string { 10 | return p.HostName 11 | } 12 | -------------------------------------------------------------------------------- /teacluster/action_success.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | import "github.com/iwind/TeaGo/maps" 4 | 5 | type SuccessAction struct { 6 | Action 7 | 8 | Message string 9 | Data maps.Map 10 | } 11 | 12 | func (this *SuccessAction) Name() string { 13 | return "success" 14 | } 15 | 16 | func (this *SuccessAction) TypeId() int8 { 17 | return ActionCodeSuccess 18 | } 19 | -------------------------------------------------------------------------------- /teaconfigs/db/db_test.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import "testing" 4 | 5 | func TestSharedDBConfig(t *testing.T) { 6 | config := SharedDBConfig() 7 | t.Log(config.Type) 8 | } 9 | 10 | func TestDBConfig_Save(t *testing.T) { 11 | config := SharedDBConfig() 12 | config.Type = DBTypeMongo 13 | err := config.Save() 14 | if err != nil { 15 | t.Fatal(err) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /teaproxy/http_serve_mux.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | // 自定义ServeMux 8 | type HTTPServeMux struct { 9 | http.ServeMux 10 | } 11 | 12 | func (this *HTTPServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { 13 | // 解决因为URL中包含多个/而自动跳转的问题 14 | r.URL.Path = CleanPath(r.URL.Path) 15 | 16 | this.ServeMux.ServeHTTP(w, r) 17 | } 18 | -------------------------------------------------------------------------------- /teautils/file_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package teautils 4 | 5 | import ( 6 | "os" 7 | "syscall" 8 | ) 9 | 10 | // lock file 11 | func LockFile(fp *os.File) error { 12 | return syscall.Flock(int(fp.Fd()), syscall.LOCK_EX|syscall.LOCK_NB) 13 | } 14 | 15 | func UnlockFile(fp *os.File) error { 16 | return syscall.Flock(int(fp.Fd()), syscall.LOCK_UN) 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/actions/default/ui/init.go: -------------------------------------------------------------------------------- 1 | package ui 2 | 3 | import ( 4 | "github.com/iwind/TeaGo" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | server. 11 | Prefix("/ui"). 12 | Helper(new(actions.Gzip)). 13 | Get("/components.js", new(ComponentsAction)). 14 | EndAll() 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /main/pprof.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb" 5 | "github.com/iwind/TeaGo/logs" 6 | "net/http" 7 | _ "net/http/pprof" 8 | ) 9 | 10 | func main() { 11 | go func() { 12 | err := http.ListenAndServe("127.0.0.1:6060", nil) 13 | if err != nil { 14 | logs.Println("[error]" + err.Error()) 15 | } 16 | }() 17 | teaweb.Start() 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/data/region.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | // Region is a metadata table with a name/key. 4 | // Can be thought of as metadata groupings. 5 | type Region struct { 6 | Meta Meta `json:"meta,omitempty"` 7 | } 8 | 9 | // Regions is simply a mapping of Regions inside a record. 10 | type Regions map[string]Region 11 | -------------------------------------------------------------------------------- /teacluster/action_utils_test.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | import "testing" 4 | 5 | func TestRegisterActionType(t *testing.T) { 6 | a := FindActionInstance(1) 7 | t.Log(a) 8 | t.Log(a.BaseAction()) 9 | a.BaseAction().RequestId = 123 10 | t.Log(a) 11 | } 12 | 13 | func TestGenerateActionId(t *testing.T) { 14 | t.Log(GenerateActionId()) 15 | t.Log(GenerateActionId()) 16 | } 17 | -------------------------------------------------------------------------------- /teaconfigs/scheduling.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import "github.com/iwind/TeaGo/maps" 4 | 5 | // 调度算法配置 6 | type SchedulingConfig struct { 7 | Code string `yaml:"code" json:"code"` // 类型 8 | Options maps.Map `yaml:"options" json:"options"` // 选项 9 | } 10 | 11 | // 获取新对象 12 | func NewSchedulingConfig() *SchedulingConfig { 13 | return &SchedulingConfig{} 14 | } 15 | -------------------------------------------------------------------------------- /teaproxy/tunnel_response_body.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // Tunnel响应包装,主要是为了覆盖Close()方法 9 | type TunnelResponseBody struct { 10 | io.ReadCloser 11 | locker *sync.Mutex 12 | } 13 | 14 | // 关闭 15 | func (this *TunnelResponseBody) Close() error { 16 | err := this.ReadCloser.Close() 17 | this.locker.Unlock() 18 | return err 19 | } 20 | -------------------------------------------------------------------------------- /teautils/service_others.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!windows 2 | 3 | package teautils 4 | 5 | // 安装服务 6 | func (this *ServiceManager) Install(exePath string, args []string) error { 7 | return nil 8 | } 9 | 10 | // 启动服务 11 | func (this *ServiceManager) Start() error { 12 | return nil 13 | } 14 | 15 | // 删除服务 16 | func (this *ServiceManager) Uninstall() error { 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/search/init.go: -------------------------------------------------------------------------------- 1 | package search 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/helpers" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | server. 11 | Prefix("/search"). 12 | Helper(new(helpers.UserMustAuth)). 13 | GetPost("", new(IndexAction)). 14 | EndAll() 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package sdkio 4 | 5 | // Copy of Go 1.7 io package's Seeker constants. 6 | const ( 7 | SeekStart = 0 // seek relative to the origin of the file 8 | SeekCurrent = 1 // seek relative to the current offset 9 | SeekEnd = 2 // seek relative to the end 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/go_below_19.go: -------------------------------------------------------------------------------- 1 | //+build !go1.9 2 | 3 | package reflect2 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | //go:linkname makemap reflect.makemap 10 | func makemap(rtype unsafe.Pointer) (m unsafe.Pointer) 11 | 12 | func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { 13 | return makemap(rtype) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_service_class.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propServiceClass サービスクラス内包型 4 | type propServiceClass struct { 5 | ServiceClass string `json:",omitempty"` // サービスクラス 6 | } 7 | 8 | // GetServiceClass サービスクラス 取得 9 | func (p *propServiceClass) GetServiceClass() string { 10 | return p.ServiceClass 11 | } 12 | -------------------------------------------------------------------------------- /teaconfigs/api/api_request_limit.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import "time" 4 | 5 | // api请求数限制 6 | type APIRequestLimit struct { 7 | Count uint `yaml:"count" json:"count"` // 请求数 TODO 8 | Duration string `yaml:"duration" json:"duration"` // 请求限制间隔 TODO 9 | 10 | duration time.Duration 11 | } 12 | 13 | func (this *APIRequestLimit) Validate() error { 14 | return nil 15 | } 16 | -------------------------------------------------------------------------------- /teaevents/event_reload.go: -------------------------------------------------------------------------------- 1 | package teaevents 2 | 3 | const ( 4 | EventTypeReload EventType = "EventTypeReload" // reload system 5 | ) 6 | 7 | var reloadEvent = new(ReloadEvent) 8 | 9 | type ReloadEvent struct { 10 | } 11 | 12 | func NewReloadEvent() *ReloadEvent { 13 | return reloadEvent 14 | } 15 | 16 | func (this *ReloadEvent) Type() string { 17 | return EventTypeReload 18 | } 19 | -------------------------------------------------------------------------------- /tealogs/init.go: -------------------------------------------------------------------------------- 1 | package tealogs 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaevents" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | accessLogger = NewAccessLogger() 11 | 12 | teaevents.On(teaevents.EventTypeReload, func(event teaevents.EventInterface) { 13 | ResetAllPolicies() 14 | }) 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /tealogs/storage_types.go: -------------------------------------------------------------------------------- 1 | package tealogs 2 | 3 | // 存储引擎类型 4 | type StorageType = string 5 | 6 | const ( 7 | StorageTypeFile StorageType = "file" 8 | StorageTypeES StorageType = "es" 9 | StorageTypeMySQL StorageType = "mysql" 10 | StorageTypeTCP StorageType = "tcp" 11 | StorageTypeSyslog StorageType = "syslog" 12 | StorageTypeCommand StorageType = "command" 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/registration/user.go: -------------------------------------------------------------------------------- 1 | package registration 2 | 3 | import ( 4 | "crypto" 5 | ) 6 | 7 | // User interface is to be implemented by users of this library. 8 | // It is used by the client type to get user specific information. 9 | type User interface { 10 | GetEmail() string 11 | GetRegistration() *Resource 12 | GetPrivateKey() crypto.PrivateKey 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/url.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package aws 4 | 5 | import "net/url" 6 | 7 | // URLHostname will extract the Hostname without port from the URL value. 8 | // 9 | // Wrapper of net/url#URL.Hostname for backwards Go version compatibility. 10 | func URLHostname(url *url.URL) string { 11 | return url.Hostname() 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_storage_class.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propStorageClass ストレージクラス内包型 4 | type propStorageClass struct { 5 | StorageClass string `json:",omitempty"` // ストレージクラス 6 | } 7 | 8 | // GetStorageClass ストレージクラス 取得 9 | func (p *propStorageClass) GetStorageClass() string { 10 | return p.StorageClass 11 | } 12 | -------------------------------------------------------------------------------- /teaweb/actions/default/mongo/test.go: -------------------------------------------------------------------------------- 1 | package mongo 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teadb" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type TestAction actions.Action 9 | 10 | // 测试Mongo连接 11 | func (this *TestAction) Run(params struct{}) { 12 | err := teadb.SharedDB().Test() 13 | if err != nil { 14 | this.Fail() 15 | } else { 16 | this.Success() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/tunnel/generateSecret.go: -------------------------------------------------------------------------------- 1 | package tunnel 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | stringutil "github.com/iwind/TeaGo/utils/string" 6 | ) 7 | 8 | type GenerateSecretAction actions.Action 9 | 10 | // 生成密钥 11 | func (this *GenerateSecretAction) RunPost(params struct{}) { 12 | this.Data["secret"] = stringutil.Rand(32) 13 | this.Success() 14 | } 15 | -------------------------------------------------------------------------------- /teaconfigs/agents/agent_list_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "math/rand" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | func TestSharedAgentIds(t *testing.T) { 10 | for i := 0; i < 10; i ++ { 11 | if rand.Int()%3 == 0 { 12 | agentListChanged = true 13 | } 14 | 15 | before := time.Now() 16 | t.Log(SharedAgents()) 17 | t.Log(time.Since(before).Seconds(), "s") 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /teaproxy/request_proxy.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | // 调用代理 4 | func (this *Request) callProxy(writer *ResponseWriter) error { 5 | backend := this.proxy.NextBackend(this.backendCall) 6 | 7 | if len(this.backendCall.ResponseCallbacks) > 0 { 8 | this.responseCallback = this.backendCall.CallResponseCallbacks 9 | } 10 | 11 | this.backend = backend 12 | return this.callBackend(writer) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/gophercloud/gophercloud/openstack/dns/v2/zones/urls.go: -------------------------------------------------------------------------------- 1 | package zones 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("zones") 7 | } 8 | 9 | func zoneURL(c *gophercloud.ServiceClient, zoneID string) string { 10 | return c.ServiceURL("zones", zoneID) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/reflect2/go_above_19.go: -------------------------------------------------------------------------------- 1 | //+build go1.9 2 | 3 | package reflect2 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | //go:linkname makemap reflect.makemap 10 | func makemap(rtype unsafe.Pointer, cap int) (m unsafe.Pointer) 11 | 12 | func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { 13 | return makemap(rtype, cap) 14 | } 15 | -------------------------------------------------------------------------------- /teastats/variable.go: -------------------------------------------------------------------------------- 1 | package teastats 2 | 3 | // 变量说明 4 | type Variable struct { 5 | Code string `yaml:"code" json:"code"` // 代号 6 | Description string `yaml:"description" json:"description"` // 描述 7 | } 8 | 9 | // 获取新变量 10 | func NewVariable(code, description string) *Variable { 11 | return &Variable{ 12 | Code: code, 13 | Description: description, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_name.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propName 名称内包型 4 | type propName struct { 5 | Name string `json:",omitempty"` // 名称 6 | } 7 | 8 | // GetName 名称 取得 9 | func (p *propName) GetName() string { 10 | return p.Name 11 | } 12 | 13 | // SetName 名称 設定 14 | func (p *propName) SetName(name string) { 15 | p.Name = name 16 | } 17 | -------------------------------------------------------------------------------- /teacluster/action_notify.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | // cluster -> slave node 4 | type NotifyAction struct { 5 | Action 6 | } 7 | 8 | func (this *NotifyAction) Name() string { 9 | return "notify" 10 | } 11 | 12 | func (this *NotifyAction) TypeId() int8 { 13 | return ActionCodeNotify 14 | } 15 | 16 | func (this *NotifyAction) Execute() error { 17 | SharedManager.PullItems() 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /teadb/sort_field.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | type SortType = string 4 | 5 | const ( 6 | SortAsc = "asc" 7 | SortDesc = "desc" 8 | ) 9 | 10 | // 排序字段 11 | type SortField struct { 12 | Name string 13 | Type SortType 14 | } 15 | 16 | func (this *SortField) IsAsc() bool { 17 | return this.Type == SortAsc 18 | } 19 | 20 | func (this *SortField) IsDesc() bool { 21 | return this.Type == SortDesc 22 | } 23 | -------------------------------------------------------------------------------- /teadb/util_test.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/assert" 5 | "testing" 6 | ) 7 | 8 | func TestCurrentDB(t *testing.T) { 9 | db := SharedDB() 10 | t.Log(db) 11 | } 12 | 13 | func TestInitTable(t *testing.T) { 14 | a := assert.NewAssertion(t) 15 | a.IsFalse(isInitializedTable("a")) 16 | a.IsTrue(isInitializedTable("a")) 17 | a.IsTrue(isInitializedTable("a")) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/challenge/dns01/cname.go: -------------------------------------------------------------------------------- 1 | package dns01 2 | 3 | import "github.com/miekg/dns" 4 | 5 | // Update FQDN with CNAME if any 6 | func updateDomainWithCName(r *dns.Msg, fqdn string) string { 7 | for _, rr := range r.Answer { 8 | if cn, ok := rr.(*dns.CNAME); ok { 9 | if cn.Hdr.Name == fqdn { 10 | return cn.Target 11 | } 12 | } 13 | } 14 | 15 | return fqdn 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/miekg/dns/version.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import "fmt" 4 | 5 | // Version is current version of this library. 6 | var Version = V{1, 1, 0} 7 | 8 | // V holds the version of this library. 9 | type V struct { 10 | Major, Minor, Patch int 11 | } 12 | 13 | func (v V) String() string { 14 | return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | const ioctlReadTermios = unix.TCGETS 10 | const ioctlWriteTermios = unix.TCSETS 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | switch r.Operation.Name { 8 | case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: 9 | r.Handlers.Sign.Clear() // these operations are unsigned 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_job_status.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propJobStatus マイグレーションジョブステータス内包型 4 | type propJobStatus struct { 5 | JobStatus *MigrationJobStatus `json:",omitempty"` // マイグレーションジョブステータス 6 | } 7 | 8 | // GetJobStatus マイグレーションジョブステータス 取得 9 | func (p *propJobStatus) GetJobStatus() *MigrationJobStatus { 10 | return p.JobStatus 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/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 aix 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 | -------------------------------------------------------------------------------- /teadb/hook.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | import "sync" 4 | 5 | var hooks = []*Hook{} 6 | var hooksLocker = sync.Mutex{} 7 | 8 | func AddHook(hook *Hook) { 9 | hooksLocker.Lock() 10 | defer hooksLocker.Unlock() 11 | 12 | hooks = append(hooks, hook) 13 | } 14 | 15 | type Hook struct { 16 | Setup func() 17 | } 18 | 19 | func callHookSetup() { 20 | for _, hook := range hooks { 21 | go hook.Setup() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/agent/ip.go: -------------------------------------------------------------------------------- 1 | package agent 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | "github.com/iwind/TeaGo/maps" 6 | "github.com/iwind/TeaGo/utils/string" 7 | ) 8 | 9 | type IpAction actions.Action 10 | 11 | // 探测主机访问Master的IP 12 | func (this *IpAction) Run(params struct{}) { 13 | this.WriteString(stringutil.JSONEncode(maps.Map{ 14 | "ip": this.RequestRemoteIP(), 15 | })) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | // JSONValue is a representation of a grab bag type that will be marshaled 4 | // into a json string. This type can be used just like any other map. 5 | // 6 | // Example: 7 | // 8 | // values := aws.JSONValue{ 9 | // "Foo": "Bar", 10 | // } 11 | // values["Baz"] = "Qux" 12 | type JSONValue map[string]interface{} 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/bpf/setter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 bpf 6 | 7 | // A Setter is a type which can attach a compiled BPF filter to itself. 8 | type Setter interface { 9 | SetBPF(filter []RawInstruction) error 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/windows/mksyscall.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 windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/google.golang.org/appengine/internal/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | // Use of this source code is governed by the Apache 2.0 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package internal 8 | 9 | import ( 10 | "appengine_internal" 11 | ) 12 | 13 | func Main() { 14 | appengine_internal.Main() 15 | } 16 | -------------------------------------------------------------------------------- /teaconfigs/forms/utils.go: -------------------------------------------------------------------------------- 1 | package forms 2 | 3 | var allElementTypes = map[string]ElementInterface{ 4 | "TextField": new(TextField), 5 | "TextBox": new(TextBox), 6 | "Options": new(Options), 7 | "ScriptBox": new(ScriptBox), 8 | "CheckBox": new(CheckBox), 9 | "EnvBox": new(EnvBox), 10 | "HTTPBox": new(HTTPBox), 11 | "SingleValueList": new(SingleValueList), 12 | } 13 | -------------------------------------------------------------------------------- /teadb/driver_base.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | import "errors" 4 | 5 | var ErrorDBUnavailable = errors.New("database is not available") 6 | 7 | // 驱动基础 8 | type BaseDriver struct { 9 | isAvailable bool 10 | } 11 | 12 | // 是否可用 13 | func (this *BaseDriver) IsAvailable() bool { 14 | return this.isAvailable 15 | } 16 | 17 | // 设置是否可用 18 | func (this *BaseDriver) SetIsAvailable(b bool) { 19 | this.isAvailable = b 20 | } 21 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/v1/reset.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/api/apiutils" 5 | "github.com/TeaWeb/code/teaweb/configs" 6 | "github.com/iwind/TeaGo/actions" 7 | ) 8 | 9 | type ResetAction actions.Action 10 | 11 | // 重置系统配置状态 12 | func (this *ResetAction) RunGet(params struct{}) { 13 | configs.SharedAdminConfig().Reset() 14 | apiutils.SuccessOK(this) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/modern-go/concurrent/log.go: -------------------------------------------------------------------------------- 1 | package concurrent 2 | 3 | import ( 4 | "os" 5 | "log" 6 | "io/ioutil" 7 | ) 8 | 9 | // ErrorLogger is used to print out error, can be set to writer other than stderr 10 | var ErrorLogger = log.New(os.Stderr, "", 0) 11 | 12 | // InfoLogger is used to print informational message, default to off 13 | var InfoLogger = log.New(ioutil.Discard, "", 0) -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/cpu/goacmedns/account.go: -------------------------------------------------------------------------------- 1 | package goacmedns 2 | 3 | // Account is a struct that holds the registration response from an ACME-DNS 4 | // server. It represents an API username/key that can be used to update TXT 5 | // records for the account's subdomain. 6 | type Account struct { 7 | FullDomain string 8 | SubDomain string 9 | Username string 10 | Password string 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/bridge.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // BridgeAPI ブリッジAPI 4 | type BridgeAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewBridgeAPI ブリッジAPI作成 9 | func NewBridgeAPI(client *Client) *BridgeAPI { 10 | return &BridgeAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "bridge" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/note.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // NoteAPI スタートアップスクリプトAPI 4 | type NoteAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewNoteAPI スタートアップスクリプトAPI作成 9 | func NewNoteAPI(client *Client) *NoteAPI { 10 | return &NoteAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "note" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/product_license.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // ProductLicense ライセンスプラン 4 | type ProductLicense struct { 5 | *Resource // ID 6 | propName // 名称 7 | propServiceClass // サービスクラス 8 | propCreatedAt // 作成日時 9 | propModifiedAt // 変更日時 10 | TermsOfUse string `json:",omitempty"` // 利用規約 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/iovec_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 8 | 9 | type iovec struct{} 10 | 11 | func (v *iovec) set(b []byte) {} 12 | -------------------------------------------------------------------------------- /teaconfigs/api/api_test_script_result.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // 单个脚本测试结果 4 | type APITestScriptResult struct { 5 | Code string `yaml:"code" json:"code"` // 脚本代码 6 | IsPassed bool `yaml:"isPassed" json:"isPassed"` // 是否通过测试 7 | Failures []string `yaml:"failures" json:"failures"` // 失败 8 | } 9 | 10 | // 获取新对象 11 | func NewAPITestScriptResult() *APITestScriptResult { 12 | return &APITestScriptResult{} 13 | } 14 | -------------------------------------------------------------------------------- /teaconfigs/shutdown.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | // 关闭页面配置 4 | type ShutdownConfig struct { 5 | On bool `yaml:"on" json:"on"` 6 | URL string `yaml:"url" json:"url"` 7 | Status int `yaml:"status" json:"status"` 8 | } 9 | 10 | // 获取新对象 11 | func NewShutdownConfig() *ShutdownConfig { 12 | return &ShutdownConfig{} 13 | } 14 | 15 | // 校验 16 | func (this *ShutdownConfig) Validate() error { 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/v1/stop.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/api/apiutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "os" 7 | "time" 8 | ) 9 | 10 | type StopAction actions.Action 11 | 12 | // 停止服务 13 | func (this *StopAction) RunGet(params struct{}) { 14 | go func() { 15 | time.Sleep(1 * time.Second) 16 | os.Exit(0) 17 | }() 18 | apiutils.SuccessOK(this) 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/rewrite/helper.go: -------------------------------------------------------------------------------- 1 | package rewrite 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/actions" 5 | "net/http" 6 | ) 7 | 8 | type Helper struct { 9 | } 10 | 11 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 12 | if action.Request.Method != http.MethodGet { 13 | return 14 | } 15 | 16 | if action.HasParam("locationId") { 17 | action.Data["selectedTab"] = "location" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/rainycape/memcache/addr.go: -------------------------------------------------------------------------------- 1 | package memcache 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | type Addr struct { 8 | net.Addr 9 | s string 10 | n string 11 | } 12 | 13 | func (a *Addr) String() string { 14 | return a.s 15 | } 16 | 17 | func NewAddr(addr net.Addr) *Addr { 18 | return &Addr{ 19 | Addr: addr, 20 | s: addr.String(), 21 | n: addr.Network(), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/region.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // RegionAPI リージョンAPI 4 | type RegionAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewRegionAPI リージョンAPI作成 9 | func NewRegionAPI(client *Client) *RegionAPI { 10 | return &RegionAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "region" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/subnet.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // SubnetAPI サブネットAPI 4 | type SubnetAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewSubnetAPI サブネットAPI作成 9 | func NewSubnetAPI(client *Client) *SubnetAPI { 10 | return &SubnetAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "subnet" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /teaconfigs/notices/notice_test.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import "testing" 4 | 5 | func TestNotice_Hash(t *testing.T) { 6 | notice := NewNotice() 7 | notice.Message = "Hello, World" 8 | notice.Hash() 9 | t.Log(notice.MessageHash) 10 | 11 | notice.Message = "Hello, World" 12 | notice.Hash() 13 | t.Log(notice.MessageHash) 14 | 15 | notice.Message = "Hello, World2" 16 | notice.Hash() 17 | t.Log(notice.MessageHash) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/license.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // LicenseAPI ライセンスAPI 4 | type LicenseAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewLicenseAPI ライセンスAPI作成 9 | func NewLicenseAPI(client *Client) *LicenseAPI { 10 | return &LicenseAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "license" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!gopherjs 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | "golang.org/x/crypto/ssh/terminal" 10 | ) 11 | 12 | func checkIfTerminal(w io.Writer) bool { 13 | switch v := w.(type) { 14 | case *os.File: 15 | return terminal.IsTerminal(int(v.Fd())) 16 | default: 17 | return false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 6 | 7 | func (h *msghdr) setIov(vs []iovec) { 8 | l := len(vs) 9 | if l == 0 { 10 | return 11 | } 12 | h.Iov = &vs[0] 13 | h.Iovlen = uint32(l) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/google/appengineflex_hook.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 appenginevm 6 | 7 | package google 8 | 9 | func init() { 10 | appengineFlex = true // Flex doesn't support appengine.AccessToken; depend on metadata server. 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/internal/client_appengine.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package internal 8 | 9 | import "google.golang.org/appengine/urlfetch" 10 | 11 | func init() { 12 | appengineClientHook = urlfetch.Client 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/google.golang.org/api/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | Google Inc. 11 | -------------------------------------------------------------------------------- /teawaf/checkpoints/response_status_test.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | "testing" 7 | ) 8 | 9 | func TestResponseStatusCheckpoint_ResponseValue(t *testing.T) { 10 | resp := requests.NewResponse(new(http.Response)) 11 | resp.StatusCode = 200 12 | 13 | checkpoint := new(ResponseStatusCheckpoint) 14 | t.Log(checkpoint.ResponseValue(nil, resp, "", nil)) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | ServiceID string 7 | APIVersion string 8 | Endpoint string 9 | SigningName string 10 | SigningRegion string 11 | JSONVersion string 12 | TargetPrefix string 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package sdkio 4 | 5 | import "io" 6 | 7 | // Alias for Go 1.7 io package Seeker constants 8 | const ( 9 | SeekStart = io.SeekStart // seek relative to the origin of the file 10 | SeekCurrent = io.SeekCurrent // seek relative to the current offset 11 | SeekEnd = io.SeekEnd // seek relative to the end 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/zone.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // ZoneAPI ゾーンAPI 4 | type ZoneAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewZoneAPI ゾーンAPI作成 9 | func NewZoneAPI(client *Client) *ZoneAPI { 10 | return &ZoneAPI{ 11 | &baseAPI{ 12 | client: client, 13 | // FuncGetResourceURL 14 | FuncGetResourceURL: func() string { 15 | return "zone" 16 | }, 17 | }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/ipaddress.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // IPAddress IPアドレス(IPv4) 4 | type IPAddress struct { 5 | HostName string `json:",omitempty"` // HostName ホスト名 6 | IPAddress string `json:",omitempty"` // IPAddress IPv4アドレス 7 | Interface *Interface `json:",omitempty"` // Interface インターフェース 8 | Subnet *Subnet `json:",omitempty"` // Subnet IPv4サブネット 9 | 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_386.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 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-36 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /teadb/sql_params_holder_test.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestSQLParamsHolder_AddParam(t *testing.T) { 9 | holder := NewSQLParamsHolder("mysql") 10 | t.Log(holder.Add(123)) 11 | t.Log(holder.Add("456")) 12 | logs.PrintAsJSON(holder.Params, t) 13 | t.Log(holder.Parse("SELECT * FROM t WHERE a=:HOLDER0 AND b=:HOLDER1")) 14 | logs.PrintAsJSON(holder.Args, t) 15 | } 16 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/monitor/init.go: -------------------------------------------------------------------------------- 1 | package monitor 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/api/monitor/agent" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | server. 11 | Prefix("/api/monitor"). 12 | GetPost("", new(IndexAction)). 13 | GetPost("/agent/:agentId/item/:itemId", new(agent.ItemAction)). 14 | EndAll() 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /teaweb/actions/default/cache/helper.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | // 缓存相关Helper 13 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 14 | if action.Request.Method == http.MethodGet { 15 | proxyutils.AddServerMenu(action, false) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/certs/helper.go: -------------------------------------------------------------------------------- 1 | package certs 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 13 | if action.Request.Method != http.MethodGet { 14 | return 15 | } 16 | proxyutils.AddServerMenu(action, false) 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/database/index.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type IndexAction actions.Action 9 | 10 | // 数据库设置首页 11 | func (this *IndexAction) RunGet(params struct{}) { 12 | config := db.SharedDBConfig() 13 | this.Data["dbType"] = config.Type 14 | this.Data["dbTypeName"] = config.TypeName() 15 | 16 | this.Show() 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/cmd/web_shell_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package cmd 4 | 5 | import ( 6 | "github.com/TeaWeb/code/teaconst" 7 | "github.com/TeaWeb/code/teautils" 8 | "io" 9 | ) 10 | 11 | // 启动服务模式 12 | func (this *WebShell) ExecService(writer io.Writer) bool { 13 | // start the manager 14 | manager := teautils.NewServiceManager(teaconst.TeaProductName, teaconst.TeaProductName+" Server") 15 | manager.Run() 16 | 17 | return true 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/go-resty/resty/resty.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018 Jeevanandam M (jeeva@myjeeva.com), All rights reserved. 2 | // resty source code and usage is governed by a MIT style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package resty provides simple HTTP and REST client for Go inspired by Ruby rest-client. 6 | package resty 7 | 8 | // Version # of resty 9 | const Version = "1.8.0" 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/ipv6net.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // IPv6NetAPI IPv6ネットワークAPI 4 | type IPv6NetAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewIPv6NetAPI IPv6ネットワークAPI作成 9 | func NewIPv6NetAPI(client *Client) *IPv6NetAPI { 10 | return &IPv6NetAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "ipv6net" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/product_privatehost.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // ProductPrivateHost 専有ホストプラン 4 | type ProductPrivateHost struct { 5 | *Resource // ID 6 | propName // 名称 7 | propDescription // 説明 8 | propAvailability // 有功状態 9 | propCPU // CPUコア数 10 | propMemoryMB // メモリサイズ(MB単位) 11 | propClass // クラス 12 | propServiceClass // サービスクラス 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import "unsafe" 10 | 11 | func probeProtocolStack() int { 12 | var p uintptr 13 | return int(unsafe.Sizeof(p)) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-72 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-72 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 | #include "textflag.h" 6 | 7 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 8 | JMP syscall·sysvicall6(SB) 9 | 10 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 11 | JMP syscall·rawSysvicall6(SB) 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv4/sys_stub.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 !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv6/sys_stub.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 !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/v1/backup/files.go: -------------------------------------------------------------------------------- 1 | package backup 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/api/apiutils" 5 | "github.com/TeaWeb/code/teaweb/actions/default/settings/backup/backuputils" 6 | "github.com/iwind/TeaGo/actions" 7 | ) 8 | 9 | type FilesAction actions.Action 10 | 11 | // 文件名 12 | func (this *FilesAction) RunGet(params struct{}) { 13 | apiutils.Success(this, backuputils.ActionListFiles()) 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/settings/helper.go: -------------------------------------------------------------------------------- 1 | package settings 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 13 | if action.Request.Method != http.MethodGet { 14 | return 15 | } 16 | proxyutils.AddServerMenu(action, false) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/ovh/go-ovh/ovh/logger.go: -------------------------------------------------------------------------------- 1 | package ovh 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | // Logger is the interface that should be implemented for loggers that wish to 8 | // log HTTP requests and HTTP responses. 9 | type Logger interface { 10 | // LogRequest logs an HTTP request. 11 | LogRequest(*http.Request) 12 | 13 | // LogResponse logs an HTTP response. 14 | LogResponse(*http.Response) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/objx/constants.go: -------------------------------------------------------------------------------- 1 | package objx 2 | 3 | const ( 4 | // PathSeparator is the character used to separate the elements 5 | // of the keypath. 6 | // 7 | // For example, `location.address.city` 8 | PathSeparator string = "." 9 | 10 | // SignatureSeparator is the character that is used to 11 | // separate the Base64 string from the security signature. 12 | SignatureSeparator = "_" 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 11 | } 12 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_docker_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "github.com/iwind/TeaGo/logs" 6 | "testing" 7 | ) 8 | 9 | func TestDockerSource_Execute(t *testing.T) { 10 | if !teatesting.RequireDocker() { 11 | return 12 | } 13 | 14 | source := NewDockerSource() 15 | value, err := source.Execute(nil) 16 | if err != nil { 17 | t.Fatal(err) 18 | } 19 | logs.PrintAsJSON(value, t) 20 | } 21 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_file_change_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestFileChangeSource_Execute(t *testing.T) { 9 | source := NewFileChangeSource() 10 | source.Path = "/opt/test/cpu.sh" 11 | 12 | for i := 0; i < 2; i ++ { 13 | value, err := source.Execute(nil) 14 | if err != nil { 15 | t.Fatal(err) 16 | } 17 | 18 | logs.PrintAsJSON(value, t) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /teaconfigs/api/api_data_limit.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import "time" 4 | 5 | // api数据量限制 6 | type APIDataLimit struct { 7 | Max uint `yaml:"max" json:"max"` // 最大数据量 TODO 8 | Total uint `yaml:"total" json:"total"` // 数据量 TODO 9 | Duration string `yaml:"duration" json:"duration"` // 数据限制间隔 TODO 10 | 11 | duration time.Duration 12 | } 13 | 14 | // 校验 15 | func (this *APIDataLimit) Validate() error { 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/utils/menu_item.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | // 菜单项 4 | type MenuItem struct { 5 | Id string `json:"id"` 6 | Name string `json:"name"` 7 | SubName string `json:"subName"` // 副标题 8 | SupName string `json:"supName"` // 头标 9 | URL string `json:"url"` 10 | IsActive bool `json:"isActive"` 11 | Icon string `json:"icon"` 12 | IsSortable bool `json:"isSortable"` 13 | SubColor string `json:"subColor"` 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/apps/detail.go: -------------------------------------------------------------------------------- 1 | package apps 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/agents/agentutils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type DetailAction actions.Action 9 | 10 | // App详情 11 | func (this *DetailAction) Run(params struct { 12 | AgentId string 13 | AppId string 14 | }) { 15 | agentutils.InitAppData(this, params.AgentId, params.AppId, "detail") 16 | 17 | this.Show() 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/dashboard/init.go: -------------------------------------------------------------------------------- 1 | package dashboard 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/helpers" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | server. 11 | Helper(new(helpers.UserMustAuth)). 12 | Helper(new(Helper)). 13 | Prefix("/dashboard"). 14 | GetPost("", new(IndexAction)). 15 | Get("/logs", new(LogsAction)). 16 | EndAll() 17 | }) 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/servergroups/helper.go: -------------------------------------------------------------------------------- 1 | package servergroups 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | // 相关Helper 13 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 14 | if action.Request.Method == http.MethodGet { 15 | proxyutils.AddServerMenu(action, false) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/http2/not_go19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | // not supported prior to go1.9 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /teaconfigs/node_role.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import "github.com/iwind/TeaGo/lists" 4 | 5 | // 角色定义 6 | type NodeRole = string 7 | 8 | const ( 9 | NodeRoleMaster = "MASTER" 10 | NodeRoleSlave = "SLAVE" 11 | ) 12 | 13 | // 所有角色 14 | func AllNodeRoles() []string { 15 | return []string{NodeRoleMaster, NodeRoleSlave} 16 | } 17 | 18 | // 判断某个角色是否存在 19 | func ExistNodeRole(role NodeRole) bool { 20 | return lists.ContainsString(AllNodeRoles(), role) 21 | } 22 | -------------------------------------------------------------------------------- /teaconfigs/time_pass_test.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import ( 4 | timeutil "github.com/iwind/TeaGo/utils/time" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | func TestTimePastSeconds(t *testing.T) { 10 | t.Log("current:", timeutil.Format("Y-m-d H:i:s")) 11 | for _, m := range AllTimePasts() { 12 | value := m["value"].(TimePast) 13 | t.Log(value+":", TimePastUnixTime(value), timeutil.Format("Y-m-d H:i:s", time.Unix(TimePastUnixTime(value), 0))) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /teadb/dao_audit_log.go: -------------------------------------------------------------------------------- 1 | package teadb 2 | 3 | import "github.com/TeaWeb/code/teaconfigs/audits" 4 | 5 | // 审计日志DAO 6 | type AuditLogDAOInterface interface { 7 | // 设置驱动 8 | SetDriver(driver DriverInterface) 9 | 10 | // 初始化 11 | Init() 12 | 13 | // 计算审计日志数量 14 | CountAllAuditLogs() (int64, error) 15 | 16 | // 列出审计日志 17 | ListAuditLogs(offset int, size int) ([]*audits.Log, error) 18 | 19 | // 插入一条审计日志 20 | InsertOne(auditLog *audits.Log) error 21 | } 22 | -------------------------------------------------------------------------------- /teaevents/event_config_changed.go: -------------------------------------------------------------------------------- 1 | package teaevents 2 | 3 | const ( 4 | EventTypeConfigChanged EventType = "EventTypeConfigChanged" // config changed 5 | ) 6 | 7 | var configChangedEvent = new(ConfigChangedEvent) 8 | 9 | type ConfigChangedEvent struct { 10 | } 11 | 12 | func NewConfigChangedEvent() *ConfigChangedEvent { 13 | return configChangedEvent 14 | } 15 | 16 | func (this *ConfigChangedEvent) Type() string { 17 | return EventTypeConfigChanged 18 | } 19 | -------------------------------------------------------------------------------- /teawaf/rule_operator_test.go: -------------------------------------------------------------------------------- 1 | package teawaf 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "testing" 7 | ) 8 | 9 | func TestRuleOperator_Markdown(t *testing.T) { 10 | result := []string{} 11 | for _, def := range AllRuleOperators { 12 | row := "## " + def.Name + "\n" 13 | row += "符号:`" + def.Code + "`\n" 14 | row += "描述:" + def.Description + "\n" 15 | result = append(result, row) 16 | } 17 | 18 | fmt.Print(strings.Join(result, "\n") + "\n") 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/agent/README.md: -------------------------------------------------------------------------------- 1 | # Agent API 2 | * `GET /api/agent` - 获取Agent配置 3 | * `GET /api/agent/pull` - 拉取Agent事件(长连接) 4 | * `PUT /api/agent/push` - 推送Agent事件 5 | * `GET /api/agent/upgrade` - 下载新版本 6 | 7 | ## 认证 8 | ~~~ 9 | Tea-Agent-Id: KwOe0dkxtyKHzMRC 10 | Tea-Agent-Key: ZtJUYdjO6enUwHwx9TyczhrqAHoO2FBv 11 | ~~~ 12 | 13 | ## 其余信息 14 | ~~~ 15 | Tea-Agent-Version: Agent版本号 16 | Tea-Agent-Os: Agent操作系统代号 17 | Tea-Agent-Arch: Agent可执行文件架构 18 | ~~~ 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/board/refreshData.go: -------------------------------------------------------------------------------- 1 | package board 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teastats" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type RefreshDataAction actions.Action 9 | 10 | // 刷新数据 11 | func (this *RefreshDataAction) RunPost(params struct { 12 | ServerId string 13 | }) { 14 | queue := teastats.FindServerQueue(params.ServerId) 15 | if queue != nil { 16 | queue.Commit() 17 | } 18 | 19 | this.Success() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/ovh/go-ovh/ovh/error.go: -------------------------------------------------------------------------------- 1 | package ovh 2 | 3 | import "fmt" 4 | 5 | // APIError represents an error that can occurred while calling the API. 6 | type APIError struct { 7 | // Error message. 8 | Message string 9 | // HTTP code. 10 | Code int 11 | // ID of the request 12 | QueryID string 13 | } 14 | 15 | func (err *APIError) Error() string { 16 | return fmt.Sprintf("Error %d: %q", err.Code, err.Message) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/public_price.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // PublicPriceAPI 料金情報API 4 | type PublicPriceAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewPublicPriceAPI 料金情報API 9 | func NewPublicPriceAPI(client *Client) *PublicPriceAPI { 10 | return &PublicPriceAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "public/price" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_description.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propDescription 説明内包型 4 | type propDescription struct { 5 | Description string // 説明 6 | } 7 | 8 | // GetDescription 説明 取得 9 | func (p *propDescription) GetDescription() string { 10 | return p.Description 11 | } 12 | 13 | // SetDescription 説明 設定 14 | func (p *propDescription) SetDescription(desc string) { 15 | p.Description = desc 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build !appengine,!gopherjs 7 | 8 | package logrus 9 | 10 | import "golang.org/x/sys/unix" 11 | 12 | const ioctlReadTermios = unix.TCGETS 13 | 14 | type Termios unix.Termios 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TIOCGETA 12 | const ioctlWriteTermios = unix.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/http2/go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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.6 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | "time" 12 | ) 13 | 14 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration { 15 | return t1.ExpectContinueTimeout 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) set(l, lvl, typ int) { 10 | h.Len = uint32(l) 11 | h.Level = int32(lvl) 12 | h.Type = int32(typ) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /teaplugins/plugin.go: -------------------------------------------------------------------------------- 1 | package teaplugins 2 | 3 | type Plugin struct { 4 | IsExternal bool // 是否第三方开发的 5 | 6 | Name string // 名称 7 | Code string // 代号 8 | Version string // 版本 9 | Date string // 发布日期 10 | Site string // 网站链接 11 | Developer string // 开发者 12 | Description string // 插件简介 13 | 14 | HasRequestFilter bool 15 | HasResponseFilter bool 16 | } 17 | 18 | func NewPlugin() *Plugin { 19 | return &Plugin{ 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /teaweb/actions/default/mongo/init.go: -------------------------------------------------------------------------------- 1 | package mongo 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/configs" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | "github.com/iwind/TeaGo" 7 | ) 8 | 9 | func init() { 10 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 11 | server. 12 | Helper(&helpers.UserMustAuth{ 13 | Grant: configs.AdminGrantAgent, 14 | }). 15 | Prefix("/mongo"). 16 | Get("/test", new(TestAction)). 17 | EndAll() 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/notices/helper.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | // 相关Helper 13 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 14 | if action.Request.Method != http.MethodGet { 15 | return 16 | } 17 | 18 | proxyutils.AddServerMenu(action, false) 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/backup/index.go: -------------------------------------------------------------------------------- 1 | package backup 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/settings/backup/backuputils" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type IndexAction actions.Action 9 | 10 | // 备份列表 11 | func (this *IndexAction) Run(params struct{}) { 12 | this.Data["files"] = backuputils.ActionListFiles() 13 | 14 | this.Data["shouldRestart"] = backuputils.ShouldRestart() 15 | 16 | this.Show() 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!plan9 2 | 3 | package request 4 | 5 | import ( 6 | "net" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | func isErrConnectionReset(err error) bool { 12 | if opErr, ok := err.(*net.OpError); ok { 13 | if sysErr, ok := opErr.Err.(*os.SyscallError); ok { 14 | return sysErr.Err == syscall.ECONNRESET 15 | } 16 | } 17 | 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/private_host.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // PrivateHostAPI 専有ホストAPI 4 | type PrivateHostAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewPrivateHostAPI 専有ホストAPI作成 9 | func NewPrivateHostAPI(client *Client) *PrivateHostAPI { 10 | return &PrivateHostAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "privatehost" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /teautils/signal.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package teautils 4 | 5 | import ( 6 | "os" 7 | "os/signal" 8 | ) 9 | 10 | // 监听Signal 11 | func ListenSignal(f func(sig os.Signal), sig ...os.Signal) { 12 | ch := make(chan os.Signal, 8) 13 | signal.Notify(ch, sig...) 14 | go func() { 15 | for r := range ch { 16 | f(r) 17 | } 18 | }() 19 | } 20 | 21 | // 通知Signal 22 | func NotifySignal(proc *os.Process, sig os.Signal) error { 23 | return proc.Signal(sig) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/miekg/dns/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build fuzz 2 | 3 | package dns 4 | 5 | func Fuzz(data []byte) int { 6 | msg := new(Msg) 7 | 8 | if err := msg.Unpack(data); err != nil { 9 | return 0 10 | } 11 | if _, err := msg.Pack(); err != nil { 12 | return 0 13 | } 14 | 15 | return 1 16 | } 17 | 18 | func FuzzNewRR(data []byte) int { 19 | if _, err := NewRR(string(data)); err != nil { 20 | return 0 21 | } 22 | return 1 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/product_disk.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // ProductDiskAPI ディスクプランAPI 4 | type ProductDiskAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewProductDiskAPI ディスクプランAPI作成 9 | func NewProductDiskAPI(client *Client) *ProductDiskAPI { 10 | return &ProductDiskAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "product/disk" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/mongo/clean.go: -------------------------------------------------------------------------------- 1 | package mongo 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type CleanAction actions.Action 9 | 10 | // 设置自动清理 11 | func (this *CleanAction) Run(params struct{}) { 12 | config, _ := db.LoadMongoConfig() 13 | if config != nil { 14 | this.Data["accessLog"] = config.AccessLog 15 | } else { 16 | this.Data["accessLog"] = nil 17 | } 18 | 19 | this.Show() 20 | } 21 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/mysql/clean.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type CleanAction actions.Action 9 | 10 | // 设置自动清理 11 | func (this *CleanAction) Run(params struct{}) { 12 | config, _ := db.LoadMySQLConfig() 13 | if config != nil { 14 | this.Data["accessLog"] = config.AccessLog 15 | } else { 16 | this.Data["accessLog"] = nil 17 | } 18 | 19 | this.Show() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/service.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import ( 4 | "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid" 5 | ) 6 | 7 | var ( 8 | // Config contains the Akamai OPEN Edgegrid API credentials 9 | // for automatic signing of requests 10 | Config edgegrid.Config 11 | ) 12 | 13 | // Init sets the FastDNS edgegrid Config 14 | func Init(config edgegrid.Config) { 15 | Config = config 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/gophercloud/gophercloud/openstack/dns/v2/recordsets/urls.go: -------------------------------------------------------------------------------- 1 | package recordsets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient, zoneID string) string { 6 | return c.ServiceURL("zones", zoneID, "recordsets") 7 | } 8 | 9 | func rrsetURL(c *gophercloud.ServiceClient, zoneID string, rrsetID string) string { 10 | return c.ServiceURL("zones", zoneID, "recordsets", rrsetID) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/http2/go19.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 go1.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | s.RegisterOnShutdown(conf.state.startGracefulShutdown) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/oauth2/google/appengine_hook.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 appengine appenginevm 6 | 7 | package google 8 | 9 | import "google.golang.org/appengine" 10 | 11 | func init() { 12 | appengineTokenFunc = appengine.AccessToken 13 | appengineAppIDFunc = appengine.AppID 14 | } 15 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_load_unix_like.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package agents 4 | 5 | import "github.com/shirou/gopsutil/load" 6 | 7 | // 执行 8 | func (this *LoadSource) Execute(params map[string]string) (value interface{}, err error) { 9 | stat, err := load.Avg() 10 | if err != nil || stat == nil { 11 | return 12 | } 13 | value = map[string]interface{}{ 14 | "load1": stat.Load1, 15 | "load5": stat.Load5, 16 | "load15": stat.Load15, 17 | } 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /teaconfigs/api/api_script_test.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/Tea" 5 | "github.com/iwind/TeaGo/files" 6 | "testing" 7 | ) 8 | 9 | func TestAPIScript_Save(t *testing.T) { 10 | s := NewAPIScript() 11 | s.Code = "var api = API(\"$\");" 12 | err := s.Save() 13 | if err != nil { 14 | t.Fatal(err) 15 | } 16 | t.Log("success", s.Filename) 17 | 18 | if len(s.Filename) > 0 { 19 | files.NewFile(Tea.ConfigFile(s.Filename)).Delete() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/e2e/readme.md: -------------------------------------------------------------------------------- 1 | # E2E tests 2 | 3 | How to run: 4 | 5 | - Add the following entries to your `/etc/hosts`: 6 | ``` 7 | 127.0.0.1 acme.wtf 8 | 127.0.0.1 lego.wtf 9 | 127.0.0.1 acme.lego.wtf 10 | 127.0.0.1 légô.wtf 11 | 127.0.0.1 xn--lg-bja9b.wtf 12 | ``` 13 | 14 | - Install [Pebble](https://github.com/letsencrypt/pebble): 15 | ```bash 16 | go get -u github.com/letsencrypt/pebble/... 17 | ``` 18 | 19 | - Launch tests: 20 | ```bash 21 | make e2e 22 | ``` 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/packet_filter.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // PacketFilterAPI パケットフィルターAPI 4 | type PacketFilterAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewPacketFilterAPI パケットフィルターAPI作成 9 | func NewPacketFilterAPI(client *Client) *PacketFilterAPI { 10 | return &PacketFilterAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "packetfilter" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_host.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propHost ホスト(物理)内包型 4 | type propHost struct { 5 | Host *Host `json:",omitempty"` // サービスクラス 6 | } 7 | 8 | // GetHost ホスト(物理) 取得 9 | func (p *propHost) GetHost() *Host { 10 | return p.Host 11 | } 12 | 13 | // GetHostName ホスト(物理)名称取得 14 | func (p *propHost) GetHostName() string { 15 | if p.Host == nil { 16 | return "" 17 | } 18 | return p.Host.GetName() 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd 6 | 7 | package socket 8 | 9 | func (h *msghdr) setIov(vs []iovec) { 10 | l := len(vs) 11 | if l == 0 { 12 | return 13 | } 14 | h.Iov = &vs[0] 15 | h.Iovlen = int32(l) 16 | } 17 | -------------------------------------------------------------------------------- /teacluster/codes.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | type ActionCode = int8 4 | 5 | const ( 6 | ActionCodeSuccess ActionCode = 1 7 | ActionCodeFail ActionCode = 2 8 | ActionCodeRegister ActionCode = 3 9 | ActionCodeNotify ActionCode = 4 10 | ActionCodePush ActionCode = 5 11 | ActionCodePull ActionCode = 6 12 | ActionCodePing ActionCode = 7 13 | ActionCodeSync ActionCode = 8 14 | ActionCodeSum ActionCode = 9 15 | ActionCodeRun ActionCode = 10 16 | ) 17 | -------------------------------------------------------------------------------- /teautils/copy.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // 拷贝同类型struct指针对象中的字段 8 | func CopyStructObject(destPtr, sourcePtr interface{}) { 9 | value := reflect.ValueOf(destPtr) 10 | value2 := reflect.ValueOf(sourcePtr) 11 | 12 | countFields := value2.Elem().NumField() 13 | for i := 0; i < countFields; i++ { 14 | v := value2.Elem().Field(i) 15 | if !v.IsValid() || !v.CanSet() { 16 | continue 17 | } 18 | value.Elem().Field(i).Set(v) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /teaweb/actions/default/install/skip.go: -------------------------------------------------------------------------------- 1 | package install 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/iwind/TeaGo/actions" 6 | "github.com/iwind/TeaGo/logs" 7 | ) 8 | 9 | type SkipAction actions.Action 10 | 11 | // 跳过 12 | func (this *SkipAction) RunPost(params struct{}) { 13 | config := db.SharedDBConfig() 14 | config.IsInitialized = true 15 | err := config.Save() 16 | if err != nil { 17 | logs.Error(err) 18 | } 19 | 20 | this.Success() 21 | } 22 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/postgres/clean.go: -------------------------------------------------------------------------------- 1 | package postgres 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type CleanAction actions.Action 9 | 10 | // 设置自动清理 11 | func (this *CleanAction) Run(params struct{}) { 12 | config, _ := db.LoadPostgresConfig() 13 | if config != nil { 14 | this.Data["accessLog"] = config.AccessLog 15 | } else { 16 | this.Data["accessLog"] = nil 17 | } 18 | 19 | this.Show() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package v4 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | func getURIPath(u *url.URL) string { 11 | var uri string 12 | 13 | if len(u.Opaque) > 0 { 14 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 15 | } else { 16 | uri = u.EscapedPath() 17 | } 18 | 19 | if len(uri) == 0 { 20 | uri = "/" 21 | } 22 | 23 | return uri 24 | } 25 | -------------------------------------------------------------------------------- /teacluster/action_pull.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teacluster/configs" 5 | ) 6 | 7 | // node <- cluster 8 | type PullAction struct { 9 | Action 10 | 11 | LocalItems []*configs.Item // items without data 12 | } 13 | 14 | func (this *PullAction) Name() string { 15 | return "pull" 16 | } 17 | 18 | func (this *PullAction) Execute() error { 19 | return nil 20 | } 21 | 22 | func (this *PullAction) TypeId() int8 { 23 | return ActionCodePull 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/registration/user_test.go: -------------------------------------------------------------------------------- 1 | package registration 2 | 3 | import ( 4 | "crypto" 5 | "crypto/rsa" 6 | ) 7 | 8 | type mockUser struct { 9 | email string 10 | regres *Resource 11 | privatekey *rsa.PrivateKey 12 | } 13 | 14 | func (u mockUser) GetEmail() string { return u.email } 15 | func (u mockUser) GetRegistration() *Resource { return u.regres } 16 | func (u mockUser) GetPrivateKey() crypto.PrivateKey { return u.privatekey } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/region.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // Region リージョン 4 | type Region struct { 5 | *Resource // ID 6 | propName // 名称 7 | propDescription // 説明 8 | 9 | NameServers []string `json:",omitempty"` // NameServers ネームサーバー 10 | } 11 | 12 | // GetNameServers リージョン内のネームサーバー取得 13 | func (r *Region) GetNameServers() []string { 14 | if r == nil { 15 | return []string{} 16 | } 17 | return r.NameServers 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/update/init.go: -------------------------------------------------------------------------------- 1 | package update 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/settings" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | "github.com/iwind/TeaGo" 7 | ) 8 | 9 | func init() { 10 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 11 | server. 12 | Helper(new(helpers.UserMustAuth)). 13 | Helper(new(settings.Helper)). 14 | Prefix("/settings/update"). 15 | GetPost("", new(IndexAction)). 16 | EndAll() 17 | }) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/product_license.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // ProductLicenseAPI ライセンスプランAPI 4 | type ProductLicenseAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewProductLicenseAPI ライセンスプランAPI作成 9 | func NewProductLicenseAPI(client *Client) *ProductLicenseAPI { 10 | return &ProductLicenseAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "product/license" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | if !t.isRTL() { 11 | return true 12 | } 13 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 14 | } 15 | -------------------------------------------------------------------------------- /teaweb/actions/default/install/init.go: -------------------------------------------------------------------------------- 1 | package install 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/helpers" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | server. 11 | Prefix("/install"). 12 | Helper(new(helpers.UserMustAuth)). 13 | GetPost("", new(IndexAction)). 14 | Post("/skip", new(SkipAction)). 15 | Post("/test", new(TestAction)). 16 | Post("/save", new(SaveAction)). 17 | EndAll() 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/plugins/init.go: -------------------------------------------------------------------------------- 1 | package plugins 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/configs" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | "github.com/iwind/TeaGo" 7 | ) 8 | 9 | func init() { 10 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 11 | server. 12 | Helper(&helpers.UserMustAuth{ 13 | Grant: configs.AdminGrantPlugin, 14 | }). 15 | Helper(new(Helper)). 16 | Prefix("/plugins"). 17 | Get("", new(IndexAction)). 18 | EndAll() 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/log/policies/helper.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 5 | "github.com/iwind/TeaGo/actions" 6 | "net/http" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | // 相关Helper 13 | func (this *Helper) BeforeAction(action *actions.ActionObject) { 14 | if action.Request.Method == http.MethodGet { 15 | proxyutils.AddServerMenu(action, false) 16 | 17 | action.Data["selectedMenu"] = "list" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:alpine3.9 as builder 2 | 3 | RUN apk --update upgrade \ 4 | && apk --no-cache --no-progress add make git 5 | 6 | WORKDIR /go/src/github.com/go-acme/lego 7 | COPY . . 8 | RUN make build 9 | 10 | FROM alpine:3.9 11 | RUN apk update \ 12 | && apk add --no-cache ca-certificates tzdata \ 13 | && update-ca-certificates 14 | 15 | COPY --from=builder /go/src/github.com/go-acme/lego/dist/lego /usr/bin/lego 16 | ENTRYPOINT [ "/usr/bin/lego" ] 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/api/product_internet.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // ProductInternetAPI ルータープランAPI 4 | type ProductInternetAPI struct { 5 | *baseAPI 6 | } 7 | 8 | // NewProductInternetAPI ルータープランAPI作成 9 | func NewProductInternetAPI(client *Client) *ProductInternetAPI { 10 | return &ProductInternetAPI{ 11 | &baseAPI{ 12 | client: client, 13 | FuncGetResourceURL: func() string { 14 | return "product/internet" 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/objx/tests.go: -------------------------------------------------------------------------------- 1 | package objx 2 | 3 | // Has gets whether there is something at the specified selector 4 | // or not. 5 | // 6 | // If m is nil, Has will always return false. 7 | func (m Map) Has(selector string) bool { 8 | if m == nil { 9 | return false 10 | } 11 | return !m.Get(selector).IsNil() 12 | } 13 | 14 | // IsNil gets whether the data is nil or not. 15 | func (v *Value) IsNil() bool { 16 | return v == nil || v.data == nil 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint64(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-16 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-12 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_cpu_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | func TestCPUSource_Execute(t *testing.T) { 10 | time.Sleep(1 * time.Second) 11 | 12 | before := time.Now() 13 | for i := 0; i < 3; i ++ { 14 | source := NewCPUSource() 15 | value, err := source.Execute(nil) 16 | if err != nil { 17 | t.Fatal(err) 18 | } 19 | logs.PrintAsJSON(value, t) 20 | t.Log(time.Since(before).Seconds(), "s") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /teaconfigs/notices/media_webhook_test.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "testing" 6 | ) 7 | 8 | func TestNoticeMediaWebhook_Send(t *testing.T) { 9 | if !teatesting.RequireHTTPServer() { 10 | return 11 | } 12 | 13 | media := NewNoticeWebhookMedia() 14 | media.URL = "http://127.0.0.1:9991/webhook?subject=${NoticeSubject}&body=${NoticeBody}" 15 | resp, err := media.Send("zhangsan", "this is subject", "this is body") 16 | t.Log(string(resp), err) 17 | } 18 | -------------------------------------------------------------------------------- /teaconfigs/shared/header_list_test.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func TestHeaderList_FormatHeaders(t *testing.T) { 9 | list := &HeaderList{} 10 | 11 | for i := 0; i < 5; i++ { 12 | list.AddRequestHeader(&HeaderConfig{ 13 | On: true, 14 | Name: "A" + fmt.Sprintf("%d", i), 15 | Value: "ABCDEFGHIJ${name}KLM${hello}NEFGHIJILKKKk", 16 | }) 17 | } 18 | 19 | err := list.ValidateHeaders() 20 | if err != nil { 21 | t.Fatal(err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /teaconfigs/widgets/chart_url.go: -------------------------------------------------------------------------------- 1 | package widgets 2 | 3 | import "github.com/iwind/TeaGo/utils/string" 4 | 5 | // URL Chart 6 | type URLChart struct { 7 | URL string `yaml:"url" json:"url"` 8 | } 9 | 10 | func (this *URLChart) AsJavascript(options map[string]interface{}) (code string, err error) { 11 | return ` 12 | var chart = new charts.URLChart(); 13 | chart.options = ` + stringutil.JSONEncode(options) + `; 14 | chart.url = ` + stringutil.JSONEncode(this.URL) + `; 15 | chart.render(); 16 | `, nil 17 | } 18 | -------------------------------------------------------------------------------- /tealogs/tests/command_storage.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /teawaf/checkpoints/param_option.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | type KeyValue struct { 4 | Name string `json:"name"` 5 | Value string `json:"value"` 6 | } 7 | 8 | type ParamOptions struct { 9 | Options []*KeyValue `json:"options"` 10 | } 11 | 12 | func NewParamOptions() *ParamOptions { 13 | return &ParamOptions{} 14 | } 15 | 16 | func (this *ParamOptions) AddParam(name string, value string) { 17 | this.Options = append(this.Options, &KeyValue{ 18 | Name: name, 19 | Value: value, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /teaweb/actions/default/notices/sound.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/notices" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type SoundAction actions.Action 9 | 10 | // 是否开启通知 11 | func (this *SoundAction) Run(params struct { 12 | On bool 13 | }) { 14 | setting := notices.SharedNoticeSetting() 15 | setting.SoundOn = params.On 16 | err := setting.Save() 17 | if err != nil { 18 | this.Fail("保存失败:" + err.Error()) 19 | } 20 | 21 | this.Success() 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/kolo/xmlrpc/xmlrpc.go: -------------------------------------------------------------------------------- 1 | package xmlrpc 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // xmlrpcError represents errors returned on xmlrpc request. 8 | type xmlrpcError struct { 9 | code int 10 | err string 11 | } 12 | 13 | // Error() method implements Error interface 14 | func (e *xmlrpcError) Error() string { 15 | return fmt.Sprintf("error: \"%s\" code: %d", e.err, e.code) 16 | } 17 | 18 | // Base64 represents value in base64 encoding 19 | type Base64 string 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/private_host.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // PrivateHost 専有ホスト 4 | type PrivateHost struct { 5 | *Resource // ID 6 | propName // 名称 7 | propDescription // 説明 8 | 9 | propPrivateHostPlan // 専有ホストプラン 10 | propHost // ホスト(物理) 11 | propAssignedCPU // 割当済みCPUコア数 12 | propAssignedMemoryMB // 割当済みメモリ(MB) 13 | 14 | propIcon // アイコン 15 | propTags // タグ 16 | propCreatedAt // 作成日時 17 | 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 !linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errOpNoSupport 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 !linux 6 | 7 | package ipv6 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errOpNoSupport 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-24 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/text/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // langAliasType is the type of an alias in langAliasMap. 8 | type langAliasType int8 9 | 10 | const ( 11 | langDeprecated langAliasType = iota 12 | langMacro 13 | langLegacy 14 | 15 | langAliasTypeUnknown langAliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /teaproxy/utils.go: -------------------------------------------------------------------------------- 1 | package teaproxy 2 | 3 | // 清理Path中的多余的字符 4 | func CleanPath(path string) string { 5 | l := len(path) 6 | if l == 0 { 7 | return "/" 8 | } 9 | result := []byte{'/'} 10 | isSlash := true 11 | for i := 0; i < l; i++ { 12 | if path[i] == '\\' || path[i] == '/' { 13 | if !isSlash { 14 | isSlash = true 15 | result = append(result, '/') 16 | } 17 | } else { 18 | isSlash = false 19 | result = append(result, path[i]) 20 | } 21 | } 22 | return string(result) 23 | } 24 | -------------------------------------------------------------------------------- /teawaf/checkpoints/checkpoint.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | type Checkpoint struct { 4 | } 5 | 6 | func (this *Checkpoint) Init() { 7 | 8 | } 9 | 10 | func (this *Checkpoint) IsRequest() bool { 11 | return true 12 | } 13 | 14 | func (this *Checkpoint) ParamOptions() *ParamOptions { 15 | return nil 16 | } 17 | 18 | func (this *Checkpoint) Options() []OptionInterface { 19 | return nil 20 | } 21 | 22 | func (this *Checkpoint) Start() { 23 | 24 | } 25 | 26 | func (this *Checkpoint) Stop() { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /teawaf/checkpoints/response_header_test.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | "testing" 7 | ) 8 | 9 | func TestResponseHeaderCheckpoint_ResponseValue(t *testing.T) { 10 | resp := requests.NewResponse(new(http.Response)) 11 | resp.StatusCode = 200 12 | resp.Header = http.Header{} 13 | resp.Header.Set("Hello", "World") 14 | 15 | checkpoint := new(ResponseHeaderCheckpoint) 16 | t.Log(checkpoint.ResponseValue(nil, resp, "Hello", nil)) 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/actions/default/login/init.go: -------------------------------------------------------------------------------- 1 | package login 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/configs" 5 | "github.com/iwind/TeaGo" 6 | ) 7 | 8 | func init() { 9 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 10 | // 自定义登录URL 11 | prefix := "/login" 12 | security := configs.SharedAdminConfig().Security 13 | if security != nil { 14 | prefix = security.NewLoginURL() 15 | } 16 | 17 | server. 18 | Prefix(prefix). 19 | GetPost("", new(IndexAction)). 20 | EndAll() 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/database/deleteTable.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teadb" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type DeleteTableAction actions.Action 9 | 10 | // 删除集合 11 | func (this *DeleteTableAction) Run(params struct { 12 | Table string 13 | }) { 14 | if len(params.Table) > 0 { 15 | err := teadb.SharedDB().DropTable(params.Table) 16 | if err != nil { 17 | this.Fail("删除失败:" + err.Error()) 18 | } 19 | } 20 | this.Success() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/cmsghdr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 socket 8 | 9 | func (h *cmsghdr) len() int { return int(h.Len) } 10 | func (h *cmsghdr) lvl() int { return int(h.Level) } 11 | func (h *cmsghdr) typ() int { return int(h.Type) } 12 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/gopkg.in/ns1/ns1-go.v2/rest/model/account/apikey.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | // APIKey wraps an NS1 /account/apikeys resource 4 | type APIKey struct { 5 | // Read-only fields 6 | ID string `json:"id,omitempty"` 7 | Key string `json:"key,omitempty"` 8 | LastAccess int `json:"last_access,omitempty"` 9 | 10 | Name string `json:"name"` 11 | TeamIDs []string `json:"teams"` 12 | Permissions PermissionsMap `json:"permissions"` 13 | } 14 | -------------------------------------------------------------------------------- /teacluster/configs/item_action.go: -------------------------------------------------------------------------------- 1 | package configs 2 | 3 | type ItemActionString = string 4 | 5 | const ( 6 | ItemActionAdd = "add" 7 | ItemActionChange = "change" 8 | ItemActionRemove = "remove" 9 | ) 10 | 11 | type ItemAction struct { 12 | ItemId string 13 | Action ItemActionString 14 | Item *Item 15 | } 16 | 17 | func NewItemAction(itemId string, action ItemActionString, item *Item) *ItemAction { 18 | return &ItemAction{ 19 | ItemId: itemId, 20 | Action: action, 21 | Item: item, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /teaconfigs/ssl_acme_dns_provider.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | // 自定义ACME DNS解析 4 | type ACMEDNSProvider struct { 5 | apiAuthToken string 6 | } 7 | 8 | func NewACMEDNSProvider(apiAuthToken string) (*ACMEDNSProvider) { 9 | return &ACMEDNSProvider{ 10 | apiAuthToken: apiAuthToken, 11 | } 12 | } 13 | 14 | func (this *ACMEDNSProvider) Present(domain, token, keyAuth string) error { 15 | return nil 16 | } 17 | 18 | func (this *ACMEDNSProvider) CleanUp(domain, token, keyAuth string) error { 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /teaconfigs/web_test.go: -------------------------------------------------------------------------------- 1 | package teaconfigs 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestWebConfig_LoadWebConfig(t *testing.T) { 9 | config, err := LoadWebConfig() 10 | if err != nil { 11 | t.Fatal(err) 12 | } 13 | logs.PrintAsJSON(config, t) 14 | } 15 | 16 | func TestWebConfig_Save(t *testing.T) { 17 | config, err := LoadWebConfig() 18 | if err != nil { 19 | t.Fatal(err) 20 | } 21 | err = config.Save() 22 | if err != nil { 23 | t.Fatal(err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /teaconfigs/widgets/chart_html.go: -------------------------------------------------------------------------------- 1 | package widgets 2 | 3 | import "github.com/iwind/TeaGo/utils/string" 4 | 5 | // HTML Chart 6 | type HTMLChart struct { 7 | HTML string `yaml:"html" json:"html"` 8 | } 9 | 10 | func (this *HTMLChart) AsJavascript(options map[string]interface{}) (code string, err error) { 11 | return ` 12 | var chart = new charts.HTMLChart(); 13 | chart.options = ` + stringutil.JSONEncode(options) + `; 14 | chart.html = ` + stringutil.JSONEncode(this.HTML) + `; 15 | chart.render(); 16 | `, nil 17 | } 18 | -------------------------------------------------------------------------------- /teawaf/checkpoints/request_path_test.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | "testing" 7 | ) 8 | 9 | func TestRequestPathCheckpoint_RequestValue(t *testing.T) { 10 | rawReq, err := http.NewRequest(http.MethodGet, "http://teaos.cn/index?name=lu", nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | 15 | req := requests.NewRequest(rawReq) 16 | checkpoint := new(RequestPathCheckpoint) 17 | t.Log(checkpoint.RequestValue(req, "", nil)) 18 | } 19 | -------------------------------------------------------------------------------- /teawaf/checkpoints/request_scheme_test.go: -------------------------------------------------------------------------------- 1 | package checkpoints 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teawaf/requests" 5 | "net/http" 6 | "testing" 7 | ) 8 | 9 | func TestRequestSchemeCheckpoint_RequestValue(t *testing.T) { 10 | rawReq, err := http.NewRequest(http.MethodGet, "https://teaos.cn/?name=lu", nil) 11 | if err != nil { 12 | t.Fatal(err) 13 | } 14 | 15 | req := requests.NewRequest(rawReq) 16 | checkpoint := new(RequestSchemeCheckpoint) 17 | t.Log(checkpoint.RequestValue(req, "", nil)) 18 | } 19 | -------------------------------------------------------------------------------- /teaweb/actions/default/api/v1/helper.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconst" 5 | "github.com/TeaWeb/code/teaweb/actions/default/api/apiutils" 6 | "github.com/iwind/TeaGo/actions" 7 | ) 8 | 9 | type Helper struct { 10 | } 11 | 12 | func (this *Helper) BeforeAction(action actions.ActionWrapper) bool { 13 | if teaconst.DemoEnabled { 14 | action.Object().Fail("can not call api under demo mode") 15 | return false 16 | } 17 | apiutils.ValidateUser(action) 18 | return true 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/google/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. 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 uuid generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security 8 | // Services. 9 | // 10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to 11 | // maps or compared directly. 12 | package uuid 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv4/control_windows.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 ipv4 6 | 7 | import ( 8 | "syscall" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 14 | // TODO(mikio): implement this 15 | return syscall.EWINDOWS 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv6/control_windows.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 ipv6 6 | 7 | import ( 8 | "syscall" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 14 | // TODO(mikio): implement this 15 | return syscall.EWINDOWS 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 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 | -------------------------------------------------------------------------------- /teacluster/action.go: -------------------------------------------------------------------------------- 1 | package teacluster 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type Action struct { 8 | Id uint64 9 | RequestTime time.Time 10 | RequestId uint64 11 | } 12 | 13 | func (this *Action) Execute() error { 14 | return nil 15 | } 16 | 17 | func (this *Action) OnSuccess(success *SuccessAction) error { 18 | return nil 19 | } 20 | 21 | func (this *Action) OnFail(fail *FailAction) error { 22 | return nil 23 | } 24 | 25 | func (this *Action) BaseAction() *Action { 26 | return this 27 | } 28 | -------------------------------------------------------------------------------- /teaconfigs/notices/media_dingtalk_test.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "testing" 6 | ) 7 | 8 | func TestNoticeDingTalkMedia_Send(t *testing.T) { 9 | if teatesting.IsGlobal() { 10 | return 11 | } 12 | media := NewNoticeDingTalkMedia() 13 | media.WebhookURL = "https://oapi.dingtalk.com/robot/send?access_token=xxx" 14 | resp, err := media.Send("186xxx", "服务器好像出了点小问题", "IP:192.168.1.xxx") 15 | if err != nil { 16 | t.Fatal(err) 17 | } 18 | t.Log(string(resp)) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/challenge/dns01/fqdn.go: -------------------------------------------------------------------------------- 1 | package dns01 2 | 3 | // ToFqdn converts the name into a fqdn appending a trailing dot. 4 | func ToFqdn(name string) string { 5 | n := len(name) 6 | if n == 0 || name[n-1] == '.' { 7 | return name 8 | } 9 | return name + "." 10 | } 11 | 12 | // UnFqdn converts the fqdn into a name removing the trailing dot. 13 | func UnFqdn(name string) string { 14 | n := len(name) 15 | if n != 0 && name[n-1] == '.' { 16 | return name[:n-1] 17 | } 18 | return name 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/OpenDNS/vegadns2client/main.go: -------------------------------------------------------------------------------- 1 | package vegadns2client 2 | 3 | import ( 4 | "net/http" 5 | "time" 6 | ) 7 | 8 | // NewVegaDNSClient - helper to instantiate a client 9 | // Input: url string 10 | // Output: VegaDNSClient 11 | func NewVegaDNSClient(url string) VegaDNSClient { 12 | httpClient := http.Client{Timeout: 15 * time.Second} 13 | return VegaDNSClient{ 14 | client: httpClient, 15 | baseurl: url, 16 | version: "1.0", 17 | token: Token{}, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/ftp_server.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // FTPServer FTPサーバー接続情報 4 | type FTPServer struct { 5 | HostName string `json:",omitempty"` // FTPサーバーホスト名 6 | IPAddress string `json:",omitempty"` // FTPサーバー IPアドレス 7 | User string `json:",omitempty"` // 接続ユーザー名 8 | Password string `json:",omitempty"` // パスワード 9 | 10 | } 11 | 12 | // FTPOpenRequest FTP接続オープンリクエスト 13 | type FTPOpenRequest struct { 14 | ChangePassword bool // パスワード変更フラグ 15 | } 16 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_nginx_status_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "github.com/iwind/TeaGo/logs" 6 | "testing" 7 | ) 8 | 9 | func TestNginxStatusSource_Execute(t *testing.T) { 10 | if !teatesting.RequireNginxStatus() { 11 | return 12 | } 13 | 14 | source := NewNginxStatusSource() 15 | source.URL = "http://127.0.0.1:8888/nginx_status" 16 | value, err := source.Execute(nil) 17 | if err != nil { 18 | t.Fatal(err) 19 | } 20 | logs.PrintAsJSON(value, t) 21 | } 22 | -------------------------------------------------------------------------------- /teaconfigs/notices/meida_qy_weixin_test.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "testing" 6 | ) 7 | 8 | func TestNewNoticeQyWeixinMedia(t *testing.T) { 9 | if teatesting.IsGlobal() { 10 | return 11 | } 12 | m := NewNoticeQyWeixinMedia() 13 | m.CorporateId = "xxx" 14 | m.AppSecret = "xxx" 15 | m.AgentId = "1000003" 16 | resp, err := m.Send("", "标题:报警标题", "内容:报警内容/全员都有") 17 | if err != nil { 18 | t.Log(string(resp)) 19 | t.Fatal(err) 20 | } 21 | t.Log(string(resp)) 22 | } 23 | -------------------------------------------------------------------------------- /teaweb/actions/default/settings/server/http.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type HttpAction actions.Action 9 | 10 | func (this *HttpAction) Run(params struct{}) { 11 | this.Data["error"] = "" 12 | 13 | server, err := teaconfigs.LoadWebConfig() 14 | if err != nil { 15 | this.Data["error"] = "读取配置错误:" + err.Error() 16 | this.Show() 17 | return 18 | } 19 | 20 | this.Data["server"] = server 21 | 22 | this.Show() 23 | } 24 | -------------------------------------------------------------------------------- /teautils/match.go: -------------------------------------------------------------------------------- 1 | package teautils 2 | 3 | import ( 4 | "regexp" 5 | "strings" 6 | ) 7 | 8 | var whitespaceReg = regexp.MustCompile(`\s+`) 9 | 10 | // 关键词匹配 11 | func MatchKeyword(source, keyword string) bool { 12 | if len(keyword) == 0 { 13 | return false 14 | } 15 | 16 | pieces := whitespaceReg.Split(keyword, -1) 17 | source = strings.ToLower(source) 18 | for _, piece := range pieces { 19 | if strings.Index(source, strings.ToLower(piece)) > -1 { 20 | return true 21 | } 22 | } 23 | 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /teaweb/actions/default/index/index.go: -------------------------------------------------------------------------------- 1 | package index 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/db" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | "github.com/iwind/TeaGo/actions" 7 | ) 8 | 9 | type IndexAction actions.Action 10 | 11 | func (this *IndexAction) Run(params struct { 12 | Auth *helpers.UserMustAuth 13 | }) { 14 | // 是否已初始化 15 | config := db.SharedDBConfig() 16 | if !config.IsInitialized { 17 | this.RedirectURL("/install") 18 | return 19 | } 20 | 21 | this.RedirectURL("/dashboard") 22 | } 23 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/certs/acmeUsers.go: -------------------------------------------------------------------------------- 1 | package certs 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type AcmeUsersAction actions.Action 9 | 10 | // ACME用户列表 11 | func (this *AcmeUsersAction) RunGet(params struct {}) { 12 | userList := teaconfigs.SharedACMELocalUserList() 13 | if len(userList.Users) > 0 { 14 | this.Data["users"] = userList.Users 15 | } else { 16 | this.Data["users"] = []*teaconfigs.ACMELocalUser{} 17 | } 18 | 19 | this.Show() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/cdrom.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // CDROM ISOイメージ(CDROM) 4 | type CDROM struct { 5 | *Resource // ID 6 | propName // 名称 7 | propDescription // 説明 8 | propAvailability // 有功状態 9 | propSizeMB // サイズ(MB単位) 10 | propScope // スコープ 11 | propServiceClass // サービスクラス 12 | propStorageClass // ストレージクラス 13 | propStorage // ストレージ 14 | propIcon // アイコン 15 | propTags // タグ 16 | propCreatedAt // 作成日時 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/storage.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // Storage ストレージ 4 | type Storage struct { 5 | *Resource // ID 6 | propName // 名称 7 | propDescription // 説明 8 | propZone // ゾーン 9 | 10 | Class string `json:",omitempty"` // クラス 11 | DiskPlan struct { // ディスクプラン 12 | *Resource // ID 13 | propName // 名称 14 | propStorageClass // ストレージクラス 15 | } `json:",omitempty"` 16 | 17 | //Capacity []string `json:",omitempty"` 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/transip/gotransip/api.go: -------------------------------------------------------------------------------- 1 | package gotransip 2 | 3 | // CancellationTime represents the possible ways of canceling a contract 4 | type CancellationTime string 5 | 6 | var ( 7 | // CancellationTimeEnd specifies to cancel the contract when the contract was 8 | // due to end anyway 9 | CancellationTimeEnd CancellationTime = "end" 10 | // CancellationTimeImmediately specifies to cancel the contract immediately 11 | CancellationTimeImmediately CancellationTime = "immediately" 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*int8)(unsafe.Pointer(&b[0])) 18 | v.Len = uint64(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv4/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errOpNoSupport 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/golang.org/x/net/ipv6/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errOpNoSupport 13 | } 14 | -------------------------------------------------------------------------------- /teaconfigs/shared/regexp_test.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/assert" 5 | "testing" 6 | ) 7 | 8 | func TestRegexp(t *testing.T) { 9 | a := assert.NewAssertion(t) 10 | 11 | a.IsTrue(RegexpFloatNumber.MatchString("123")) 12 | a.IsTrue(RegexpFloatNumber.MatchString("123.456")) 13 | a.IsFalse(RegexpFloatNumber.MatchString(".456")) 14 | a.IsFalse(RegexpFloatNumber.MatchString("abc")) 15 | a.IsFalse(RegexpFloatNumber.MatchString("123.")) 16 | a.IsFalse(RegexpFloatNumber.MatchString("123.456e7")) 17 | } 18 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/clientDisconnect.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaproxy" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type ClientDisconnectAction actions.Action 9 | 10 | // 断开客户端连接 11 | func (this *ClientDisconnectAction) RunPost(params struct { 12 | ServerId string 13 | Addr string // client addr 14 | }) { 15 | for _, listener := range teaproxy.SharedManager.FindServerListeners(params.ServerId) { 16 | listener.CloseTCPClient(params.Addr) 17 | } 18 | this.Success() 19 | } 20 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/restart.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaproxy" 5 | "github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils" 6 | "github.com/iwind/TeaGo/actions" 7 | ) 8 | 9 | type RestartAction actions.Action 10 | 11 | // 试图重启所有服务 12 | func (this *RestartAction) Run(params struct{}) { 13 | err := teaproxy.SharedManager.Restart() 14 | if err != nil { 15 | this.Fail("重启失败:" + err.Error()) 16 | } 17 | 18 | proxyutils.FinishChange() 19 | 20 | this.Refresh().Success() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/docs/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default clean hugo hugo-build 2 | 3 | default: hugo 4 | 5 | clean: 6 | rm -rf public/ 7 | 8 | 9 | hugo-build: clean hugo-themes 10 | hugo --enableGitInfo --source . 11 | 12 | hugo: 13 | hugo server --disableFastRender --enableGitInfo --watch --source . 14 | # hugo server -D 15 | 16 | hugo-themes: 17 | rm -rf themes 18 | mkdir themes 19 | git clone --depth=1 https://github.com/matcornic/hugo-theme-learn.git themes/hugo-theme-learn 20 | rm -rf themes/hugo-theme-learn/.git 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/sacloud/libsacloud/sacloud/prop_disks.go: -------------------------------------------------------------------------------- 1 | package sacloud 2 | 3 | // propDisks ディスク配列内包型 4 | type propDisks struct { 5 | Disks []Disk `json:",omitempty"` // ディスク 6 | } 7 | 8 | // GetDisks ディスク配列 取得 9 | func (p *propDisks) GetDisks() []Disk { 10 | return p.Disks 11 | } 12 | 13 | // GetDiskIDs ディスクID配列を返す 14 | func (p *propDisks) GetDiskIDs() []int64 { 15 | 16 | ids := []int64{} 17 | for _, disk := range p.Disks { 18 | ids = append(ids, disk.ID) 19 | } 20 | return ids 21 | 22 | } 23 | -------------------------------------------------------------------------------- /teaconfigs/widgets/chart_javascript_test.go: -------------------------------------------------------------------------------- 1 | package widgets 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/maps" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | func TestJavascriptChart_AsJavascript(t *testing.T) { 10 | c := new(JavascriptChart) 11 | c.Code = ` 12 | var chart = new charts.HTMLChart(); 13 | chart.options.name = "Hello"; 14 | chart.render(); 15 | ` 16 | before := time.Now() 17 | t.Log(c.AsJavascript(maps.Map{ 18 | "name": "Hello,World", 19 | "columns": 2, 20 | })) 21 | t.Log(time.Since(before).Seconds(), "seconds") 22 | } 23 | -------------------------------------------------------------------------------- /teaconfigs/widgets/widget_test.go: -------------------------------------------------------------------------------- 1 | package widgets 2 | 3 | import ( 4 | "github.com/iwind/TeaGo/logs" 5 | "testing" 6 | ) 7 | 8 | func TestLoadAllWidgets(t *testing.T) { 9 | widgets := LoadAllWidgets() 10 | for _, widget := range widgets { 11 | t.Log(widget) 12 | logs.PrintAsJSON(widget) 13 | } 14 | } 15 | 16 | func TestNewWidgetFromId(t *testing.T) { 17 | { 18 | widget := NewWidgetFromId("LjPKIDfrkThkO3kX") 19 | t.Log(widget) 20 | } 21 | 22 | { 23 | widget := NewWidgetFromId("123456") 24 | t.Log(widget) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/certs/acmeDeleteTask.go: -------------------------------------------------------------------------------- 1 | package certs 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type AcmeDeleteTaskAction actions.Action 9 | 10 | // 删除ACME任务 11 | func (this *AcmeDeleteTaskAction) RunPost(params struct { 12 | TaskId string 13 | }) { 14 | list := teaconfigs.SharedSSLCertList() 15 | list.RemoveTask(params.TaskId) 16 | err := list.Save() 17 | if err != nil { 18 | this.Fail("保存失败:" + err.Error()) 19 | } 20 | 21 | this.Success() 22 | } 23 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/servergroups/delete.go: -------------------------------------------------------------------------------- 1 | package servergroups 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type DeleteAction actions.Action 9 | 10 | // 删除分组 11 | func (this *DeleteAction) RunPost(params struct { 12 | GroupId string 13 | }) { 14 | groupList := teaconfigs.SharedServerGroupList() 15 | groupList.Remove(params.GroupId) 16 | err := groupList.Save() 17 | if err != nil { 18 | this.Fail("保存失败:" + err.Error()) 19 | } 20 | 21 | this.Success() 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package request 4 | 5 | import "github.com/aws/aws-sdk-go/aws" 6 | 7 | // setContext updates the Request to use the passed in context for cancellation. 8 | // Context will also be used for request retry delay. 9 | // 10 | // Creates shallow copy of the http.Request with the WithContext method. 11 | func setRequestContext(r *Request, ctx aws.Context) { 12 | r.context = ctx 13 | r.HTTPRequest.Cancel = ctx.Done() 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go: -------------------------------------------------------------------------------- 1 | package tokens 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // CreateURL generates the URL used to create new Tokens. 6 | func CreateURL(client *gophercloud.ServiceClient) string { 7 | return client.ServiceURL("tokens") 8 | } 9 | 10 | // GetURL generates the URL used to Validate Tokens. 11 | func GetURL(client *gophercloud.ServiceClient, token string) string { 12 | return client.ServiceURL("tokens", token) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs 17 | -------------------------------------------------------------------------------- /teaconfigs/agents/schedule_range.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | // Schedule时间范围 4 | type ScheduleRangeConfig struct { 5 | Every bool `yaml:"every" json:"every"` 6 | From int `yaml:"from" json:"from"` 7 | To int `yaml:"to" json:"to"` 8 | Step int `yaml:"step" json:"step"` 9 | Value int `yaml:"value" json:"value"` 10 | } 11 | 12 | // 获取新对象 13 | func NewScheduleRangeConfig() *ScheduleRangeConfig { 14 | return &ScheduleRangeConfig{ 15 | Every: false, 16 | From: -1, 17 | To: -1, 18 | Step: -1, 19 | Value: -1, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /teaconfigs/api/api_auth_none.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import "net/http" 4 | 5 | // 默认认证(无认证) 6 | type APIAuthNoneAuth struct { 7 | } 8 | 9 | func NewAPIAuthNoneAuth(options map[string]interface{}) APIAuthInterface { 10 | return &APIAuthNoneAuth{} 11 | } 12 | 13 | func (this *APIAuthNoneAuth) UniqueKey() string { 14 | return "none" 15 | } 16 | 17 | func (this *APIAuthNoneAuth) KeyFromRequest(req *http.Request) string { 18 | return "" 19 | } 20 | 21 | func (this *APIAuthNoneAuth) MatchRequest(req *http.Request) bool { 22 | return true 23 | } 24 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/groups/move.go: -------------------------------------------------------------------------------- 1 | package groups 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs/agents" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type MoveAction actions.Action 9 | 10 | // 移动分组位置 11 | func (this *MoveAction) Run(params struct { 12 | FromIndex int 13 | ToIndex int 14 | }) { 15 | config := agents.SharedGroupList() 16 | config.Move(params.FromIndex, params.ToIndex) 17 | err := config.Save() 18 | if err != nil { 19 | this.Fail("保存失败:" + err.Error()) 20 | } 21 | 22 | this.Success() 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/acme/api/internal/sender/useragent.go: -------------------------------------------------------------------------------- 1 | package sender 2 | 3 | // CODE GENERATED AUTOMATICALLY 4 | // THIS FILE MUST NOT BE EDITED BY HAND 5 | 6 | const ( 7 | // ourUserAgent is the User-Agent of this underlying library package. 8 | ourUserAgent = "xenolf-acme/2.6.0" 9 | 10 | // ourUserAgentComment is part of the UA comment linked to the version status of this underlying library package. 11 | // values: detach|release 12 | // NOTE: Update this with each tagged release. 13 | ourUserAgentComment = "detach" 14 | ) 15 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/stretchr/testify/require/forward_requirements.go: -------------------------------------------------------------------------------- 1 | package require 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs 17 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/google.golang.org/api/gensupport/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 gensupport is an internal implementation detail used by code 6 | // generated by the google-api-go-generator tool. 7 | // 8 | // This package may be modified at any time without regard for backwards 9 | // compatibility. It should not be used directly by API users. 10 | package gensupport 11 | -------------------------------------------------------------------------------- /teaconfigs/agents/source_teaweb_test.go: -------------------------------------------------------------------------------- 1 | package agents 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teatesting" 5 | "github.com/iwind/TeaGo/logs" 6 | "testing" 7 | ) 8 | 9 | func TestTeaWebSource_Execute(t *testing.T) { 10 | if !teatesting.RequireTeaWebServer() { 11 | return 12 | } 13 | 14 | source := NewTeaWebSource() 15 | source.API = "http://127.0.0.1:7777/api/monitor?TeaKey=z8O4MuXixbKH6aiVyZigYTxxovRblR3u" 16 | value, err := source.Execute(nil) 17 | if err != nil { 18 | t.Fatal(err) 19 | } 20 | logs.PrintAsJSON(value, t) 21 | } 22 | -------------------------------------------------------------------------------- /teaweb/actions/default/agents/notices/init.go: -------------------------------------------------------------------------------- 1 | package notices 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaweb/configs" 5 | "github.com/TeaWeb/code/teaweb/helpers" 6 | "github.com/iwind/TeaGo" 7 | ) 8 | 9 | func init() { 10 | TeaGo.BeforeStart(func(server *TeaGo.Server) { 11 | server.Prefix("/agents/notices"). 12 | Helper(&helpers.UserMustAuth{ 13 | Grant: configs.AdminGrantAgent, 14 | }). 15 | Helper(new(Helper)). 16 | Get("", new(IndexAction)). 17 | Post("/setRead", new(SetReadAction)). 18 | EndAll() 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /teaweb/actions/default/proxy/frontend.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "github.com/TeaWeb/code/teaconfigs" 5 | "github.com/iwind/TeaGo/actions" 6 | ) 7 | 8 | type FrontendAction actions.Action 9 | 10 | // 前端设置 11 | func (this *FrontendAction) Run(params struct { 12 | ServerId string 13 | }) { 14 | this.Data["selectedTab"] = "frontend" 15 | 16 | server := teaconfigs.NewServerConfigFromId(params.ServerId) 17 | if server == nil { 18 | this.Fail("找不到Server") 19 | } 20 | 21 | this.Data["server"] = server 22 | 23 | this.Show() 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "net/url" 7 | ) 8 | 9 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 10 | req := new(http.Request) 11 | *req = *r 12 | req.URL = &url.URL{} 13 | *req.URL = *r.URL 14 | req.Body = body 15 | 16 | req.Header = http.Header{} 17 | for k, v := range r.Header { 18 | for _, vv := range v { 19 | req.Header.Add(k, vv) 20 | } 21 | } 22 | 23 | return req 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-acme/lego/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package request 4 | 5 | import "github.com/aws/aws-sdk-go/aws" 6 | 7 | // setContext updates the Request to use the passed in context for cancellation. 8 | // Context will also be used for request retry delay. 9 | // 10 | // Creates shallow copy of the http.Request with the WithContext method. 11 | func setRequestContext(r *Request, ctx aws.Context) { 12 | r.context = ctx 13 | r.HTTPRequest = r.HTTPRequest.WithContext(ctx) 14 | } 15 | --------------------------------------------------------------------------------