-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(connifo): create
types.ts
for type definitions (#2924)
- Loading branch information
Showing
2 changed files
with
46 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { Context } from '../../context' | ||
|
||
export type AddressType = 'IPv6' | 'IPv4' | 'unknown' | ||
|
||
export type NetAddrInfo = { | ||
/** | ||
* Transport protocol type | ||
*/ | ||
transport?: 'tcp' | 'udp' | ||
/** | ||
* Transport port number | ||
*/ | ||
port?: number | ||
|
||
address?: string | ||
addressType?: AddressType | ||
} & ( | ||
| { | ||
/** | ||
* Host name such as IP Addr | ||
*/ | ||
address: string | ||
|
||
/** | ||
* Host name type | ||
*/ | ||
addressType: AddressType | ||
} | ||
| {} | ||
) | ||
|
||
/** | ||
* HTTP Connection infomation | ||
*/ | ||
export interface ConnInfo { | ||
/** | ||
* Remote infomation | ||
*/ | ||
remote: NetAddrInfo | ||
} | ||
|
||
/** | ||
* Helper type | ||
*/ | ||
export type GetConnInfo = (c: Context) => ConnInfo |