@planx.machina.at/tunnel 19.150.0 → 20.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +23 -0
  2. package/index.js +3 -1
  3. package/package.json +2 -1
package/index.d.ts CHANGED
@@ -37,6 +37,29 @@ export interface NetworkdEvent {
37
37
  export declare function onEvent(callback: (arg: NetworkdEvent) => any): void
38
38
  /** global state から callback を解除する (= 以降の poll loop event は dropped)。 */
39
39
  export declare function offEvent(): void
40
+ export interface SetExitCaptureInput {
41
+ enabled: boolean
42
+ /** TUN に入れてはいけない address (exit 先 peer との WebRTC の相手、TURN 等)。元の経路の host route を張る。 */
43
+ bypass: Array<string>
44
+ /** ORCHID 以外の IPv6 も exit へ出すか (既定 false: exit が IPv6 に出られない時、SYN に RST を返して IPv4 に落とす)。 */
45
+ ipv6?: boolean
46
+ }
47
+ export interface SetExitCaptureOutput {
48
+ /** 実際に host route を張った bypass。 */
49
+ bypass: Array<string>
50
+ /** 失敗した経路の命令 (既にある / 既に無い経路も含む)。 */
51
+ failed: Array<string>
52
+ }
53
+ export interface InjectUdpDatagramInput {
54
+ /** 16 byte (IPv4 は `::ffff:a.b.c.d`)。返りの送り元 = 元の宛先。 */
55
+ srcAddr: Buffer
56
+ srcPort: number
57
+ dstAddr: Buffer
58
+ dstPort: number
59
+ payload: Buffer
60
+ }
61
+ export declare function setExitCapture(input: SetExitCaptureInput): SetExitCaptureOutput
62
+ export declare function injectUdpDatagram(input: InjectUdpDatagramInput): void
40
63
  export declare function injectTcpData(input: InjectTcpDataInput): void
41
64
  export declare function injectTcpClose(input: InjectTcpCloseInput): void
42
65
  export declare function injectUdpSend(input: InjectUdpSendInput): void
package/index.js CHANGED
@@ -310,10 +310,12 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { onEvent, offEvent, injectTcpData, injectTcpClose, injectUdpSend, addPeerAddress, removePeerAddress, addSelfAddress, setupVnet, version } = nativeBinding
313
+ const { onEvent, offEvent, setExitCapture, injectUdpDatagram, injectTcpData, injectTcpClose, injectUdpSend, addPeerAddress, removePeerAddress, addSelfAddress, setupVnet, version } = nativeBinding
314
314
 
315
315
  module.exports.onEvent = onEvent
316
316
  module.exports.offEvent = offEvent
317
+ module.exports.setExitCapture = setExitCapture
318
+ module.exports.injectUdpDatagram = injectUdpDatagram
317
319
  module.exports.injectTcpData = injectTcpData
318
320
  module.exports.injectTcpClose = injectTcpClose
319
321
  module.exports.injectUdpSend = injectUdpSend
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@planx.machina.at/tunnel",
3
- "version": "19.150.0",
3
+ "version": "20.5.4",
4
+ "author": "Nozomu Miyamoto",
4
5
  "description": "TUN device + smoltcp userspace TCP/IP stack NAPI module for planx vnet (Pattern C privileged daemon)",
5
6
  "main": "index.js",
6
7
  "types": "index.d.ts",