1
1
import * as http from 'http'
2
- import * as https from 'https'
3
- import * as net from 'net'
4
- import * as fs from 'fs'
5
2
import { EventEmitter } from 'events'
6
3
import { GrpcTransport , BtpAuthResponse } from './stream'
7
- import { SIGINT } from 'constants'
8
4
import { default as createLogger , Logger } from 'ilp-logger'
9
5
import { AccountInfo } from './account'
10
6
import {
@@ -17,11 +13,11 @@ export interface GrpcTransportServerOptions {
17
13
secure ?: boolean
18
14
}
19
15
20
- export interface BtpServerServices {
21
- log : Logger ,
16
+ export interface GrpcTransportServerServices {
17
+ log ? : Logger ,
22
18
authenticate ?: ( req : http . IncomingMessage ) => Promise < any >
23
19
}
24
- export interface BtpServerListenOptions {
20
+ export interface GrpcTransportServerListenOptions {
25
21
host : string ,
26
22
port : number
27
23
}
@@ -30,12 +26,12 @@ export class GrpcTransportServer extends EventEmitter {
30
26
protected _log : Logger
31
27
protected _grpc : Server
32
28
protected _authenticate : ( req : http . IncomingMessage ) => Promise < any >
33
- constructor ( options : GrpcTransportServerOptions , services : BtpServerServices ) {
29
+ constructor ( options : GrpcTransportServerOptions , services : GrpcTransportServerServices ) {
34
30
super ( )
35
- this . _log = services . log
31
+ this . _log = services . log || createLogger ( 'grpc-server' )
36
32
this . _authenticate = services . authenticate || skipAuthentication
37
33
}
38
- public async listen ( options : BtpServerListenOptions ) : Promise < void > {
34
+ public async listen ( options : GrpcTransportServerListenOptions ) : Promise < void > {
39
35
40
36
if ( ! options . host && ! options . port ) {
41
37
throw new Error ( `Both host and port must be provided` )
0 commit comments