pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
115 stars 28 forks source link

Split HTTP server implementation #24

Closed andyoknen closed 3 years ago

andyoknen commented 3 years ago

The task is to divide the static class of the implementation of the HTTP interface, to be able to run multiple instances that serve their own routes.

https://github.com/pocketnetteam/pocketnet.core

Interested in modules: https://github.com/pocketnetteam/pocketnet.core/blob/master/src/httpserver.h https://github.com/pocketnetteam/pocketnet.core/blob/master/src/httprpc.h

This is a global service that runs through src/init.cpp and lives for the entire lifetime of the process. Based on the transport, the RPC server is raised above, analyzing incoming requests and solving the authorization issue: https://github.com/pocketnetteam/pocketnet.core/blob/master/src/httprpc.h

in httprpc.cpp routes are registered in the function: StartHTTPRPC()

we want to make post and public accessible to the outside without a password - now this is implemented through an additional boolean vars in the frets of specific implementations (for example src/rpc/pocketrpc.cpp:3463 the last argument passes the need to log in, which is checked in src/httprpc.cpp:164)

Default port for http ROC (All that requires authorization) - 37071 We want to launch the second instance (Public) - 38081

tawmaz commented 3 years ago

I have this mostly implemented. I'll post a pull request as soon as I have it tested.

tawmaz commented 3 years ago

Created pull request Feature/splithttp

pocketnetteam commented 3 years ago

PS: The public interface (port 38081) always listens to all available addresses (0.0.0.0/0) and does not have password protection, since it does not have access to the internal critical apis of the node.