Skip to content

Commit

Permalink
refactor: change the file structure to npm style
Browse files Browse the repository at this point in the history
  • Loading branch information
purpose233 committed May 19, 2019
1 parent fb85f65 commit 20c9987
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm install
## Usage
Server side:
```
node ./src/server.js -c <serverConfigFilePath>
node ./src/server -c <serverConfigFilePath>
```
A demo of server config file is shown as follow:
```json
Expand All @@ -37,7 +37,7 @@ A demo of server config file is shown as follow:

Client side:
```
node ./src/client.js -c <clientConfigFilePath>
node ./src/client -c <clientConfigFilePath>
```
A demo of client config file is shown as follow:
```json
Expand Down
11 changes: 7 additions & 4 deletions src/client.js → bin/client
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env node

const program = require('commander');
const {logConfigError} = require('./common/log');
const {parseClientConfig} = require('./common/config');
const {createTcpController} = require('./tcpClient');
const {createUdpController} = require('./udpClient');
const {logConfigError} = require('../lib/common/log');
const {parseClientConfig} = require('../lib/common/config');
const {createTcpController} = require('../lib/tcpClient');
const {createUdpController} = require('../lib/udpClient');

program
.version('0.0.1')
Expand All @@ -11,6 +13,7 @@ program

const filePath = program.config;
const udpTimeout = 10;
const udpBindPortThreshold = 10000;

const parseResult = parseClientConfig(filePath);
if (typeof parseResult !== 'object') {
Expand Down
12 changes: 7 additions & 5 deletions src/server.js → bin/server
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env node

const program = require('commander');
const EventEmitter = require('events').EventEmitter;
const {parseServerConfig} = require('./common/config');
const {logConfigError} = require('./common/log');
const {createTunnelServer} = require('./tunnelServer');
const {createTcpProxies} = require('./tcpServer');
const {createUdpProxies} = require('./udpServer');
const {parseServerConfig} = require('../lib/common/config');
const {logConfigError} = require('../lib/common/log');
const {createTunnelServer} = require('../lib/tunnelServer');
const {createTcpProxies} = require('../lib/tcpServer');
const {createUdpProxies} = require('../lib/udpServer');

program
.version('0.0.1')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "socket-traversal",
"version": "1.0.0",
"description": "",
"version": "0.0.1",
"description": "A tool for UDP/TCP internal network penetration.",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"bin": {
"st-client": "bin/client",
"st-server": "bin/server"
},
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://github.com/purpose233/socket-traversal.git"
Expand Down

0 comments on commit 20c9987

Please sign in to comment.