Skip to content

Commit 2c61df7

Browse files
committed
change client options & types
1 parent 692a54a commit 2c61df7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/structures/Client.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ class Client extends EventEmitter {
1818
this.config = Object.assign(
1919
{
2020
https: {
21+
ip: "127.0.0.1",
22+
port: 17091,
2123
enable: true,
2224
url: "127.0.0.1",
2325
type2: false
2426
},
25-
ip: "127.0.0.1",
26-
port: 17091,
2727
enet: {
28+
ip: "127.0.0.1",
29+
port: 17091,
2830
maxPeers: 1024,
2931
useNewPacket: {
3032
asClient: false
@@ -34,7 +36,7 @@ class Client extends EventEmitter {
3436
options
3537
);
3638

37-
this._client = new Native(this.config.ip, this.config.port) as ClientType;
39+
this._client = new Native(this.config.enet.ip, this.config.enet.port) as ClientType;
3840
}
3941

4042
public on(event: "connect", listener: (netID: number) => void): this;
@@ -94,7 +96,7 @@ class Client extends EventEmitter {
9496
private startWeb() {
9597
if (!this.config.https) return;
9698
if (this.config.https.enable)
97-
WebServer(this.config.ip, this.config.port, this.config.https.type2);
99+
WebServer(this.config.https.ip, this.config.https.port, this.config.https.type2);
98100
}
99101

100102
private handleEvent() {

types/client.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ export interface ClientType {
1717
export interface ClientOptions {
1818
/** Built-in https web server */
1919
https?: {
20+
ip?: string;
21+
port?: number;
2022
enable?: boolean;
2123
url?: string;
2224
type2?: boolean;
2325
};
24-
ip?: string;
25-
port?: number;
2626
enet?: {
27+
ip?: string;
28+
port?: number;
2729
maxPeers?: number;
2830
useNewPacket?: {
2931
asClient?: boolean;

0 commit comments

Comments
 (0)