-
Notifications
You must be signed in to change notification settings - Fork 5
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
204d3b2
commit 202c444
Showing
10 changed files
with
188 additions
and
14 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
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,8 @@ | ||
import type { ConnectionInfo } from 'network/types'; | ||
import type { ServerSurfaceCall } from '@grpc/grpc-js/build/src/server-call'; | ||
|
||
type ConnectionInfoGet = ( | ||
call: ServerSurfaceCall, | ||
) => ConnectionInfo | undefined; | ||
|
||
export type { ConnectionInfoGet }; |
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,18 @@ | ||
import type { Host, Port } from 'network/types'; | ||
import type ReverseProxy from 'network/ReverseProxy'; | ||
import type { ConnectionInfoGet } from './types'; | ||
import type { ServerSurfaceCall } from '@grpc/grpc-js/build/src/server-call'; | ||
|
||
function connectionInfoGetter(revProxy: ReverseProxy): ConnectionInfoGet { | ||
return (call: ServerSurfaceCall) => { | ||
let urlString = call.getPeer(); | ||
if (!/^.*:\/\//.test(urlString)) urlString = 'pk://' + urlString; | ||
const url = new URL(urlString); | ||
return revProxy.getConnectionInfoByProxy( | ||
url.hostname as Host, | ||
parseInt(url.port) as 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