mirror of
https://github.com/remnawave/xtls-sdk.git
synced 2026-05-13 12:06:41 +00:00
feat: update XtlsApi constructor to use XtlsApiOptions interface and bump package version to 0.10.0
This commit is contained in:
parent
eedd88f407
commit
8777df7097
2 changed files with 11 additions and 9 deletions
16
index.ts
16
index.ts
|
|
@ -4,18 +4,20 @@ import { HandlerService } from './src/handler/handler.service';
|
|||
import { RouterService } from './src/router/router.service';
|
||||
import { StatsService } from './src/stats/stats.service';
|
||||
|
||||
export interface XtlsApiOptions {
|
||||
connectionUrl: string;
|
||||
options?: ChannelOptions;
|
||||
credentials?: ChannelCredentials;
|
||||
}
|
||||
|
||||
export class XtlsApi {
|
||||
public readonly channel: Channel;
|
||||
public readonly stats: StatsService;
|
||||
public readonly handler: HandlerService;
|
||||
public readonly router: RouterService;
|
||||
constructor(
|
||||
ip: string,
|
||||
port: string,
|
||||
options?: ChannelOptions,
|
||||
credentials?: ChannelCredentials,
|
||||
) {
|
||||
this.channel = createChannel(`${ip}:${port}`, credentials, {
|
||||
|
||||
constructor({ connectionUrl, options, credentials }: XtlsApiOptions) {
|
||||
this.channel = createChannel(connectionUrl, credentials, {
|
||||
...options,
|
||||
});
|
||||
this.stats = new StatsService(this.channel);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@remnawave/xtls-sdk",
|
||||
"version": "0.9.0",
|
||||
"version": "0.10.0",
|
||||
"description": "A Typescript SDK for XRAY (XTLS) Core GRPC Api",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
|
|
@ -61,4 +61,4 @@
|
|||
"tsconfig-paths": "^4.2.0",
|
||||
"typescript-eslint": "^8.49.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue