-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 14c81c3
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
HTTP的跳版網站滿多的,<br /> | ||
但bbs的卻頗少,<br /> | ||
因此特別用nodejs寫了一個給朋友用,<br /> | ||
順便將原始碼丟上github,有興趣的人可以自己架來玩。<br /> | ||
<br /><br /> | ||
使用方法:<br /> | ||
1.安裝<a href="http://nodejs.org/" target="_blank">nodejs</a>。<br /> | ||
2.下載檔案。<br /> | ||
3.在命令列執行node index.js [PORT]。<br /> | ||
4.[PORT]中輸入的是跳板站的port位置,如node index.js 13667。(這邊設成你家公司沒有鎖的port就對了)<br /> | ||
5.想要跳板的人透過你架站的ip、port連線進來,便可輸入要連接bbs位置轉接過去。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
var net = require('net') | ||
, server = net.createServer() | ||
; | ||
|
||
server.on('connection' ,function(conn) { | ||
var client | ||
, host = | ||
{'host' : 'ptt.cc' | ||
,'port' : '23' | ||
} | ||
, status = 'host' | ||
, endClient = | ||
function() { | ||
//console.log(fromIP + ' already end!'); | ||
if (client && typeof client.end === 'function') { | ||
client.end(); | ||
} | ||
} | ||
, endConn = | ||
function() { | ||
//console.log(fromIP + ' already end!'); | ||
conn.end(); | ||
} | ||
, input = '' | ||
, fromIP = conn.remoteAddress | ||
; | ||
//console.log(conn.remoteAddress + ' connect!'); | ||
conn.write('Input Connect IP[ptt2.cc]:'); | ||
conn.on('close', endClient); | ||
conn.on('end', endClient); | ||
conn.on('error', endClient); | ||
conn.on('timeout', endClient); | ||
conn.on('data', function(d) { | ||
var dJson | ||
, dStr | ||
; | ||
switch (status) { | ||
case 'connected' : | ||
client.write(d); | ||
break; | ||
default: | ||
dJson = d.toJSON(); | ||
dStr = d.toString(); | ||
conn.write(dStr); | ||
if (dJson.length === 1 && dJson[0] === 13) { | ||
conn.write('\r\n'); | ||
if (input) { | ||
host[status] = input; | ||
} | ||
if (status === 'host') { | ||
conn.write('Input Connect Port[23]:'); | ||
status = 'port'; | ||
} | ||
else if (status === 'port') { | ||
client = net.connect(host); | ||
client.on("data", function(d){ | ||
conn.write(d); | ||
}); | ||
client.on("close", endConn); | ||
client.on("end", endConn); | ||
client.on("error", endConn); | ||
client.on("timeout", endConn); | ||
status = 'connected'; | ||
} | ||
input = ''; | ||
} | ||
else { | ||
input += dStr; | ||
} | ||
break; | ||
} | ||
}); | ||
}); | ||
server.listen(process.argv[2] || 80); | ||
server.on('error', function() { | ||
console.log(arguments); | ||
}) |