Skip to content

Specifying an interface to use (e.g. wifi) #4

Description

@emmanuelproulx

In my iOS app I have to go through the available wifi interface even if there isn't any Internet on it. But by default, iOS will go through the cellular network.

This is a big problem to me. I need to be able to specify the interface type.

I believe this translates to using SSH_OPTIONS_BINDADDR but I can't find this option in the mft library.

Is there a workaround?

If not, would it be possible to add this?

    var bindAddress: String = ""

    public init(hostname: String, port: Int, username: String, password: String, bindAddress: String = "") {
        
        self.hostname = hostname
        self.port = port
        self.username = username
        self.password = password
        self.bindAddress = bindAddress
        self.prvKeyPath = ""
        self.prvKey = ""
        self.passphrase = ""
        self.sshAgentSocketPath = ""
    }

    func _connect() throws {
        
        session = ssh_new()
...
        if self.bindAddress != "" {
            if ssh_options_set(session, SSH_OPTIONS_BINDADDR, self.bindAddress) < 0 {
                defer {
                    ssh_free(session)
                    session = nil
                }
                throw error_ssh()
            }
        }
...

Then I would be able to specify the network type like this:

                var sftp: MFTSftpConnection!
                sftp = MFTSftpConnection(
                    hostname: host, port: port, username: username,
                    password: password, bindAddress: myWifiIpAddress)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions