Commit Graph

1 Commits

Author SHA1 Message Date
Marco Munizaga
ac038dbf2d feat: Implement HTTP spec (#2438)
* Add SNI and HTTP_libp2p_token to Noise extensions

* Initial libp2phttp work

* Remove custom response writer

* Initial self review

* Add client for PingHTTP

* Support using a different sni from host

* Add WIP auth support

* Revert "Add WIP auth support"

This reverts commit 8a648d94f7. Since
current spec doesn't use libp2p-noise-?X auth anymore.

* Remove libp2p-noise auth (removed from spec)

* wip notes

* Fix ordering of header writes

* Change api to have the host do more

* Add options

* Use stream host from option instead of parameter

* Nits

* Add AddPeerMetadata

* Add CustomRootHandler option

* Remove old todos

* Undo Noise changes

* Add comments

* Implement CloseIdleConnections to protect from surprising behavior

* Add todo

* Add ServerMustAuthenticatePeerID option

* WIP work on recent roundtripper logic

* Remove recentHTTPAddrs. We don't need it

* Move http ping to separate package

* Hide internal constants

* HTTPHost has a valid zero-value. Remove constructor and options

* Add https test

* Rename to following naming convention

* Add flag for insecure http

* Return after error

* Rename Rm to Remove

* Rename

* Refactor to always call closeAllListeners

* Rename

* Rename

* Automatically strip prefix when using SetHTTPHandler*

* Hide streamHostListen

* Cleanup public types and add docs

* Fix interface rename

* Remove debug

* PR comments

* Add examples

* Fix example name

* Cleanup unused example

* Add more examples

* Add well known handler example

* Handle empty path

* Fix typo

* Make RoundTripperOption public so users can allocate a slice of options

* Rename HTTPHost to Host

* Make the host.WellKnownHandler public

* Make Add merge PeerMetadata. Introduce SetPeerMetadata

* Rename AddProtocolMapping to AddProtocolMeta. Expand comment

* Expand comment on DefaultClientRoundTripper

And don't use the http.DefaultRoundTripper and cast

* Remove todo

Covered by https://github.com/libp2p/go-libp2p/issues/2511

* Fix comment typo

* Fix comment typo

* Create helper init fn

* Rename NewRoundTripper to NewConstrainedRoundTripper

* Use pointer for Host.ServeMux

* Don't ignore err

* json decode from reader

* Nits

* Move setupListeners to method

* Add comment for streamReadCloser

* Add more comments

* Add todo

* Defer connect until the round trip

* Rebase gostream

* Update p2p/http/libp2phttp.go

Co-authored-by: Andrew Gillis <gammazero@users.noreply.github.com>

---------

Co-authored-by: Andrew Gillis <gammazero@users.noreply.github.com>
2023-08-28 22:52:02 -07:00