diff --git a/.eslintignore b/.eslintignore index 1e6079d2..4e4d2883 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ bin/wwwroot/**/highlight-tsw.js bin/wwwroot/**/zepto.min.js -bin/lib/api/L5/L5.api.js \ No newline at end of file +bin/lib/api/L5/L5.api.js diff --git a/.travis.yml b/.travis.yml index 7c525c7f..81230975 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ -sudo: false -language: node_js -node_js: - - "8" - - "9" - -script: - - npm run lint - - npm test && npm run coverage \ No newline at end of file +sudo: false +language: node_js +node_js: + - "8" + - "9" + +script: + - npm run lint + - npm test && npm run coverage diff --git a/LICENSE b/LICENSE index 39f47434..79c16d9b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Tencent is pleased to support the open source community by making Tencent Server Web available. +Tencent is pleased to support the open source community by making Tencent Server Web available. Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved. If you have downloaded a copy of the Tencent Server Web binary from Tencent, please note that the Tencent Server Web binary is licensed under the MIT License. If you have downloaded a copy of the Tencent Server Web source code from Tencent, please note that Tencent Server Web source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of Tencent Server Web into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within Tencent Server Web. @@ -6,7 +6,7 @@ A copy of the MIT License is included in this file. Other dependencies and licenses: -Open Source Software Licensed Under the BSD 3-Clause License: +Open Source Software Licensed Under the BSD 3-Clause License: ---------------------------------------------------------------------------------------- 1. qs 6.5.0 Copyright (c) 2014 Nathan LaFreniere and other contributors. @@ -29,7 +29,7 @@ Redistribution and use in source and binary forms, with or without modification, THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Open Source Software Licensed Under the MIT License: +Open Source Software Licensed Under the MIT License: ---------------------------------------------------------------------------------------- 1. node-archiver 0.16.0 Copyright (c) 2012-2014 Chris Talkington, contributors. @@ -48,7 +48,7 @@ Copyright (c) 2010 Arnout Kazemier,3rd-Eden 5. seajs 1.3.0 Copyright (c) 2012 Frank Wang, http://seajs.org/ -6. Semantic-UI 2.1.5 +6. Semantic-UI 2.1.5 Copyright 2014 Contributors 7. ws 2.2.1 diff --git a/README.md b/README.md index 72f3feec..91f54ab7 100644 --- a/README.md +++ b/README.md @@ -1,84 +1,84 @@ -# [Tencent Server Web](https://tswjs.org) - - -[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](./LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/TSW/pulls) [![wiki](https://img.shields.io/badge/Wiki-open-brightgreen.svg)](https://tswjs.org/guide/index) ![node](https://img.shields.io/badge/node-%3E%3D8.0.0-green.svg) [![Build Status](https://travis-ci.org/Tencent/TSW.svg?branch=master)](https://travis-ci.org/Tencent/TSW) - ---- - - -[English Version](./README_en.md) - - -## 简介 - -Tencent Server Web(TSW),是一套面向WEB前端开发者,以提升问题定位效率为初衷,提供染色抓包、全息日志和异常发现的Node.js基础设施。TSW关注业务的运维监控能力,适用于http、websocket协议的业务场景,可无缝与即有项目进行整合。支持公有云、私有云和本地部署。 - -![tsw](./static/resource/structure.png) - -#### 染色抓包 - -TSW 支持用户维度的抓包 - -- 对于指定的用户(白名单内) -- 请求生命周期内,对请求本身及衍生请求进行抓包 -- 提供抓包查看、下载等功能 -- 抓包格式支持Fiddler和Charles,以及HAR - -#### 全息日志 - -TSW 提供用户维度的全息日志帮助开发者快速定位问题 - -- 对请求生命周期内的日志,采用全息的方式记录,形成流水 -- 流水按用户维度聚合 -- 提供查看功能,快速定位问题原因 - -#### 异常发现 - -- 内置指标实时监控 -- 代码异常推送告警 - -## 环境要求 - -- 操作系统: Windows/Mac/Linux -- Node.js: 8.0.0+ - -## 开始 - -1. 需先安装[Node.js](https://nodejs.org/en/download/),并且Node.js的版本需不低于8.0.0。 -1. 安装 -- `git clone https://github.com/Tencent/TSW.git` -1. 切换工作目录 -- `cd TSW` -1. 补全依赖 -- `npm install --no-optional` -1. 配置 -- 修改 `TSW/conf/config.js`,更多配置项参考 [手册](https://tswjs.org/doc/api/config) - - ```js - this.httpAddress = '0.0.0.0'; - - this.httpPort = 80; - ``` - -1. 启动 -- `node index.js` -1. 预览 -- 打开浏览器,访问 `http://127.0.0.1/` 即可 - -## 官方网站 - -- 更多教程 [https://tswjs.org/guide/index](https://tswjs.org/guide/index) - -- 使用手册 [https://tswjs.org/doc/api/index](https://tswjs.org/doc/api/index) - -## 配套设施 - -- TSW开放平台 [https://tswjs.org](https://tswjs.org) - -## 贡献代码 - -如果您使用过程中发现Bug,请通过 [https://github.com/Tencent/TSW/issues](https://github.com/Tencent/TSW/issues) 来提交并描述相关的问题,您也可以在这里查看其它的issue,通过解决这些issue来贡献代码。 - -如果您是第一次贡献代码,请阅读 [CONTRIBUTING](./CONTRIBUTING.md) 了解我们的贡献流程,并提交 pull request 给我们。 - -## 许可证 - -Tencent Server Web 的开源协议为 MIT, 详情参见 [LICENSE](./LICENSE) 。 - -## 联系方式 - +# [Tencent Server Web](https://tswjs.org) + + +[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](./LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/TSW/pulls) [![wiki](https://img.shields.io/badge/Wiki-open-brightgreen.svg)](https://tswjs.org/guide/index) ![node](https://img.shields.io/badge/node-%3E%3D8.0.0-green.svg) [![Build Status](https://travis-ci.org/Tencent/TSW.svg?branch=master)](https://travis-ci.org/Tencent/TSW) + +--- + + +[English Version](./README_en.md) + + +## 简介 + +Tencent Server Web(TSW),是一套面向WEB前端开发者,以提升问题定位效率为初衷,提供染色抓包、全息日志和异常发现的Node.js基础设施。TSW关注业务的运维监控能力,适用于http、websocket协议的业务场景,可无缝与即有项目进行整合。支持公有云、私有云和本地部署。 + +![tsw](./static/resource/structure.png) + +#### 染色抓包 + +TSW 支持用户维度的抓包 + +- 对于指定的用户(白名单内) +- 请求生命周期内,对请求本身及衍生请求进行抓包 +- 提供抓包查看、下载等功能 +- 抓包格式支持Fiddler和Charles,以及HAR + +#### 全息日志 + +TSW 提供用户维度的全息日志帮助开发者快速定位问题 + +- 对请求生命周期内的日志,采用全息的方式记录,形成流水 +- 流水按用户维度聚合 +- 提供查看功能,快速定位问题原因 + +#### 异常发现 + +- 内置指标实时监控 +- 代码异常推送告警 + +## 环境要求 + +- 操作系统: Windows/Mac/Linux +- Node.js: 8.0.0+ + +## 开始 + +1. 需先安装[Node.js](https://nodejs.org/en/download/),并且Node.js的版本需不低于8.0.0。 +1. 安装 -- `git clone https://github.com/Tencent/TSW.git` +1. 切换工作目录 -- `cd TSW` +1. 补全依赖 -- `npm install --no-optional` +1. 配置 -- 修改 `TSW/conf/config.js`,更多配置项参考 [手册](https://tswjs.org/doc/api/config) + + ```js + this.httpAddress = '0.0.0.0'; + + this.httpPort = 80; + ``` + +1. 启动 -- `node index.js` +1. 预览 -- 打开浏览器,访问 `http://127.0.0.1/` 即可 + +## 官方网站 + +- 更多教程 [https://tswjs.org/guide/index](https://tswjs.org/guide/index) + +- 使用手册 [https://tswjs.org/doc/api/index](https://tswjs.org/doc/api/index) + +## 配套设施 + +- TSW开放平台 [https://tswjs.org](https://tswjs.org) + +## 贡献代码 + +如果您使用过程中发现Bug,请通过 [https://github.com/Tencent/TSW/issues](https://github.com/Tencent/TSW/issues) 来提交并描述相关的问题,您也可以在这里查看其它的issue,通过解决这些issue来贡献代码。 + +如果您是第一次贡献代码,请阅读 [CONTRIBUTING](./CONTRIBUTING.md) 了解我们的贡献流程,并提交 pull request 给我们。 + +## 许可证 + +Tencent Server Web 的开源协议为 MIT, 详情参见 [LICENSE](./LICENSE) 。 + +## 联系方式 + tsw@tencent.com \ No newline at end of file diff --git a/README_en.md b/README_en.md index 26186c4d..42071040 100644 --- a/README_en.md +++ b/README_en.md @@ -1,78 +1,78 @@ - -## Introduction - -Tencent Server side Web(TSW) is a Node.js infrastructure which is designed for improving the efficiency of locating problems, providing multiple functions for front-end developers: online dyeing/packet capture, holographic logging and abnormity discovery. TSW, focusing on the operation and maintenance of businesses, is suitable for web and mobile applications based on http or websocket protocols. It can be readily integrated with existing systems. - -![tsw](./static/resource/structure_en.png) - -#### Online dyeing/packet capture - -TSW supports packet capture based on user granularity. - -- Dye labelled user by users' feature IDs -- Collect packets within corresponding requests' lifecycles for dyed users. -- Provid functions to view and download captured packets. -- Support Fiddler(windows), Charles(mac) and HAR format. - -#### Holographic logging - -TSW provides powerful logging abilities for developers to locate problems quickly. - -- Record packets within requests' lifecycles holographically in the form of log flow. -- Aggregate log flows based on user granularity. -- View log flows by user features. Help analyzing and solving problems efficiently. - -#### Abnormity discovery - -- Monitor preset indicators in real time -- Push alarms for code exceptions - -## Requirement -- OS: Windows/Mac/Linux -- Node.js: 8.0.0+ - -## Getting started - -- Before installing, [download and install Node.js](https://nodejs.org/en/download/). Node.js 8.0.0 or higher is required. - -- Clone the repo: `git clone https://github.com/Tencent/TSW.git` - -- Enter the TSW: `cd TSW` - -- NPM : `npm install --no-optional` - -- Config ``TSW/conf/config.js`` - ```js - this.httpAddress = '0.0.0.0' - - this.httpPort = 80; - ``` - -- Run `node index.js` to start Node.js server - -- Open `http://127.0.0.1/` in your browser. - - -## Documentation - -- More Tutorials [https://tswjs.org/guide/index](https://tswjs.org/guide/index) - -- Manual [https://tswjs.org/doc/api/index](https://tswjs.org/doc/api/index) - -## Supporting facilities - -- TSW Open Platform [https://tswjs.org](https://tswjs.org) - -## Contributing - -Find a bug or have a feature request? Please read the [issues](https://github.com/Tencent/TSW/issues) guidelines and search for existing and closed issues. - -If your problem or idea is not addressed yet, please read through our [contributing guidelines](./CONTRIBUTING.md) and open a new [issues](https://github.com/Tencent/TSW/issues). - -## License - -Tencent Server Web is released under [MIT license](./LICENSE). - -## Contacts - -tsw@tencent.com + +## Introduction + +Tencent Server side Web(TSW) is a Node.js infrastructure which is designed for improving the efficiency of locating problems, providing multiple functions for front-end developers: online dyeing/packet capture, holographic logging and abnormity discovery. TSW, focusing on the operation and maintenance of businesses, is suitable for web and mobile applications based on http or websocket protocols. It can be readily integrated with existing systems. + +![tsw](./static/resource/structure_en.png) + +#### Online dyeing/packet capture + +TSW supports packet capture based on user granularity. + +- Dye labelled user by users' feature IDs +- Collect packets within corresponding requests' lifecycles for dyed users. +- Provid functions to view and download captured packets. +- Support Fiddler(windows), Charles(mac) and HAR format. + +#### Holographic logging + +TSW provides powerful logging abilities for developers to locate problems quickly. + +- Record packets within requests' lifecycles holographically in the form of log flow. +- Aggregate log flows based on user granularity. +- View log flows by user features. Help analyzing and solving problems efficiently. + +#### Abnormity discovery + +- Monitor preset indicators in real time +- Push alarms for code exceptions + +## Requirement +- OS: Windows/Mac/Linux +- Node.js: 8.0.0+ + +## Getting started + +- Before installing, [download and install Node.js](https://nodejs.org/en/download/). Node.js 8.0.0 or higher is required. + +- Clone the repo: `git clone https://github.com/Tencent/TSW.git` + +- Enter the TSW: `cd TSW` + +- NPM : `npm install --no-optional` + +- Config ``TSW/conf/config.js`` + ```js + this.httpAddress = '0.0.0.0' + + this.httpPort = 80; + ``` + +- Run `node index.js` to start Node.js server + +- Open `http://127.0.0.1/` in your browser. + + +## Documentation + +- More Tutorials [https://tswjs.org/guide/index](https://tswjs.org/guide/index) + +- Manual [https://tswjs.org/doc/api/index](https://tswjs.org/doc/api/index) + +## Supporting facilities + +- TSW Open Platform [https://tswjs.org](https://tswjs.org) + +## Contributing + +Find a bug or have a feature request? Please read the [issues](https://github.com/Tencent/TSW/issues) guidelines and search for existing and closed issues. + +If your problem or idea is not addressed yet, please read through our [contributing guidelines](./CONTRIBUTING.md) and open a new [issues](https://github.com/Tencent/TSW/issues). + +## License + +Tencent Server Web is released under [MIT license](./LICENSE). + +## Contacts + +tsw@tencent.com diff --git a/index.js b/index.js index bc494f5b..6961c4b4 100644 --- a/index.js +++ b/index.js @@ -5,10 +5,10 @@ * http://opensource.org/licenses/MIT * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -"use strict"; +'use strict'; if(process.mainModule === module){ - require('./bin/proxy/index.js'); + require('./bin/proxy/index.js'); }else{ - module.exports = require('./plug.js'); -} \ No newline at end of file + module.exports = require('./plug.js'); +} diff --git a/package.json b/package.json index 517006f1..86216014 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "TSW", "version": "1.0.1449", "scripts": { - "lint": "eslint examples bin/wwwroot bin/proxy bin/tsw bin/lib test --fix", + "lint": "eslint examples bin test --fix", "precommit": "lint-staged", "test": "mocha --recursive test/bin", "coverage": "nyc mocha --recursive test/bin"