black-socks-server
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -0,1 +1,3 @@ | ||
const net = require('net') | ||
class chrome | ||
@@ -6,9 +8,38 @@ { | ||
let target_end = 1+buf.readUInt8() | ||
let target = buf.slice(1,target_end).toString() | ||
console.log(target_end,target) | ||
let target = buf.slice(1,target_end).toString().split(':') | ||
let client_hello = buf.slice(target_end) | ||
console.log(client_hello) | ||
this.init_stream(target[0],target[1],client_hello) | ||
} | ||
init_stream(address,port,hello) | ||
{ | ||
this.log('try connect to host....') | ||
this.stream = net.createConnection(port,address) | ||
this.stream.on('error',(err)=>{ | ||
this.log('[chrome error]'+err.message) | ||
}) | ||
this.stream.on('close',(hadError)=>{ | ||
this.log('[chrome close]hadError:'+hadError) | ||
}) | ||
this.stream.on('end',(err)=>{ | ||
if(err) throw err | ||
this.log('host signals the end of transmission') | ||
}) | ||
this.stream.on('connect',()=>{ | ||
this.log('connect success try to say hello...') | ||
this.stream.write(hello) | ||
}) | ||
this.stream.on('data',(buf)=>{ | ||
this.log(`receive data from host ${buf.length} bytes`) | ||
console.log(buf) | ||
}) | ||
} | ||
} | ||
module.exports = chrome |
{ | ||
"name": "black-socks-server", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
3791
87
3