Antunnel use network byte order

This commit is contained in:
lxsang 2021-11-27 15:05:10 +01:00
parent 50acc59d0b
commit 5acda74ba4
8 changed files with 17 additions and 11 deletions

View File

@ -5,6 +5,7 @@ talk to server side applications via the [`antd-tunnel-pligin`](https://github.c
using a single websocket API.
## Changes log
- v0.2.0-b User multiple bytes interger network byte order in frame format
- v0.1.9-b Use the new client size minima frame format (reduces frame overhead)
- v0.1.4-a Reduce frame overhead
- v0.1.3-a Remove magic number in the frame to reduce frame overhead

View File

@ -5,6 +5,7 @@ talk to server side applications via the [`antd-tunnel-pligin`](https://github.c
using a single websocket API.
## Changes log
- v0.2.0-b User multiple bytes interger network byte order in frame format
- v0.1.9-b Use the new client size minima frame format (reduces frame overhead)
- v0.1.4-a Reduce frame overhead
- v0.1.3-a Remove magic number in the frame to reduce frame overhead

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@lxsang.me"
},
"version":"0.1.9-b",
"version":"0.2.0-b",
"category":"Library",
"iconclass":"fa fa-adn",
"mimes":["none"],

Binary file not shown.

View File

@ -39,19 +39,23 @@ Msg.decode = (raw) ->
Msg.bytes_of = (x,s) ->
s = 2 unless s is 4
bytes=new Uint8Array(s)
bytes[0]=x & (255)
x=x>>8
if s is 2
bytes[1]=x & (255)
return bytes unless s is 4
x=x>>8
bytes[0]=x & (255)
return bytes
bytes[3]=x & (255)
x=x>>8
bytes[2]=x & (255)
x=x>>8
bytes[3]=x & (255)
bytes[1]=x & (255)
x=x>>8
bytes[0]=x & (255)
return bytes
Msg.int_from = (bytes, offset, size) ->
return (bytes[offset] | (bytes[offset+1]<<8)) unless size is 4
return (bytes[offset] | (bytes[offset+1]<<8) | (bytes[offset+2]<<16) | (bytes[offset+3] << 24))
return (bytes[offset+1] | (bytes[offset]<<8)) unless size is 4
return (bytes[offset+3] | (bytes[offset+2]<<8) | (bytes[offset+1]<<16) | (bytes[offset] << 24))
Msg.OK = 0
Msg.ERROR = 1

View File

@ -9,7 +9,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@lxsang.me"
},
"version":"0.1.9-b",
"version":"0.2.0-b",
"category":"Library",
"iconclass":"fa fa-adn",
"mimes":["none"],

View File

@ -55,7 +55,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/README.md",
"category": "Library",
"author": "Xuan Sang LE",
"version": "0.1.9-b",
"version": "0.2.0-b",
"dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/build/release/Antunnel.zip"
},