Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add attempt_direct_path argument to create_channel #583

Merged
merged 19 commits into from
Feb 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
s/direct_path_prefix/direct_path_separator
  • Loading branch information
parthea committed Feb 4, 2024
commit c0052e690f973dcb7b40f37901060a3aa0a8c334
6 changes: 3 additions & 3 deletions google/api_core/grpc_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ def _modify_target_for_direct_path(target: str) -> str:
# the Direct Path prefix `google-c2p:///` will be used instead.
target = target.replace(dns_prefix, "")

direct_path_prefix = ":///"
if direct_path_prefix not in target:
direct_path_separator = ":///"
if direct_path_separator not in target:
target_without_port = target.split(":")[0]
# Modify the target to use Direct Path by adding the `google-c2p:///` prefix
target = f"google-c2p{direct_path_prefix}{target_without_port}"
target = f"google-c2p{direct_path_separator}{target_without_port}"
return target


Expand Down