github.com/searKing/golang/go@v1.2.117/net/ice/port.go (about)

     1  // Copyright 2020 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ice
     6  
     7  import "fmt"
     8  
     9  var portMap = map[string]string{
    10  	"stun":  "3478",
    11  	"turn":  "3478",
    12  	"stuns": "5349",
    13  	"turns": "5349",
    14  }
    15  var getDefaultPort = func(schema string) (string, error) {
    16  	port, ok := portMap[schema]
    17  	if ok {
    18  		return port, nil
    19  	}
    20  	return "", fmt.Errorf("malformed schema:%s", schema)
    21  }