Skip to content

Commit

Permalink
feat: support getSurfboardNodes and surfboard vmess aead config
Browse files Browse the repository at this point in the history
  • Loading branch information
KotaHv committed Oct 2, 2022
1 parent b7abfb2 commit 4099f98
Show file tree
Hide file tree
Showing 10 changed files with 668 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/generator/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getShadowsocksNodesJSON,
getShadowsocksrNodes,
getSurgeNodes,
getSurfboardNodes,
getUrl,
getV2rayNNodes,
isIp,
Expand Down Expand Up @@ -173,6 +174,7 @@ export class Artifact extends EventEmitter {
getClashNodeNames,
getClashNodes,
getSurgeNodes,
getSurfboardNodes,
getShadowsocksNodes,
getShadowsocksNodesJSON,
getShadowsocksrNodes,
Expand Down Expand Up @@ -397,6 +399,7 @@ export class Artifact extends EventEmitter {
nodeConfig.surgeConfig = config.surgeConfig;
nodeConfig.clashConfig = config.clashConfig;
nodeConfig.quantumultXConfig = config.quantumultXConfig;
nodeConfig.surfboardConfig = config.surfboardConfig;

if (provider.renameNode) {
const newName = provider.renameNode(nodeConfig.nodeName);
Expand Down
4 changes: 4 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export interface CommandConfig {
readonly clashConfig?: {
readonly ssrFormat: 'native' | 'legacy';
};
readonly surfboardConfig?: {
readonly vmessAEAD?: boolean;
};
readonly gateway?: {
readonly accessToken?: string;
readonly viewerToken?: string;
Expand Down Expand Up @@ -291,6 +294,7 @@ export interface SimpleNodeConfig {
surgeConfig?: CommandConfig['surgeConfig'];
clashConfig?: CommandConfig['clashConfig'];
quantumultXConfig?: CommandConfig['quantumultXConfig'];
surfboardConfig?: CommandConfig['surfboardConfig'];
hostnameIp?: ReadonlyArray<string>;
provider?: Provider;
underlyingProxy?: string;
Expand Down
7 changes: 7 additions & 0 deletions lib/utils/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ test('output api should fail with invalid filter', (t) => {
undefined,
ERR_INVALID_FILTER,
);
t.throws(
() => {
utils.getSurfboardNodes([], undefined);
},
undefined,
ERR_INVALID_FILTER,
);
t.throws(
() => {
utils.getClashNodes([], undefined);
Expand Down
Loading

0 comments on commit 4099f98

Please sign in to comment.