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

STUN Requests are not filtered #727

Open
rahulshinde11 opened this issue Aug 20, 2024 · 0 comments
Open

STUN Requests are not filtered #727

rahulshinde11 opened this issue Aug 20, 2024 · 0 comments

Comments

@rahulshinde11
Copy link

rahulshinde11 commented Aug 20, 2024

Your environment.

  • Version: v2.3.34
  • OS: Ubuntu 22

What did you do?

Force pion/ice to use a specific network interface for ICE gathering by using

settingEngine.SetInterfaceFilter(func(iface string) bool {
        return iface == "eth0" // wlan1
})

What did you expect?

I expect not to see any IP related to the filtered list. But I see the public IPs of both adapters

Here is the full example

package main

import (
	"fmt"

	"github.com/pion/webrtc/v3"
)

func main() {

	config := webrtc.Configuration{
		ICEServers: []webrtc.ICEServer{
			{
				URLs: []string{"stun:stun.l.google.com:19302"},
			},
		},
	}
	settingEngine := webrtc.SettingEngine{}
	settingEngine.SetInterfaceFilter(func(iface string) bool {
		return iface == "eth0" // wlan1
	})
	mediaEngine := webrtc.MediaEngine{}
	mediaEngine.RegisterDefaultCodecs()
	api := webrtc.NewAPI(webrtc.WithSettingEngine(settingEngine), webrtc.WithMediaEngine(&mediaEngine))
	peerConnection, _ := api.NewPeerConnection(config)
	peerConnection.OnICEGatheringStateChange(func(webrtc.ICEGathererState) {
		fmt.Println("ICE Gathering State has changed", peerConnection.ICEGatheringState())
	})

	peerConnection.OnICECandidate(func(c *webrtc.ICECandidate) {
		if c == nil {
			return
		}
		fmt.Println("ICE", c.ToJSON())
	})
	gatherComplete := webrtc.GatheringCompletePromise(peerConnection)
	offer, err := peerConnection.CreateOffer(nil)
	if err != nil {
		panic(err)
	} else if err = peerConnection.SetLocalDescription(offer); err != nil {
		panic(err)
	}
	<-gatherComplete
}

@rahulshinde11 rahulshinde11 changed the title Stun Requests are not filtered STUN Requests are not filtered Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant