-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.ts
More file actions
28 lines (24 loc) · 968 Bytes
/
index.ts
File metadata and controls
28 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { createChannel, Channel, ChannelOptions, ChannelCredentials } from 'nice-grpc';
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({ connectionUrl, options, credentials }: XtlsApiOptions) {
this.channel = createChannel(connectionUrl, credentials, {
...options,
});
this.stats = new StatsService(this.channel);
this.handler = new HandlerService(this.channel);
this.router = new RouterService(this.channel);
return this;
}
}