mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
TEST: Upgrade pion to v3.2.9. (#3567)
------ Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
parent
104cf14d68
commit
df854339ea
1383 changed files with 118469 additions and 41421 deletions
32
trunk/3rdparty/srs-bench/vnet/udpproxy.go
vendored
32
trunk/3rdparty/srs-bench/vnet/udpproxy.go
vendored
|
@ -10,19 +10,20 @@ import (
|
|||
// UDPProxy is a proxy between real server(net.UDPConn) and vnet.UDPConn.
|
||||
//
|
||||
// High level design:
|
||||
// ..............................................
|
||||
// : Virtual Network (vnet) :
|
||||
// : :
|
||||
// +-------+ * 1 +----+ +--------+ :
|
||||
// | :App |------------>|:Net|--o<-----|:Router | .............................
|
||||
// +-------+ +----+ | | : UDPProxy :
|
||||
// : | | +----+ +---------+ +---------+ +--------+
|
||||
// : | |--->o--|:Net|-->o-| vnet. |-->o-| net. |--->-| :Real |
|
||||
// : | | +----+ | UDPConn | | UDPConn | | Server |
|
||||
// : | | : +---------+ +---------+ +--------+
|
||||
// : | | ............................:
|
||||
// : +--------+ :
|
||||
// ...............................................
|
||||
//
|
||||
// ..............................................
|
||||
// : Virtual Network (vnet) :
|
||||
// : :
|
||||
// +-------+ * 1 +----+ +--------+ :
|
||||
// | :App |------------>|:Net|--o<-----|:Router | .............................
|
||||
// +-------+ +----+ | | : UDPProxy :
|
||||
// : | | +----+ +---------+ +---------+ +--------+
|
||||
// : | |--->o--|:Net|-->o-| vnet. |-->o-| net. |--->-| :Real |
|
||||
// : | | +----+ | UDPConn | | UDPConn | | Server |
|
||||
// : | | : +---------+ +---------+ +--------+
|
||||
// : | | ............................:
|
||||
// : +--------+ :
|
||||
// ...............................................
|
||||
type UDPProxy struct {
|
||||
// The router bind to.
|
||||
router *Router
|
||||
|
@ -109,9 +110,12 @@ func (v *aUDPProxyWorker) Close() error {
|
|||
|
||||
func (v *aUDPProxyWorker) Proxy(ctx context.Context, client *Net, serverAddr *net.UDPAddr) error { // nolint:gocognit
|
||||
// Create vnet for real server by serverAddr.
|
||||
nw := NewNet(&NetConfig{
|
||||
nw, err := NewNet(&NetConfig{
|
||||
StaticIP: serverAddr.IP.String(),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v.router.AddNet(nw); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue