-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf2700b
commit cc06837
Showing
10 changed files
with
125 additions
and
9 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { default as createAgentService, AgentServiceService } from './service'; | ||
export { default as GRPCClientAgent } from './GRPCClientAgent'; | ||
export * as errors from './errors'; | ||
export * as types from './types'; | ||
export * as utils from './utils'; |
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
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,7 @@ | ||
import type { ConnectionInfo } from 'network/types'; | ||
|
||
type ConnectionInfoGetter = ( | ||
peerInfo: string, | ||
) => ConnectionInfo | undefined; | ||
|
||
export type { ConnectionInfoGetter }; |
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,16 @@ | ||
import type { Host, Port } from 'network/types'; | ||
import type ReverseProxy from 'network/ReverseProxy'; | ||
import type { ConnectionInfoGetter } from './types'; | ||
|
||
function connectionInfoGetter(revProxy: ReverseProxy): ConnectionInfoGetter { | ||
return (peerInfo: string) => { | ||
const address = peerInfo.split(':'); | ||
const host = address[0] as Host; | ||
const port = parseInt(address[1]) as Port; | ||
// Return undefined in input was invalid | ||
if (host == null || isNaN(port)) return; | ||
return revProxy.getConnectionInfoByProxy(host, port); | ||
}; | ||
} | ||
|
||
export { connectionInfoGetter }; |
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
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