直播:后台 JWT 推流、前台画中画;WebRTC 服务与 Nginx WebSocket 代理
Made-with: Cursor
This commit is contained in:
23
server/vendor/github.com/pion/ice/v2/internal/fakenet/mock_conn.go
generated
vendored
Normal file
23
server/vendor/github.com/pion/ice/v2/internal/fakenet/mock_conn.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package fakenet
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MockPacketConn for tests
|
||||
type MockPacketConn struct{}
|
||||
|
||||
func (m *MockPacketConn) ReadFrom([]byte) (n int, addr net.Addr, err error) { return 0, nil, nil } //nolint:revive
|
||||
func (m *MockPacketConn) WriteTo([]byte, net.Addr) (n int, err error) { return 0, nil } //nolint:revive
|
||||
func (m *MockPacketConn) Close() error { return nil } //nolint:revive
|
||||
func (m *MockPacketConn) LocalAddr() net.Addr { return nil } //nolint:revive
|
||||
func (m *MockPacketConn) SetDeadline(time.Time) error { return nil } //nolint:revive
|
||||
func (m *MockPacketConn) SetReadDeadline(time.Time) error { return nil } //nolint:revive
|
||||
func (m *MockPacketConn) SetWriteDeadline(time.Time) error { return nil } //nolint:revive
|
||||
29
server/vendor/github.com/pion/ice/v2/internal/fakenet/packet_conn.go
generated
vendored
Normal file
29
server/vendor/github.com/pion/ice/v2/internal/fakenet/packet_conn.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// Package fakenet contains fake network abstractions
|
||||
package fakenet
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// Compile-time assertion
|
||||
var _ net.PacketConn = (*PacketConn)(nil)
|
||||
|
||||
// PacketConn wraps a net.Conn and emulates net.PacketConn
|
||||
type PacketConn struct {
|
||||
net.Conn
|
||||
}
|
||||
|
||||
// ReadFrom reads a packet from the connection,
|
||||
func (f *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) {
|
||||
n, err = f.Conn.Read(p)
|
||||
addr = f.Conn.RemoteAddr()
|
||||
return
|
||||
}
|
||||
|
||||
// WriteTo writes a packet with payload p to addr.
|
||||
func (f *PacketConn) WriteTo(p []byte, _ net.Addr) (int, error) {
|
||||
return f.Conn.Write(p)
|
||||
}
|
||||
Reference in New Issue
Block a user