Skip to content

Commit

Permalink
fix: 流量查询工作不正常
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Apr 15, 2022
1 parent 4b72c58 commit 95ea0dc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
5 changes: 4 additions & 1 deletion lib/provider/ClashProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,16 @@ export default class ClashProvider extends Provider {
return relayableUrl(this._url, this.relayUrl);
}

public async getSubscriptionUserInfo(): Promise<
public async getSubscriptionUserInfo({
requestUserAgent,
}: { requestUserAgent?: string } = {}): Promise<
SubscriptionUserinfo | undefined
> {
const { subscriptionUserinfo } = await getClashSubscription({
url: this.url,
udpRelay: this.udpRelay,
tls13: this.tls13,
requestUserAgent: requestUserAgent || this.requestUserAgent,
});

if (subscriptionUserinfo) {
Expand Down
6 changes: 3 additions & 3 deletions lib/provider/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ export default class Provider {
}

// istanbul ignore next
public async getSubscriptionUserInfo(): Promise<
SubscriptionUserinfo | undefined
> {
public async getSubscriptionUserInfo({}: {
requestUserAgent?: string;
} = {}): Promise<SubscriptionUserinfo | undefined> {
throw new Error('此 Provider 不支持该功能');
}

Expand Down
5 changes: 4 additions & 1 deletion lib/provider/ShadowsocksSubscribeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ export default class ShadowsocksSubscribeProvider extends Provider {
return relayableUrl(this._url, this.relayUrl);
}

public async getSubscriptionUserInfo(): Promise<
public async getSubscriptionUserInfo({
requestUserAgent,
}: { requestUserAgent?: string } = {}): Promise<
SubscriptionUserinfo | undefined
> {
const { subscriptionUserinfo } = await getShadowsocksSubscription(
this.url,
this.udpRelay,
requestUserAgent || this.requestUserAgent,
);

if (subscriptionUserinfo) {
Expand Down
5 changes: 4 additions & 1 deletion lib/provider/ShadowsocksrSubscribeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ export default class ShadowsocksrSubscribeProvider extends Provider {
return relayableUrl(this._url, this.relayUrl);
}

public async getSubscriptionUserInfo(): Promise<
public async getSubscriptionUserInfo({
requestUserAgent,
}: { requestUserAgent?: string } = {}): Promise<
SubscriptionUserinfo | undefined
> {
const { subscriptionUserinfo } = await getShadowsocksrSubscription(
this.url,
this.udpRelay,
requestUserAgent || this.requestUserAgent,
);

if (subscriptionUserinfo) {
Expand Down
5 changes: 4 additions & 1 deletion lib/provider/SsdProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ export default class SsdProvider extends Provider {
return relayableUrl(this._url, this.relayUrl);
}

public async getSubscriptionUserInfo(): Promise<
public async getSubscriptionUserInfo({
requestUserAgent,
}: { requestUserAgent?: string } = {}): Promise<
SubscriptionUserinfo | undefined
> {
const { subscriptionUserinfo } = await getSsdSubscription(
this.url,
this.udpRelay,
requestUserAgent || this.requestUserAgent,
);

if (subscriptionUserinfo) {
Expand Down
5 changes: 4 additions & 1 deletion lib/provider/TrojanProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ export default class TrojanProvider extends Provider {
return relayableUrl(this._url, this.relayUrl);
}

public async getSubscriptionUserInfo(): Promise<
public async getSubscriptionUserInfo({
requestUserAgent,
}: { requestUserAgent?: string } = {}): Promise<
SubscriptionUserinfo | undefined
> {
const { subscriptionUserinfo } = await getTrojanSubscription({
url: this.url,
udpRelay: this.udpRelay,
tls13: this.tls13,
requestUserAgent: requestUserAgent || this.requestUserAgent,
});

if (subscriptionUserinfo) {
Expand Down

0 comments on commit 95ea0dc

Please sign in to comment.