mirror of
https://github.com/screego/server.git
synced 2026-04-22 15:37:21 +08:00
27 lines
598 B
Go
27 lines
598 B
Go
package turn
|
|
|
|
import (
|
|
"errors"
|
|
"net"
|
|
"strconv"
|
|
)
|
|
|
|
type RelayAddressGeneratorNone struct{}
|
|
|
|
func (r *RelayAddressGeneratorNone) Validate() error {
|
|
return nil
|
|
}
|
|
|
|
func (r *RelayAddressGeneratorNone) AllocatePacketConn(network string, requestedPort int) (net.PacketConn, net.Addr, error) {
|
|
conn, err := net.ListenPacket("udp", ":"+strconv.Itoa(requestedPort))
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
return conn, conn.LocalAddr(), nil
|
|
}
|
|
|
|
func (r *RelayAddressGeneratorNone) AllocateConn(network string, requestedPort int) (net.Conn, net.Addr, error) {
|
|
return nil, nil, errors.New("todo")
|
|
}
|