INNER CODE UNIT · Go

NewDefaultConfig

l7mp/stunner · config.go:56

func NewDefaultConfig(uri string) (*stnrv2.StunnerConfig, error) {
	u, err := stnrv2.ParseURI(uri)
	if err != nil {
		return nil, fmt.Errorf("invalid URI '%s': %s", uri, err)
	}

	if u.Username == "" || u.Password == "" {
		return nil, fmt.Errorf("username/password must be set: '%s'", uri)
	}

	// the TURN URI names a TURN transport: the listener takes the transport underneath
	if !u.Protocol.IsTURN() {
		return nil, fmt.Errorf("not a TURN URI: '%s'", uri)
	}
	transport := map[stnrv2.Protocol]stnrv2.Protocol{
		stnrv2.ProtocolTURNUDP:  stnrv2.ProtocolUDP,
		stnrv2.ProtocolTURNTCP:  stnrv2.ProtocolTCP,
		stnrv2.ProtocolTURNTLS:  stnrv2.ProtocolTLS,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…