-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: add default port for protocol #3
Conversation
multiaddrs are more explicit than urls. Default ports should always be included. License: MIT Signed-off-by: Oli Evans <[email protected]>
Depends on - multiformats/js-uri-to-multiaddr#3 - ipfs-inactive/js-ipfs-http-client#935 Fixes ipfs/ipfs-webui#925 License: MIT Signed-off-by: Oli Evans <[email protected]>
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.
Some small suggestions&questions below.
index.js
Outdated
* https://foobar.com => /dns4/foobar.com/tcp/443/tls/http | ||
* https://foobar.com:5001 => /dns4/foobar.com/tcp/5001/tls/http | ||
* https://127.0.0.1:8080 => /ip4/127.0.0.1/tcp/8080/tls/http | ||
* http://[::0]:8080 => /ip6/::0/tcp/8080/http |
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.
Why tho 🤔 For ip4
(1 line above) we default to localhost, shouldn't we do the same here? (::1
)
I know this is a nit, but there is a huge difference if a beginner just copies&pastes 0.0.0.0:5001
vs 127.0.0.1:5001
without thinking, so I always try to avoid "listen on all interfaces" in examples :)
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.
👍
@@ -3,8 +3,8 @@ const toMultiaddr = require('./') | |||
|
|||
test('should convert URIs to multiaddrs', (t) => { | |||
const data = [ | |||
['/ip4/127.0.0.1/http', 'http://127.0.0.1'], | |||
['/ip6/fc00::/http', 'http://[fc00::]'], | |||
['/ip4/127.0.0.1/tcp/80/http', 'http://127.0.0.1'], |
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.
Perhaps we should keep tests for both versions?
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.
You mean ip4
and ip6
? Both tests have been kept, I just updated to include the port. Pesky diff.
Co-Authored-By: olizilla <[email protected]>
You have to explicitly pass the protocol to the ipfs-http-client constructor Depends on - multiformats/js-uri-to-multiaddr#3 - ipfs-inactive/js-ipfs-http-client#935 Fixes ipfs/ipfs-webui#925 License: MIT Signed-off-by: Oli Evans <[email protected]>
multiaddrs are more explicit than urls. Default ports should always be included.
License: MIT
Signed-off-by: Oli Evans [email protected]