Skip to content

Commit

Permalink
Update config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vfarid committed May 31, 2024
1 parent e75fdbc commit 94b3f6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export function MixConfig(cnf: Config, url: URL, address: string, provider: stri
const hostname: string = MuddleDomain(url.hostname)
try {
let conf = {...cnf};
if (!["ws", "h2", "http"].includes(conf.network)) {
const type = conf.network || conf.type || ""
if (!["ws", "h2", "http"].includes(type)) {
throw new Error("Network is not supported!")
} else if (!cfPorts.includes(conf.port)) {
throw new Error("Port is not matched!")
Expand Down Expand Up @@ -64,7 +65,7 @@ export function EncodeConfig(conf: Config): string {
}?encryption=${
encodeURIComponent(conf.encryption || "none")
}&type=${
conf.network
conf.type || conf.network
}${
conf.path ? "&path=" + encodeURIComponent(conf.path) : ""
}${
Expand Down

1 comment on commit 94b3f6a

@vfarid
Copy link
Owner Author

@vfarid vfarid commented on 94b3f6a Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#44

Please sign in to comment.