update Antunnel and its dependencies

This commit is contained in:
lxsang 2020-12-28 12:37:17 +00:00
parent 2f7a677463
commit 3808a4ed10
9 changed files with 26 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

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

Binary file not shown.

View File

@ -12,7 +12,7 @@ class Msg
as_raw:() -> as_raw:() ->
length = 11 + @header.size length = 13 + @header.size
arr = new Uint8Array(length) arr = new Uint8Array(length)
arr.set(Msg.MAGIC_START, 0) arr.set(Msg.MAGIC_START, 0)
arr[2] = @header.type arr[2] = @header.type
@ -20,11 +20,11 @@ class Msg
arr.set(bytes,3) arr.set(bytes,3)
bytes = Msg.bytes_of @header.sid bytes = Msg.bytes_of @header.sid
arr.set(bytes,5) arr.set(bytes,5)
bytes = Msg.bytes_of @header.size bytes = Msg.bytes_of @header.size, 4
arr.set(bytes,7) arr.set(bytes,7)
if @data if @data
arr.set(@data, 9) arr.set(@data, 11)
arr.set(Msg.MAGIC_END, @header.size + 9) arr.set(Msg.MAGIC_END, @header.size + 11)
arr.buffer arr.buffer
Msg.decode = (raw) -> Msg.decode = (raw) ->
@ -35,22 +35,29 @@ Msg.decode = (raw) ->
msg.header.type = raw[2] msg.header.type = raw[2]
msg.header.cid = Msg.int_from(raw, 3) msg.header.cid = Msg.int_from(raw, 3)
msg.header.sid = Msg.int_from(raw,5) msg.header.sid = Msg.int_from(raw,5)
msg.header.size = Msg.int_from(raw, 7) msg.header.size = Msg.int_from(raw, 7,4)
msg.data = raw.slice(9, 9+msg.header.size) msg.data = raw.slice(11, 11+msg.header.size)
if(Msg.int_from(Msg.MAGIC_END, 0) != Msg.int_from(raw, 9+msg.header.size)) if(Msg.int_from(Msg.MAGIC_END, 0) != Msg.int_from(raw, 11+msg.header.size))
return reject("Unmatch message end magic number") return reject("Unmatch message end magic number")
resolve msg resolve msg
Msg.bytes_of = (x) -> Msg.bytes_of = (x,s) ->
bytes=new Uint8Array(2) s = 2 unless s is 4
bytes=new Uint8Array(s)
bytes[0]=x & (255) bytes[0]=x & (255)
x=x>>8 x=x>>8
bytes[1]=x & (255) bytes[1]=x & (255)
bytes return bytes unless s is 4
x=x>>8
bytes[2]=x & (255)
x=x>>8
bytes[3]=x & (255)
return bytes
Msg.int_from = (bytes, offset) -> Msg.int_from = (bytes, offset, size) ->
(bytes[offset] | (bytes[offset+1]<<8)) 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))
Msg.OK = 0 Msg.OK = 0
Msg.ERROR = 1 Msg.ERROR = 1

View File

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

View File

@ -35,7 +35,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/README.md",
"category": "Library", "category": "Library",
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"version": "0.1.6-a", "version": "0.1.7-a",
"dependencies": [], "dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/build/release/Antunnel.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Antunnel/build/release/Antunnel.zip"
}, },
@ -236,7 +236,7 @@
"category": "System", "category": "System",
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"version": "0.1.9-a", "version": "0.1.9-a",
"dependencies": ["Antunnel@0.1.6-a","xTerm@4.8.1-r"], "dependencies": ["Antunnel@0.1.7-a","xTerm@4.8.1-r"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/build/release/vTerm.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/build/release/vTerm.zip"
}, },
{ {

View File

@ -11,7 +11,7 @@
"iconclass":"fa fa-terminal", "iconclass":"fa fa-terminal",
"mimes":["none"], "mimes":["none"],
"dependencies": [ "dependencies": [
"Antunnel@0.1.6-a", "Antunnel@0.1.7-a",
"xTerm@4.8.1-r" "xTerm@4.8.1-r"
], ],
"locales":{ "locales":{

Binary file not shown.

View File

@ -11,7 +11,7 @@
"iconclass":"fa fa-terminal", "iconclass":"fa fa-terminal",
"mimes":["none"], "mimes":["none"],
"dependencies": [ "dependencies": [
"Antunnel@0.1.6-a", "Antunnel@0.1.7-a",
"xTerm@4.8.1-r" "xTerm@4.8.1-r"
], ],
"locales":{ "locales":{