-
Notifications
You must be signed in to change notification settings - Fork 223
Update samples and builder with improved proxy support #196
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b26f113
Update samples and builder with improved proxy support
bretambrose 6be677a
Merge branch 'main' into Proxy2
bretambrose 864b15a
Deprecate and don't use old parameter in samples when using websockets
bretambrose c92589b
Merge branch 'Proxy2' of github.com:aws/aws-iot-device-sdk-python-v2 …
bretambrose fc55e05
Doc update
bretambrose 664f22b
update docs
graebm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -46,12 +46,11 @@ | |
parser.add_argument('--job-time', default=5, type=float, help="Emulate working on job by sleeping this many seconds.") | ||
parser.add_argument('--use-websocket', default=False, action='store_true', | ||
help="To use a websocket instead of raw mqtt. If you " + | ||
"specify this option you must specify a region for signing, you can also enable proxy mode.") | ||
"specify this option you must specify a region for signing.") | ||
parser.add_argument('--signing-region', default='us-east-1', help="If you specify --use-web-socket, this " + | ||
"is the region that will be used for computing the Sigv4 signature") | ||
parser.add_argument('--proxy-host', help="Hostname for proxy to connect to. Note: if you use this feature, " + | ||
"you will likely need to set --root-ca to the ca for your proxy.") | ||
parser.add_argument('--proxy-port', type=int, default=8080, help="Port for proxy to connect to.") | ||
parser.add_argument('--proxy-host', help="Hostname of proxy to connect to.") | ||
parser.add_argument('--proxy-port', type=int, default=8080, help="Port of proxy to connect to.") | ||
parser.add_argument('--verbosity', choices=[x.name for x in io.LogLevel], default=io.LogLevel.NoLogs.name, | ||
help='Logging level') | ||
|
||
|
@@ -230,18 +229,18 @@ def on_update_job_execution_rejected(rejected): | |
host_resolver = io.DefaultHostResolver(event_loop_group) | ||
client_bootstrap = io.ClientBootstrap(event_loop_group, host_resolver) | ||
|
||
if args.use_websocket == True: | ||
proxy_options = None | ||
if (args.proxy_host): | ||
proxy_options = http.HttpProxyOptions(host_name=args.proxy_host, port=args.proxy_port) | ||
proxy_options = None | ||
if (args.proxy_host): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we check the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, nevermind, it's defaulted. |
||
proxy_options = http.HttpProxyOptions(host_name=args.proxy_host, port=args.proxy_port) | ||
|
||
if args.use_websocket == True: | ||
credentials_provider = auth.AwsCredentialsProvider.new_default_chain(client_bootstrap) | ||
mqtt_connection = mqtt_connection_builder.websockets_with_default_aws_signing( | ||
endpoint=args.endpoint, | ||
bretambrose marked this conversation as resolved.
Show resolved
Hide resolved
|
||
client_bootstrap=client_bootstrap, | ||
region=args.signing_region, | ||
credentials_provider=credentials_provider, | ||
websocket_proxy_options=proxy_options, | ||
http_proxy_options=proxy_options, | ||
ca_filepath=args.root_ca, | ||
client_id=args.client_id, | ||
clean_session=False, | ||
|
@@ -256,7 +255,8 @@ def on_update_job_execution_rejected(rejected): | |
ca_filepath=args.root_ca, | ||
client_id=args.client_id, | ||
clean_session=False, | ||
keep_alive_secs=6) | ||
keep_alive_secs=6, | ||
http_proxy_options=proxy_options) | ||
|
||
print("Connecting to {} with client ID '{}'...".format( | ||
args.endpoint, args.client_id)) | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.