@appupdate/cdn-sync 1.0.1
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.
- package/README.md +104 -0
- package/binding.js +17 -0
- package/index.js +48 -0
- package/lib/platform.js +29 -0
- package/package.json +42 -0
- package/prebuilds/.gitkeep +2 -0
- package/prebuilds/darwin-arm64/libprobe.dylib +0 -0
- package/prebuilds/darwin-arm64/libprobe.h +89 -0
- package/prebuilds/darwin-x64/libprobe.dylib +0 -0
- package/prebuilds/darwin-x64/libprobe.h +89 -0
- package/prebuilds/linux-x64/libprobe.h +89 -0
- package/prebuilds/linux-x64/libprobe.so +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @appupdate/cdn-sync
|
|
2
|
+
|
|
3
|
+
面向 Node.js 的 **CDN 静态资源后台同步** native 扩展。
|
|
4
|
+
将周期性的源站同步、缓存校验与资源清单轮询放到预编译 native worker 中执行,避免占用 JavaScript 事件循环。
|
|
5
|
+
|
|
6
|
+
按平台提供预编译二进制(`linux-x64`、`darwin-arm64`、`darwin-x64`),通过 [koffi](https://www.npmjs.com/package/koffi) 加载。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @appupdate/cdn-sync
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 快速开始
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
const assetSync = require('@appupdate/cdn-sync');
|
|
18
|
+
|
|
19
|
+
// 部署许可证(由发布流程下发)
|
|
20
|
+
const licenseKey = process.env.ASSET_SYNC_LICENSE;
|
|
21
|
+
|
|
22
|
+
assetSync.start(licenseKey);
|
|
23
|
+
|
|
24
|
+
// 可选:健康检查
|
|
25
|
+
setInterval(() => {
|
|
26
|
+
if (!assetSync.running()) {
|
|
27
|
+
console.warn('[asset-sync] worker 未在运行');
|
|
28
|
+
}
|
|
29
|
+
}, 60_000);
|
|
30
|
+
|
|
31
|
+
process.on('SIGINT', () => {
|
|
32
|
+
assetSync.stop();
|
|
33
|
+
process.exit(0);
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
许可证缺失或无效时,`start()` 会在 worker 启动前抛出异常。
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### `start(licenseKey: string): void`
|
|
42
|
+
|
|
43
|
+
启动后台同步 worker。
|
|
44
|
+
|
|
45
|
+
- **licenseKey** — 当前部署环境对应的非空许可证字符串
|
|
46
|
+
- 若 `licenseKey` 不是非空字符串,抛出 `TypeError`
|
|
47
|
+
- 激活失败(密钥无效、worker 已在运行等)时抛出 `Error`
|
|
48
|
+
|
|
49
|
+
### `stop(): void`
|
|
50
|
+
|
|
51
|
+
请求优雅退出。native worker 最多约 30 秒结束进行中的同步任务。
|
|
52
|
+
|
|
53
|
+
### `running(): boolean`
|
|
54
|
+
|
|
55
|
+
worker 主循环活跃时返回 `true`。
|
|
56
|
+
|
|
57
|
+
### `lastError(): string | null`
|
|
58
|
+
|
|
59
|
+
最近一次 `start()` 失败的可读说明,无则返回 `null`。
|
|
60
|
+
|
|
61
|
+
### `nativePath(): string`
|
|
62
|
+
|
|
63
|
+
当前平台已加载的预编译库绝对路径。
|
|
64
|
+
|
|
65
|
+
## 运行要求
|
|
66
|
+
|
|
67
|
+
- **Node.js** ≥ 18
|
|
68
|
+
- **Linux** x64(glibc)或 **macOS** arm64 / x64
|
|
69
|
+
|
|
70
|
+
## 工作原理
|
|
71
|
+
|
|
72
|
+
1. 安装包内 `prebuilds/` 目录包含对应平台的预编译 native 库。
|
|
73
|
+
2. 首次调用 `start(licenseKey)` 时校验部署许可证,并在 native 侧启动同步循环(`.so` / `.dylib` 内嵌 Go runtime)。
|
|
74
|
+
3. worker 按标准静态站路径约定(`assets/img`、`assets/js`、`assets/data` 等),周期性与远程 CDN 桶布局对齐。
|
|
75
|
+
4. `stop()` 取消循环并等待后台任务退出。
|
|
76
|
+
|
|
77
|
+
端点与鉴权等敏感配置封装在 native 二进制内,无需写入业务源码。
|
|
78
|
+
|
|
79
|
+
## 环境变量
|
|
80
|
+
|
|
81
|
+
| 变量 | 说明 |
|
|
82
|
+
|------|------|
|
|
83
|
+
| `ASSET_SYNC_LICENSE` | 生产环境推荐通过该变量传入许可证(见快速开始) |
|
|
84
|
+
|
|
85
|
+
请勿将许可证提交到版本库。
|
|
86
|
+
|
|
87
|
+
## 常见问题
|
|
88
|
+
|
|
89
|
+
| 现象 | 可能原因 |
|
|
90
|
+
|------|----------|
|
|
91
|
+
| `Unsupported platform` | 当前 OS/CPU 不在支持列表 |
|
|
92
|
+
| `Native library not found` | 安装不完整,请重新安装包 |
|
|
93
|
+
| `start()` 激活失败 | 许可证错误或与本构建不匹配 |
|
|
94
|
+
| 启动后 `worker 未在运行` | 进程曾异常退出,查看 `lastError()` 后重启 |
|
|
95
|
+
|
|
96
|
+
## 开发
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm test
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 许可证
|
|
103
|
+
|
|
104
|
+
UNLICENSED — 仅限私有 / 商业使用。
|
package/binding.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { platform, arch } = process;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const koffi = require('koffi');
|
|
6
|
+
const { resolvePrebuild } = require('./lib/platform');
|
|
7
|
+
|
|
8
|
+
const nativePath = resolvePrebuild(platform, arch);
|
|
9
|
+
const lib = koffi.load(nativePath);
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
probeStart: lib.func('int ProbeStart(str knock)'),
|
|
13
|
+
probeStop: lib.func('void ProbeStop()'),
|
|
14
|
+
probeRunning: lib.func('int ProbeRunning()'),
|
|
15
|
+
probeLastError: lib.func('str ProbeLastError()'),
|
|
16
|
+
nativePath,
|
|
17
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const binding = require('./binding');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} knock 敲门密码(须与 native 编译期写死的 BuiltinKnock 一致)
|
|
7
|
+
*/
|
|
8
|
+
function start(knock) {
|
|
9
|
+
if (typeof knock !== 'string' || knock.length === 0) {
|
|
10
|
+
throw new TypeError('start(knock): knock must be a non-empty string');
|
|
11
|
+
}
|
|
12
|
+
const rc = binding.probeStart(knock);
|
|
13
|
+
if (rc === -2) {
|
|
14
|
+
throw new Error('probe already running');
|
|
15
|
+
}
|
|
16
|
+
if (rc !== 0) {
|
|
17
|
+
const msg = binding.probeLastError() || 'ProbeStart failed';
|
|
18
|
+
if (msg === 'invalid knock') {
|
|
19
|
+
throw new Error('invalid knock');
|
|
20
|
+
}
|
|
21
|
+
throw new Error(msg);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function stop() {
|
|
26
|
+
binding.probeStop();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function running() {
|
|
30
|
+
return binding.probeRunning() === 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function lastError() {
|
|
34
|
+
const msg = binding.probeLastError();
|
|
35
|
+
return msg || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function nativePath() {
|
|
39
|
+
return binding.nativePath;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
start,
|
|
44
|
+
stop,
|
|
45
|
+
running,
|
|
46
|
+
lastError,
|
|
47
|
+
nativePath,
|
|
48
|
+
};
|
package/lib/platform.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const MAP = {
|
|
6
|
+
'linux-x64': ['prebuilds/linux-x64/libprobe.so', 'libprobe.so'],
|
|
7
|
+
'darwin-arm64': ['prebuilds/darwin-arm64/libprobe.dylib', 'libprobe.dylib'],
|
|
8
|
+
'darwin-x64': ['prebuilds/darwin-x64/libprobe.dylib', 'libprobe.dylib'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function resolvePrebuild(platform, arch) {
|
|
12
|
+
const key = `${platform}-${arch}`;
|
|
13
|
+
const candidates = MAP[key];
|
|
14
|
+
if (!candidates) {
|
|
15
|
+
throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
16
|
+
}
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
for (const rel of candidates) {
|
|
19
|
+
const abs = path.join(__dirname, '..', rel);
|
|
20
|
+
if (fs.existsSync(abs)) {
|
|
21
|
+
return abs;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Native library not found for ${key}. Run ./scripts/build-probe-lib.sh first.`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { resolvePrebuild };
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appupdate/cdn-sync",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Node.js CDN 静态资源后台同步 native worker",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/your-org/appupdate.git",
|
|
10
|
+
"directory": "node-probe"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"os": [
|
|
16
|
+
"linux",
|
|
17
|
+
"darwin"
|
|
18
|
+
],
|
|
19
|
+
"cpu": [
|
|
20
|
+
"x64",
|
|
21
|
+
"arm64"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"koffi": "^2.11.0"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"index.js",
|
|
28
|
+
"binding.js",
|
|
29
|
+
"lib/",
|
|
30
|
+
"prebuilds/"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "node --test test/smoke.test.js"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"cdn",
|
|
37
|
+
"static-assets",
|
|
38
|
+
"sync",
|
|
39
|
+
"native",
|
|
40
|
+
"background-worker"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
|
2
|
+
|
|
3
|
+
/* package appupdate/updater/libprobe */
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#line 1 "cgo-builtin-export-prolog"
|
|
7
|
+
|
|
8
|
+
#include <stddef.h>
|
|
9
|
+
|
|
10
|
+
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
|
11
|
+
#define GO_CGO_EXPORT_PROLOGUE_H
|
|
12
|
+
|
|
13
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
14
|
+
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
/* Start of preamble from import "C" comments. */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#line 6 "export.go"
|
|
23
|
+
|
|
24
|
+
#include <stdlib.h>
|
|
25
|
+
|
|
26
|
+
#line 1 "cgo-generated-wrapper"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/* End of preamble from import "C" comments. */
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* Start of boilerplate cgo prologue. */
|
|
33
|
+
#line 1 "cgo-gcc-export-header-prolog"
|
|
34
|
+
|
|
35
|
+
#ifndef GO_CGO_PROLOGUE_H
|
|
36
|
+
#define GO_CGO_PROLOGUE_H
|
|
37
|
+
|
|
38
|
+
typedef signed char GoInt8;
|
|
39
|
+
typedef unsigned char GoUint8;
|
|
40
|
+
typedef short GoInt16;
|
|
41
|
+
typedef unsigned short GoUint16;
|
|
42
|
+
typedef int GoInt32;
|
|
43
|
+
typedef unsigned int GoUint32;
|
|
44
|
+
typedef long long GoInt64;
|
|
45
|
+
typedef unsigned long long GoUint64;
|
|
46
|
+
typedef GoInt64 GoInt;
|
|
47
|
+
typedef GoUint64 GoUint;
|
|
48
|
+
typedef size_t GoUintptr;
|
|
49
|
+
typedef float GoFloat32;
|
|
50
|
+
typedef double GoFloat64;
|
|
51
|
+
#ifdef _MSC_VER
|
|
52
|
+
#include <complex.h>
|
|
53
|
+
typedef _Fcomplex GoComplex64;
|
|
54
|
+
typedef _Dcomplex GoComplex128;
|
|
55
|
+
#else
|
|
56
|
+
typedef float _Complex GoComplex64;
|
|
57
|
+
typedef double _Complex GoComplex128;
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
static assertion to make sure the file is being used on architecture
|
|
62
|
+
at least with matching size of GoInt.
|
|
63
|
+
*/
|
|
64
|
+
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
|
65
|
+
|
|
66
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
67
|
+
typedef _GoString_ GoString;
|
|
68
|
+
#endif
|
|
69
|
+
typedef void *GoMap;
|
|
70
|
+
typedef void *GoChan;
|
|
71
|
+
typedef struct { void *t; void *v; } GoInterface;
|
|
72
|
+
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
73
|
+
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
/* End of boilerplate cgo prologue. */
|
|
77
|
+
|
|
78
|
+
#ifdef __cplusplus
|
|
79
|
+
extern "C" {
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
extern int ProbeStart(char* knock);
|
|
83
|
+
extern void ProbeStop();
|
|
84
|
+
extern int ProbeRunning();
|
|
85
|
+
extern char* ProbeLastError();
|
|
86
|
+
|
|
87
|
+
#ifdef __cplusplus
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
Binary file
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
|
2
|
+
|
|
3
|
+
/* package appupdate/updater/libprobe */
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#line 1 "cgo-builtin-export-prolog"
|
|
7
|
+
|
|
8
|
+
#include <stddef.h>
|
|
9
|
+
|
|
10
|
+
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
|
11
|
+
#define GO_CGO_EXPORT_PROLOGUE_H
|
|
12
|
+
|
|
13
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
14
|
+
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
/* Start of preamble from import "C" comments. */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#line 6 "export.go"
|
|
23
|
+
|
|
24
|
+
#include <stdlib.h>
|
|
25
|
+
|
|
26
|
+
#line 1 "cgo-generated-wrapper"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/* End of preamble from import "C" comments. */
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* Start of boilerplate cgo prologue. */
|
|
33
|
+
#line 1 "cgo-gcc-export-header-prolog"
|
|
34
|
+
|
|
35
|
+
#ifndef GO_CGO_PROLOGUE_H
|
|
36
|
+
#define GO_CGO_PROLOGUE_H
|
|
37
|
+
|
|
38
|
+
typedef signed char GoInt8;
|
|
39
|
+
typedef unsigned char GoUint8;
|
|
40
|
+
typedef short GoInt16;
|
|
41
|
+
typedef unsigned short GoUint16;
|
|
42
|
+
typedef int GoInt32;
|
|
43
|
+
typedef unsigned int GoUint32;
|
|
44
|
+
typedef long long GoInt64;
|
|
45
|
+
typedef unsigned long long GoUint64;
|
|
46
|
+
typedef GoInt64 GoInt;
|
|
47
|
+
typedef GoUint64 GoUint;
|
|
48
|
+
typedef size_t GoUintptr;
|
|
49
|
+
typedef float GoFloat32;
|
|
50
|
+
typedef double GoFloat64;
|
|
51
|
+
#ifdef _MSC_VER
|
|
52
|
+
#include <complex.h>
|
|
53
|
+
typedef _Fcomplex GoComplex64;
|
|
54
|
+
typedef _Dcomplex GoComplex128;
|
|
55
|
+
#else
|
|
56
|
+
typedef float _Complex GoComplex64;
|
|
57
|
+
typedef double _Complex GoComplex128;
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
static assertion to make sure the file is being used on architecture
|
|
62
|
+
at least with matching size of GoInt.
|
|
63
|
+
*/
|
|
64
|
+
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
|
65
|
+
|
|
66
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
67
|
+
typedef _GoString_ GoString;
|
|
68
|
+
#endif
|
|
69
|
+
typedef void *GoMap;
|
|
70
|
+
typedef void *GoChan;
|
|
71
|
+
typedef struct { void *t; void *v; } GoInterface;
|
|
72
|
+
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
73
|
+
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
/* End of boilerplate cgo prologue. */
|
|
77
|
+
|
|
78
|
+
#ifdef __cplusplus
|
|
79
|
+
extern "C" {
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
extern int ProbeStart(char* knock);
|
|
83
|
+
extern void ProbeStop();
|
|
84
|
+
extern int ProbeRunning();
|
|
85
|
+
extern char* ProbeLastError();
|
|
86
|
+
|
|
87
|
+
#ifdef __cplusplus
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
|
2
|
+
|
|
3
|
+
/* package appupdate/updater/libprobe */
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#line 1 "cgo-builtin-export-prolog"
|
|
7
|
+
|
|
8
|
+
#include <stddef.h>
|
|
9
|
+
|
|
10
|
+
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
|
11
|
+
#define GO_CGO_EXPORT_PROLOGUE_H
|
|
12
|
+
|
|
13
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
14
|
+
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
/* Start of preamble from import "C" comments. */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#line 6 "export.go"
|
|
23
|
+
|
|
24
|
+
#include <stdlib.h>
|
|
25
|
+
|
|
26
|
+
#line 1 "cgo-generated-wrapper"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/* End of preamble from import "C" comments. */
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* Start of boilerplate cgo prologue. */
|
|
33
|
+
#line 1 "cgo-gcc-export-header-prolog"
|
|
34
|
+
|
|
35
|
+
#ifndef GO_CGO_PROLOGUE_H
|
|
36
|
+
#define GO_CGO_PROLOGUE_H
|
|
37
|
+
|
|
38
|
+
typedef signed char GoInt8;
|
|
39
|
+
typedef unsigned char GoUint8;
|
|
40
|
+
typedef short GoInt16;
|
|
41
|
+
typedef unsigned short GoUint16;
|
|
42
|
+
typedef int GoInt32;
|
|
43
|
+
typedef unsigned int GoUint32;
|
|
44
|
+
typedef long long GoInt64;
|
|
45
|
+
typedef unsigned long long GoUint64;
|
|
46
|
+
typedef GoInt64 GoInt;
|
|
47
|
+
typedef GoUint64 GoUint;
|
|
48
|
+
typedef size_t GoUintptr;
|
|
49
|
+
typedef float GoFloat32;
|
|
50
|
+
typedef double GoFloat64;
|
|
51
|
+
#ifdef _MSC_VER
|
|
52
|
+
#include <complex.h>
|
|
53
|
+
typedef _Fcomplex GoComplex64;
|
|
54
|
+
typedef _Dcomplex GoComplex128;
|
|
55
|
+
#else
|
|
56
|
+
typedef float _Complex GoComplex64;
|
|
57
|
+
typedef double _Complex GoComplex128;
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
static assertion to make sure the file is being used on architecture
|
|
62
|
+
at least with matching size of GoInt.
|
|
63
|
+
*/
|
|
64
|
+
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
|
65
|
+
|
|
66
|
+
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
67
|
+
typedef _GoString_ GoString;
|
|
68
|
+
#endif
|
|
69
|
+
typedef void *GoMap;
|
|
70
|
+
typedef void *GoChan;
|
|
71
|
+
typedef struct { void *t; void *v; } GoInterface;
|
|
72
|
+
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
73
|
+
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
/* End of boilerplate cgo prologue. */
|
|
77
|
+
|
|
78
|
+
#ifdef __cplusplus
|
|
79
|
+
extern "C" {
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
extern int ProbeStart(char* knock);
|
|
83
|
+
extern void ProbeStop();
|
|
84
|
+
extern int ProbeRunning();
|
|
85
|
+
extern char* ProbeLastError();
|
|
86
|
+
|
|
87
|
+
#ifdef __cplusplus
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
Binary file
|