Skip to content

Allow restricting mobile data use #3429

@hazelmeow

Description

@hazelmeow

I'm working on a file transfer mobile app. I want to warn the user before doing big transfers on mobile data, or allow disabling mobile data entirely. Are there any APIs that enable this currently? And what about with multipath?

If this is already possible it would be nice to have docs on this.

Response copied from Discord for posterity:

This is somewhat difficult.

You can bind the iroh endpoint to a specific interface (i.e. Wifi-only) to make sure no data is ever sent via anything that's not Wifi.

You can try to figure out which interface is the cellular one and then observe the connection type's IP addr (if it's direct or mixed) and restrict throughput using e.g. Connection::set_receive_window (although curiously quinn is missing set_send_windowat the moment)

With multipath it'll eventually (probably not in the first version) be possible to make a QUIC stream "stick" to a specific path. In that case you'd be able to make sure that you only ever send the transfer data over that stream which will only transfer over e.g. Wifi.

Other folks have done the "watch the connection type" trick, that one's probably the most practical today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions