mirror of
				https://github.com/pion/ice.git
				synced 2025-10-31 18:52:34 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			95 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| //go:build !js
 | |
| // +build !js
 | |
| 
 | |
| package ice
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/require"
 | |
| )
 | |
| 
 | |
| func newHostRemote(t *testing.T) *CandidateHost {
 | |
| 	t.Helper()
 | |
| 
 | |
| 	remoteHostConfig := &CandidateHostConfig{
 | |
| 		Network:   "udp",
 | |
| 		Address:   "1.2.3.5",
 | |
| 		Port:      12350,
 | |
| 		Component: 1,
 | |
| 	}
 | |
| 	hostRemote, err := NewCandidateHost(remoteHostConfig)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	return hostRemote
 | |
| }
 | |
| 
 | |
| func newPrflxRemote(t *testing.T) *CandidatePeerReflexive {
 | |
| 	t.Helper()
 | |
| 
 | |
| 	prflxConfig := &CandidatePeerReflexiveConfig{
 | |
| 		Network:   "udp",
 | |
| 		Address:   "10.10.10.2",
 | |
| 		Port:      19217,
 | |
| 		Component: 1,
 | |
| 		RelAddr:   "4.3.2.1",
 | |
| 		RelPort:   43211,
 | |
| 	}
 | |
| 	prflxRemote, err := NewCandidatePeerReflexive(prflxConfig)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	return prflxRemote
 | |
| }
 | |
| 
 | |
| func newSrflxRemote(t *testing.T) *CandidateServerReflexive {
 | |
| 	t.Helper()
 | |
| 
 | |
| 	srflxConfig := &CandidateServerReflexiveConfig{
 | |
| 		Network:   "udp",
 | |
| 		Address:   "10.10.10.2",
 | |
| 		Port:      19218,
 | |
| 		Component: 1,
 | |
| 		RelAddr:   "4.3.2.1",
 | |
| 		RelPort:   43212,
 | |
| 	}
 | |
| 	srflxRemote, err := NewCandidateServerReflexive(srflxConfig)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	return srflxRemote
 | |
| }
 | |
| 
 | |
| func newRelayRemote(t *testing.T) *CandidateRelay {
 | |
| 	t.Helper()
 | |
| 
 | |
| 	relayConfig := &CandidateRelayConfig{
 | |
| 		Network:   "udp",
 | |
| 		Address:   "1.2.3.4",
 | |
| 		Port:      12340,
 | |
| 		Component: 1,
 | |
| 		RelAddr:   "4.3.2.1",
 | |
| 		RelPort:   43210,
 | |
| 	}
 | |
| 	relayRemote, err := NewCandidateRelay(relayConfig)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	return relayRemote
 | |
| }
 | |
| 
 | |
| func newHostLocal(t *testing.T) *CandidateHost {
 | |
| 	t.Helper()
 | |
| 
 | |
| 	localHostConfig := &CandidateHostConfig{
 | |
| 		Network:   "udp",
 | |
| 		Address:   "192.168.1.1",
 | |
| 		Port:      19216,
 | |
| 		Component: 1,
 | |
| 	}
 | |
| 	hostLocal, err := NewCandidateHost(localHostConfig)
 | |
| 	require.NoError(t, err)
 | |
| 
 | |
| 	return hostLocal
 | |
| }
 | 
