chia-agent 3.0.0 → 3.0.1-beta.0
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/rpc/index.d.ts +4 -0
- package/rpc/index.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.1]
|
|
4
|
+
### Added
|
|
5
|
+
- Added `skip_hostname_verification` option for `RPCAgent`
|
|
6
|
+
|
|
3
7
|
## [3.0.0]
|
|
4
8
|
### Minor Breaking Change
|
|
5
9
|
- Service name of plotter was changed:
|
|
@@ -203,6 +207,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
|
|
|
203
207
|
Initial release.
|
|
204
208
|
|
|
205
209
|
<!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
|
|
210
|
+
[3.0.1]: https://github.com/Chia-Mine/chia-agent/compare/v3.0.0...v3.0.1
|
|
206
211
|
[3.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.6...v3.0.0
|
|
207
212
|
[2.0.6]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.5...v2.0.6
|
|
208
213
|
[2.0.5]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.4...v2.0.5
|
package/package.json
CHANGED
package/rpc/index.d.ts
CHANGED
|
@@ -15,11 +15,13 @@ export declare type TRPCAgentProps = {
|
|
|
15
15
|
ca_cert?: string | Buffer;
|
|
16
16
|
client_cert?: string | Buffer;
|
|
17
17
|
client_key?: string | Buffer;
|
|
18
|
+
skip_hostname_verification?: boolean;
|
|
18
19
|
} | {
|
|
19
20
|
protocol: "https";
|
|
20
21
|
host: string;
|
|
21
22
|
port: number;
|
|
22
23
|
configPath: string;
|
|
24
|
+
skip_hostname_verification?: boolean;
|
|
23
25
|
} | {
|
|
24
26
|
protocol: "http";
|
|
25
27
|
host: string;
|
|
@@ -27,6 +29,7 @@ export declare type TRPCAgentProps = {
|
|
|
27
29
|
} | {
|
|
28
30
|
service: TDestination;
|
|
29
31
|
configPath?: string;
|
|
32
|
+
skip_hostname_verification?: boolean;
|
|
30
33
|
};
|
|
31
34
|
export declare class RPCAgent {
|
|
32
35
|
protected _protocol: "http" | "https";
|
|
@@ -36,6 +39,7 @@ export declare class RPCAgent {
|
|
|
36
39
|
protected _clientCert?: string | Buffer;
|
|
37
40
|
protected _clientKey?: string | Buffer;
|
|
38
41
|
protected _agent: HttpsAgent | HttpAgent;
|
|
42
|
+
protected _skip_hostname_verification: boolean;
|
|
39
43
|
constructor(props: TRPCAgentProps);
|
|
40
44
|
protected _getConfig(configPath?: string): TConfig;
|
|
41
45
|
protected _loadCertFilesFromConfig(config: TConfig): {
|
package/rpc/index.js
CHANGED
|
@@ -58,6 +58,7 @@ class RPCAgent {
|
|
|
58
58
|
this._caCert = "";
|
|
59
59
|
this._clientCert = "";
|
|
60
60
|
this._clientKey = "";
|
|
61
|
+
this._skip_hostname_verification = false;
|
|
61
62
|
if ("protocol" in props) {
|
|
62
63
|
this._protocol = props.protocol;
|
|
63
64
|
this._hostname = props.host;
|
|
@@ -69,11 +70,13 @@ class RPCAgent {
|
|
|
69
70
|
this._clientCert = certs.clientCert;
|
|
70
71
|
this._clientKey = certs.clientKey;
|
|
71
72
|
this._caCert = certs.caCert;
|
|
73
|
+
this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
|
|
72
74
|
}
|
|
73
75
|
else {
|
|
74
76
|
this._caCert = props.ca_cert;
|
|
75
77
|
this._clientCert = props.client_cert;
|
|
76
78
|
this._clientKey = props.client_key;
|
|
79
|
+
this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
|
|
77
80
|
}
|
|
78
81
|
this._agent = new https_1.Agent({
|
|
79
82
|
host: this._hostname,
|
|
@@ -99,6 +102,7 @@ class RPCAgent {
|
|
|
99
102
|
this._clientCert = certs.clientCert;
|
|
100
103
|
this._clientKey = certs.clientKey;
|
|
101
104
|
this._caCert = certs.caCert;
|
|
105
|
+
this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
|
|
102
106
|
this._agent = new https_1.Agent({
|
|
103
107
|
host: this._hostname,
|
|
104
108
|
port: this._port,
|
|
@@ -161,6 +165,11 @@ class RPCAgent {
|
|
|
161
165
|
"User-Agent": userAgent,
|
|
162
166
|
},
|
|
163
167
|
};
|
|
168
|
+
if (this._skip_hostname_verification) {
|
|
169
|
+
options.checkServerIdentity = () => {
|
|
170
|
+
return undefined;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
164
173
|
if (METHOD === "POST" || METHOD === "PUT" || METHOD === "DELETE") {
|
|
165
174
|
options.headers = Object.assign(Object.assign({}, (options.headers || {})), { "Content-Type": "application/json;charset=utf-8", "Content-Length": body.length });
|
|
166
175
|
}
|