Skip to content

Do library have ability to set NAT 1 to 1 ips? #740

@Razzwan

Description

@Razzwan

I am running the application inside a docker container, so the network visible inside the container has a local ip address. When I send an offer to the client, the candidate should contain the server's public ip address (not local one). How can I correctly specify the server's ip address in the sent offer using the str0m library?

My assumption is to modify the answer before sending it. I don't understand if I can do this using the Sdp method or if I need to edit the string.

        let candidate =
            Candidate::host(LOCAL_DOCKER_IP_ADDRESS_WITH_PORT_HERE, "udp").expect("a host candidate");
        rtc.add_local_candidate(candidate).unwrap();

        let mut str0m_answer = rtc
            .sdp_api()
            .accept_offer(str0m_offer)
            .expect("str0m_offer to be accepted");
        tracing::warn!("str0m answer - {:#?}", str0m_answer);

        // Can I somehow to exchange ip address here to real public IP address?
        // str0m_answer.set_nat_1to1_ips(PUBLIC_IP_ADDRESS); // I would like to make it works

If library doesn't have this feature, what do you think if I'll implement it?

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