Skip to content

Commit 83d2844

Browse files
roland-reeduniqueiniquity
authored andcommitted
update anyproxy proxy manager types (DefinitelyTyped#41640)
1 parent ef26487 commit 83d2844

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

types/anyproxy/anyproxy-tests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ proxyServer.start();
6060

6161
// When finished
6262
proxyServer.close();
63+
64+
AnyProxy.utils.systemProxyMgr.enableGlobalProxy('127.0.0.1', 8080);
65+
AnyProxy.utils.systemProxyMgr.enableGlobalProxy('127.0.0.1', 8080, 'http');
66+
AnyProxy.utils.systemProxyMgr.enableGlobalProxy('127.0.0.1', 8080, 'https');
67+
68+
AnyProxy.utils.systemProxyMgr.disableGlobalProxy();
69+
AnyProxy.utils.systemProxyMgr.disableGlobalProxy('http');
70+
AnyProxy.utils.systemProxyMgr.disableGlobalProxy('https');

types/anyproxy/index.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Type definitions for anyproxy 4.1
22
// Project: https://github.com/alibaba/anyproxy
33
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
4+
// Roland Reed <https://github.com/roland-reed>
45
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
56

67
/// <reference types="node" />
@@ -21,6 +22,8 @@ import {
2122

2223
export type MaybePromise<T> = T | Promise<T>;
2324

25+
export type NetworkType = 'http' | 'https';
26+
2427
export interface ProxyOptions {
2528
/** Port number of proxy server */
2629
port: string | number;
@@ -229,9 +232,9 @@ export namespace utils {
229232
/** Manage the system proxy config. sudo password may be required. */
230233
namespace systemProxyMgr {
231234
/** Enable global system proxy with specified params. sudo password may be required. */
232-
function enableGlobalProxy(host: string, port: string | number): void;
235+
function enableGlobalProxy(host: string, port: string | number, networkType?: NetworkType): void;
233236
/** Disable global system proxy. sudo password may be required. */
234-
function disableGlobalProxy(): void;
237+
function disableGlobalProxy(networkType?: NetworkType): void;
235238
}
236239

237240
/** Manage certificates of AnyProxy. */

0 commit comments

Comments
 (0)