-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add redundancy, remove https
option, add onlyHttps
option…
#34
Conversation
Why? The IP address will not change anyway. Resolving to the IP adds a slight overhead.
Good idea. This should be documented in the readme.
👍 I don't really see the needs for a
👍 These changes will need tests and readme updates. |
index.js
Outdated
data.dnsServers.forEach(dnsServerInfo => { | ||
const {servers, question} = dnsServerInfo; | ||
servers.forEach(server => { | ||
// eslint-disable-next-line promise/prefer-await-to-then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule is there for a reason. There's never a case where you have to use .then
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do a for-in loop with await but linter was not happy with it ... in this case, I chain then after then so that they run concurrently to simulate a for loop with await inside ... maybe there's a better approach I'm not seeing
Don't think overhead is relevant in this case. Thought about using hostnames when I realized that I couldn't find |
I'm also thinking about randomizing the order in which dns hosts are checked to minimize the chance of going multiple times to one that's having problems before going to others ... what do you think? |
Changes in last commit:
Pending:
|
⬆️ |
I don't see any downside with it.
👍 Good idea!
👍 |
package.json
Outdated
@@ -13,7 +13,7 @@ | |||
"node": ">=8" | |||
}, | |||
"scripts": { | |||
"test": "xo && ava test.js && tsd" | |||
"test": "xo && ava -s test.js && tsd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the AVA package.json config instead of the CLI flag.
readme.md
Outdated
|
||
##### urls | ||
|
||
Type: `array`<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type: `array`<br> | |
Type: `string[]`<br> |
mocks/got.js
Outdated
ignoreRegExp = undefined; | ||
ignored = []; | ||
called = 0; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there really no less verbose way to do the mocking?
So ... did your suggestions, mocked in a less verbose way (don't know if I can make it better, I normally use jest instead of ava+sinon so to be honest, I have no idea what I'm doing XD). Removed the |
There is. See the
The problem is neither AVA nor async, but rather concurrency. Stubbing is incompatible with concurrency.
Can you open an issue about it? TODO comments are code rot. |
This is not implemented. There should only be a boolean (no |
changed to |
Did you see #40? I think we should remove icanhazip.com. But that leaves us with only ipify.org for the browser. Do you know any other free IP service that works over HTTPS? |
https
option, add onlyHttps
option, add fallbackUrls
option
https
option, add onlyHttps
option, add fallbackUrls
optionhttps
option, add onlyHttps
option…
Very nice! Thanks for working on this 🙌 |
Some things that could be considered to be useful:
{ https: true }
will only check HTTPS). Defaults to DNS + HTTPSoptions.urls
array to be able to add more urls to fallback to (likeifconfig.co
)