Skip to content
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

feat: iroh-one #212

Merged
merged 29 commits into from
Aug 31, 2022
Merged

feat: iroh-one #212

merged 29 commits into from
Aug 31, 2022

Conversation

Arqu
Copy link
Collaborator

@Arqu Arqu commented Aug 29, 2022

Based off of the awesome work @fabricedesre did on #188

Took it a little bit further in terms of making it mergeable for us and reducing the maintenance burden of the crate.

@fabricedesre Hope this is a nice middle ground that works for all.

  • uds support remains, it's feature enabled now at compile time
  • I've dropped the racing http/p2p work and we can do that as a separate piece with a custom ContentLoader as @dignifiedquire suggested
  • made the cleanups I mentioned over there.
  • Dropped the android hard coded bits (mainly the uds socket definition) however you can pass it in as an argument (actually need to finish this - done)

LMK what y'all think

@Arqu Arqu force-pushed the arqu/ipfsd branch 2 times, most recently from fef3416 to 1bf759c Compare August 29, 2022 17:54
@Arqu Arqu changed the title wip: iroh-one feat: iroh-one Aug 29, 2022
@Arqu Arqu requested review from ramfox and dignifiedquire August 29, 2022 17:54
@Arqu Arqu self-assigned this Aug 29, 2022
@Arqu Arqu marked this pull request as ready for review August 29, 2022 19:15
iroh-one/README.md Outdated Show resolved Hide resolved
iroh-one/README.md Outdated Show resolved Hide resolved
iroh-one/src/cli.rs Outdated Show resolved Hide resolved
iroh-one/src/cli.rs Outdated Show resolved Hide resolved
iroh-one/src/cli.rs Outdated Show resolved Hide resolved
}

// synchronize the rpc config across subsystems
pub fn sync_rpc_client(&mut self) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly is this used for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a convenience function to copy the top level rpc_client configuration (with the mem addresses) across the sub configs.

iroh-one/src/rpc.rs Outdated Show resolved Hide resolved
@Arqu
Copy link
Collaborator Author

Arqu commented Aug 30, 2022

@fabricedesre just to clarify some of the stuff here. I don't think we can take on the android specific code you had, but I've aimed to give enough flexibility so that it's an easy setup. I assume that you don't have the luxury of cli arguments when starting things on android thus relying on defaults.

If that is the case I think the best way to support this is by having iroh-one being flexible and configurable enough that you can simply import it as a crate in your own rust project and simply copy over just the main.rs and slightly modify it to fit your needs. Think for this specific case, it would be enough to simply modify the config with the correct uds path before setting the rpc client.

@fabricedesre
Copy link
Contributor

@Arqu I can actually use cli arguments in my case (it's not regular android either), but I dislike having a mix of configuration through cli args and in a config file. If I can use --cfg and have all the configuration in a config file that's ideal.

@Arqu
Copy link
Collaborator Author

Arqu commented Aug 30, 2022

@Arqu I can actually use cli arguments in my case (it's not regular android either), but I dislike having a mix of configuration through cli args and in a config file. If I can use --cfg and have all the configuration in a config file that's ideal.

Oh that's really nice to hear! I'll test it out today/tomorrow and report back, should be already set up or pretty close to it.

@Arqu
Copy link
Collaborator Author

Arqu commented Aug 31, 2022

@fabricedesre confirming that --cfg=path/to/your/config works

Sample toml config

gateway_uds_path = 'tmp.sock'

[gateway]
writeable = false
fetch = false
cache = false
port = 9051
denylist = false

[gateway.headers]
access-control-allow-headers = 'content-type, content-disposition, last-modified, cache-control, accept-ranges, etag, service-worker, x-ipfs-gateway-prefix, x-trace-id, x-content-type-options, x-ipfs-path, x-ipfs-roots'
access-control-allow-methods = 'GET, PUT, POST, DELETE, HEAD, OPTIONS'
accept-ranges = 'none'
access-control-allow-origin = '*'
cache-control = 'no-cache, no-transform'

[store]
path = 'iroh-store-db'

[p2p.libp2p]
listening_multiaddr = '/ip4/0.0.0.0/tcp/4444'
bootstrap_peers = [
    '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN',
    '/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa',
    '/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb',
    '/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt',
    '/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',
]
mdns = false
kademlia = true
autonat = true
relay_server = true
relay_client = true
gossipsub = true
max_conns_out = 256
max_conns_in = 256
max_conns_pending_out = 256
max_conns_pending_in = 256
max_conns_per_peer = 8
notify_handler_buffer_size = 256
connection_event_buffer_size = 256
dial_concurrency_factor = 16

Remember to build with --feature=uds-gateway to enable uds support.

If this is ok with you I'd like to move towards merging this?

Copy link
Contributor

@fabricedesre fabricedesre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, thanks!

@Arqu Arqu merged commit 11fe705 into main Aug 31, 2022
@Arqu Arqu deleted the arqu/ipfsd branch August 31, 2022 19:43
@Arqu Arqu mentioned this pull request Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants