Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Ability to pick upnp control url #40

Merged
merged 6 commits into from
Jul 30, 2019
Merged

Ability to pick upnp control url #40

merged 6 commits into from
Jul 30, 2019

Conversation

CDuPlooy
Copy link
Contributor

Sorry for opening this again, in the previous code a check was done for urn:schemas-upnp-org:service:WANIPConnection:1 ; That did not work on my router, I later added a check for a PPPIPConnection:1 and only later realised that the trick was there could be multiple of these strings.

I modified the code so that search_gateway defaults to the first one found, but added a function that can be used to create a Gateway using a particular control url. I tested this in different networks and it worked in those! :)

@CDuPlooy
Copy link
Contributor Author

Ah I see I didn't change the implementations inside of the aio directory, I'll fix that in a bit.

Should probably add an async version of the function returning control urls as well, I don't have any expierence with rust async though.
( I did all these with the web client hence the multiple commits )
@sbstp
Copy link
Owner

sbstp commented Jul 24, 2019

Hey, sorrry. I'm busy this week. Don't hesitate to ping me next week if I forget to review this.

@sbstp sbstp merged commit 72dec06 into sbstp:master Jul 30, 2019
@sbstp
Copy link
Owner

sbstp commented Jul 30, 2019

It seems like there's a lack of coherence in this. When I built it I got these warnings:

simon@switch:~/projects/rust-igd$ cargo test --all-features
   Compiling igd v0.9.1 (/home/simon/projects/rust-igd)
warning: function is never used: `get_control_urls`
  --> src/search.rs:51:1
   |
51 | pub fn get_control_urls(options: SearchOptions) -> Result<Vec<String>, SearchError> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

warning: function is never used: `get_gateway_with_control_url`
  --> src/search.rs:76:1
   |
76 | pub fn get_gateway_with_control_url(options: SearchOptions, url: &str) -> Result<Gateway, SearchError>{
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: `get_control_urls`
  --> src/search.rs:51:1
   |
51 | pub fn get_control_urls(options: SearchOptions) -> Result<Vec<String>, SearchError> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

warning: function is never used: `get_gateway_with_control_url`
  --> src/search.rs:76:1
   |
76 | pub fn get_gateway_with_control_url(options: SearchOptions, url: &str) -> Result<Gateway, SearchError>{
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you want to use these functions as an end user of the library, you should export them publicly. Can you make another PR to rectify this? Ideally I'd like to pick the best device available for this and avoid making the user choose, but I'm not sure how to proceed. I'll look into this further.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants