| // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | package proxy |
| 16 |
| 17 | import ( |
| 18 | "context" |
| 19 | "errors" |
| 20 | "fmt" |
| 21 | "io" |
| 22 | "net" |
| 23 | "reflect" |
| 24 | "strconv" |
| 25 | "sync" |
| 26 | "time" |
| 27 |
| 28 | libio "github.com/fatedier/golib/io" |
| 29 | "golang.org/x/time/rate" |
| 30 |
| 31 | "github.com/fatedier/frp/pkg/config/types" |
| 32 | v1 "github.com/fatedier/frp/pkg/config/v1" |
| 33 | "github.com/fatedier/frp/pkg/msg" |
| 34 | plugin "github.com/fatedier/frp/pkg/plugin/server" |
| 35 | "github.com/fatedier/frp/pkg/proto/wire" |
| 36 | "github.com/fatedier/frp/pkg/util/limit" |
| 37 | netpkg "github.com/fatedier/frp/pkg/util/net" |
| 38 | "github.com/fatedier/frp/pkg/util/xlog" |
| 39 | "github.com/fatedier/frp/server/controller" |
| 40 | "github.com/fatedier/frp/server/metrics" |
| 41 | ) |
| 42 |
| 43 | var proxyFactoryRegistry = map[reflect.Type]func(*BaseProxy) Proxy{} |
| 44 |
| 45 | func RegisterProxyFactory(proxyConfType reflect.Type, factory func(*BaseProxy) Proxy) { |
| 46 | proxyFactoryRegistry[proxyConfType] = factory |
| 47 | } |
| 48 |
| 49 | type WorkConn struct { |
| 50 | conn *msg.Conn |
| 51 | } |
| 52 |
| 53 | func NewWorkConn(conn *msg.Conn) *WorkConn { |
| 54 | return &WorkConn{conn: conn} |
| 55 | } |
| 56 |
| 57 | func (c *WorkConn) Start(m *msg.StartWorkConn) (net.Conn, error) { |
| 58 | if err := c.conn.WriteMsg(m); err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | return c.conn, nil |
| 62 | } |
| 63 |
| 64 | func (c *WorkConn) Close() error { |
| 65 | return c.conn.Close() |
| 66 | } |
| 67 |
| 68 | type GetWorkConnFn func() (*WorkConn, error) |
| 69 |
| 70 | type Proxy interface { |
| 71 | Context() context.Context |
| 72 | Run() (remoteAddr string, err error) |
| 73 | GetName() string |
| 74 | GetConfigurer() v1.ProxyConfigurer |
| 75 | GetWorkConnFromPool(src, dst net.Addr) (workConn net.Conn, err error) |
| 76 | GetUsedPortsNum() int |
| 77 | GetResourceController() *controller.ResourceController |
| 78 | GetUserInfo() plugin.UserInfo |
| 79 | GetLimiter() *rate.Limiter |
| 80 | GetLoginMsg() *msg.Login |
| 81 | Close() |
| 82 | } |
| 83 |
| 84 | type BaseProxy struct { |
| 85 | name string |
| 86 | rc *controller.ResourceController |
| 87 | listeners []net.Listener |
| 88 | usedPortsNum int |
| 89 | poolCount int |
| 90 | getWorkConnFn GetWorkConnFn |
| 91 | serverCfg *v1.ServerConfig |
| 92 | encryptionKey []byte |
| 93 | limiter *rate.Limiter |
| 94 | userInfo plugin.UserInfo |
| 95 | loginMsg *msg.Login |
| 96 | configurer v1.ProxyConfigurer |
| 97 | wireProtocol string |
| 98 |
| 99 | mu sync.RWMutex |
| 100 | xl *xlog.Logger |
| 101 | ctx context.Context |
| 102 | } |
| 103 |
| 104 | func (pxy *BaseProxy) GetName() string { |
| 105 | return pxy.name |
| 106 | } |
| 107 |
| 108 | func (pxy *BaseProxy) Context() context.Context { |
| 109 | return pxy.ctx |
| 110 | } |
| 111 |
| 112 | func (pxy *BaseProxy) GetUsedPortsNum() int { |
| 113 | return pxy.usedPortsNum |
| 114 | } |
| 115 |
| 116 | func (pxy *BaseProxy) GetResourceController() *controller.ResourceController { |
| 117 | return pxy.rc |
| 118 | } |
| 119 |
| 120 | func (pxy *BaseProxy) GetUserInfo() plugin.UserInfo { |
| 121 | return pxy.userInfo |
| 122 | } |
| 123 |
| 124 | func (pxy *BaseProxy) GetLoginMsg() *msg.Login { |
| 125 | return pxy.loginMsg |
| 126 | } |
| 127 |
| 128 | func (pxy *BaseProxy) GetLimiter() *rate.Limiter { |
| 129 | return pxy.limiter |
| 130 | } |
| 131 |
| 132 | func (pxy *BaseProxy) GetConfigurer() v1.ProxyConfigurer { |
| 133 | return pxy.configurer |
| 134 | } |
| 135 |
| 136 | func (pxy *BaseProxy) Close() { |
| 137 | xl := xlog.FromContextSafe(pxy.ctx) |
| 138 | xl.Infof("proxy closing") |
| 139 | for _, l := range pxy.listeners { |
| 140 | l.Close() |
| 141 | } |
| 142 | } |
| 143 |
| 144 | // GetWorkConnFromPool try to get a new work connections from pool |
| 145 | // for quickly response, we immediately send the StartWorkConn message to frpc after take out one from pool |
| 146 | func (pxy *BaseProxy) GetWorkConnFromPool(src, dst net.Addr) (workConn net.Conn, err error) { |
| 147 | xl := xlog.FromContextSafe(pxy.ctx) |
| 148 | // try all connections from the pool |
| 149 | for i := 0; i < pxy.poolCount+1; i++ { |
| 150 | var pxyWorkConn *WorkConn |
| 151 | if pxyWorkConn, err = pxy.getWorkConnFn(); err != nil { |
| 152 | xl.Warnf("failed to get work connection: %v", err) |
| 153 | return |
| 154 | } |
| 155 | xl.Debugf("get a new work connection: [%s]", pxyWorkConn.conn.RemoteAddr().String()) |
| 156 | xl.Spawn().AppendPrefix(pxy.GetName()) |
| 157 |
| 158 | var ( |
| 159 | srcAddr string |
| 160 | dstAddr string |
| 161 | srcPortStr string |
| 162 | dstPortStr string |
| 163 | srcPort uint64 |
| 164 | dstPort uint64 |
| 165 | ) |
| 166 |
| 167 | if src != nil { |
| 168 | srcAddr, srcPortStr, _ = net.SplitHostPort(src.String()) |
| 169 | srcPort, _ = strconv.ParseUint(srcPortStr, 10, 16) |
| 170 | } |
| 171 | if dst != nil { |
| 172 | dstAddr, dstPortStr, _ = net.SplitHostPort(dst.String()) |
| 173 | dstPort, _ = strconv.ParseUint(dstPortStr, 10, 16) |
| 174 | } |
| 175 | workConn, err = pxyWorkConn.Start(&msg.StartWorkConn{ |
| 176 | ProxyName: pxy.GetName(), |
| 177 | SrcAddr: srcAddr, |
| 178 | SrcPort: uint16(srcPort), |
| 179 | DstAddr: dstAddr, |
| 180 | DstPort: uint16(dstPort), |
| 181 | Error: "", |
| 182 | }) |
| 183 | if err != nil { |
| 184 | xl.Warnf("failed to send message to work connection from pool: %v, times: %d", err, i) |
| 185 | pxyWorkConn.Close() |
| 186 | workConn = nil |
| 187 | } else { |
| 188 | workConn = netpkg.NewContextConn(pxy.ctx, workConn) |
| 189 | break |
| 190 | } |
| 191 | } |
| 192 |
| 193 | if err != nil { |
| 194 | xl.Errorf("try to get work connection failed in the end") |
| 195 | return |
| 196 | } |
| 197 | return |
| 198 | } |
| 199 |
| 200 | // startVisitorListener sets up a VisitorManager listener for visitor-based proxies (STCP, SUDP). |
| 201 | func (pxy *BaseProxy) startVisitorListener(secretKey string, allowUsers []string, proxyType string) error { |
| 202 | // if allowUsers is empty, only allow same user from proxy |
| 203 | if len(allowUsers) == 0 { |
| 204 | allowUsers = []string{pxy.GetUserInfo().User} |
| 205 | } |
| 206 | listener, err := pxy.rc.VisitorManager.Listen(pxy.GetName(), secretKey, allowUsers) |
| 207 | if err != nil { |
| 208 | return err |
| 209 | } |
| 210 | pxy.listeners = append(pxy.listeners, listener) |
| 211 | pxy.xl.Infof("%s proxy custom listen success", proxyType) |
| 212 | pxy.startCommonTCPListenersHandler() |
| 213 | return nil |
| 214 | } |
| 215 |
| 216 | // buildDomains constructs a list of domains from custom domains and subdomain configuration. |
| 217 | func (pxy *BaseProxy) buildDomains(customDomains []string, subDomain string) []string { |
| 218 | domains := make([]string, 0, len(customDomains)+1) |
| 219 | for _, d := range customDomains { |
| 220 | if d != "" { |
| 221 | domains = append(domains, d) |
| 222 | } |
| 223 | } |
| 224 | if subDomain != "" { |
| 225 | domains = append(domains, subDomain+"."+pxy.serverCfg.SubDomainHost) |
| 226 | } |
| 227 | return domains |
| 228 | } |
| 229 |
| 230 | // startCommonTCPListenersHandler start a goroutine handler for each listener. |
| 231 | func (pxy *BaseProxy) startCommonTCPListenersHandler() { |
| 232 | xl := xlog.FromContextSafe(pxy.ctx) |
| 233 | for _, listener := range pxy.listeners { |
| 234 | go func(l net.Listener) { |
| 235 | var tempDelay time.Duration // how long to sleep on accept failure |
| 236 |
| 237 | for { |
| 238 | // block |
| 239 | // if listener is closed, err returned |
| 240 | c, err := l.Accept() |
| 241 | if err != nil { |
| 242 | if err, ok := err.(interface{ Temporary() bool }); ok && err.Temporary() { |
| 243 | if tempDelay == 0 { |
| 244 | tempDelay = 5 * time.Millisecond |
| 245 | } else { |
| 246 | tempDelay *= 2 |
| 247 | } |
| 248 | if maxTime := 1 * time.Second; tempDelay > maxTime { |
| 249 | tempDelay = maxTime |
| 250 | } |
| 251 | xl.Infof("met temporary error: %s, sleep for %s ...", err, tempDelay) |
| 252 | time.Sleep(tempDelay) |
| 253 | continue |
| 254 | } |
| 255 |
| 256 | xl.Warnf("listener is closed: %s", err) |
| 257 | return |
| 258 | } |
| 259 | xl.Infof("get a user connection [%s]", c.RemoteAddr().String()) |
| 260 | go pxy.handleUserTCPConnection(c) |
| 261 | } |
| 262 | }(listener) |
| 263 | } |
| 264 | } |
| 265 |
| 266 | // HandleUserTCPConnection is used for incoming user TCP connections. |
| 267 | func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) { |
| 268 | xl := xlog.FromContextSafe(pxy.Context()) |
| 269 | defer userConn.Close() |
| 270 |
| 271 | cfg := pxy.configurer.GetBaseConfig() |
| 272 | // server plugin hook |
| 273 | rc := pxy.GetResourceController() |
| 274 | content := &plugin.NewUserConnContent{ |
| 275 | User: pxy.GetUserInfo(), |
| 276 | ProxyName: pxy.GetName(), |
| 277 | ProxyType: cfg.Type, |
| 278 | RemoteAddr: userConn.RemoteAddr().String(), |
| 279 | } |
| 280 | _, err := rc.PluginManager.NewUserConn(content) |
| 281 | if err != nil { |
| 282 | xl.Warnf("the user conn [%s] was rejected, err:%v", content.RemoteAddr, err) |
| 283 | return |
| 284 | } |
| 285 |
| 286 | // try all connections from the pool |
| 287 | workConn, err := pxy.GetWorkConnFromPool(userConn.RemoteAddr(), userConn.LocalAddr()) |
| 288 | if err != nil { |
| 289 | return |
| 290 | } |
| 291 | defer workConn.Close() |
| 292 |
| 293 | var local io.ReadWriteCloser = workConn |
| 294 | xl.Tracef("handler user tcp connection, use_encryption: %t, use_compression: %t", |
| 295 | cfg.Transport.UseEncryption, cfg.Transport.UseCompression) |
| 296 | if cfg.Transport.UseEncryption { |
| 297 | local, err = libio.WithEncryption(local, pxy.encryptionKey) |
| 298 | if err != nil { |
| 299 | xl.Errorf("create encryption stream error: %v", err) |
| 300 | return |
| 301 | } |
| 302 | } |
| 303 | if cfg.Transport.UseCompression { |
| 304 | var recycleFn func() |
| 305 | local, recycleFn = libio.WithCompressionFromPool(local) |
| 306 | defer recycleFn() |
| 307 | } |
| 308 |
| 309 | if pxy.GetLimiter() != nil { |
| 310 | local = libio.WrapReadWriteCloser(limit.NewReader(local, pxy.GetLimiter()), limit.NewWriter(local, pxy.GetLimiter()), func() error { |
| 311 | return local.Close() |
| 312 | }) |
| 313 | } |
| 314 |
| 315 | xl.Debugf("join connections, workConn(l[%s] r[%s]) userConn(l[%s] r[%s])", workConn.LocalAddr().String(), |
| 316 | workConn.RemoteAddr().String(), userConn.LocalAddr().String(), userConn.RemoteAddr().String()) |
| 317 |
| 318 | name := pxy.GetName() |
| 319 | proxyType := cfg.Type |
| 320 | metrics.Server.OpenConnection(name, proxyType) |
| 321 | inCount, outCount, _ := pxy.joinUserConnection(local, userConn, proxyType, xl) |
| 322 | metrics.Server.CloseConnection(name, proxyType) |
| 323 | metrics.Server.AddTrafficIn(name, proxyType, inCount) |
| 324 | metrics.Server.AddTrafficOut(name, proxyType, outCount) |
| 325 | xl.Debugf("join connections closed") |
| 326 | } |
| 327 |
| 328 | func (pxy *BaseProxy) joinUserConnection(local io.ReadWriteCloser, userConn net.Conn, proxyType string, xl *xlog.Logger) (int64, int64, []error) { |
| 329 | visitorWireProtocol := wireProtocolFromConn(userConn) |
| 330 | if proxyType == string(v1.ProxyTypeSUDP) && isMixedWireProtocol(pxy.wireProtocol, visitorWireProtocol) { |
| 331 | xl.Infof("bridge mixed SUDP payload codecs, proxy wireProtocol [%s], visitor wireProtocol [%s]", |
| 332 | normalizeWireProtocol(pxy.wireProtocol), normalizeWireProtocol(visitorWireProtocol)) |
| 333 | return joinSUDPMessageBridge(local, userConn, pxy.wireProtocol, visitorWireProtocol, xl) |
| 334 | } |
| 335 | return libio.Join(local, userConn) |
| 336 | } |
| 337 |
| 338 | type wireProtocolGetter interface { |
| 339 | WireProtocol() string |
| 340 | } |
| 341 |
| 342 | func wireProtocolFromConn(conn net.Conn) string { |
| 343 | if getter, ok := conn.(wireProtocolGetter); ok { |
| 344 | return getter.WireProtocol() |
| 345 | } |
| 346 | return "" |
| 347 | } |
| 348 |
| 349 | func isMixedWireProtocol(left, right string) bool { |
| 350 | return normalizeWireProtocol(left) != normalizeWireProtocol(right) |
| 351 | } |
| 352 |
| 353 | func normalizeWireProtocol(wireProtocol string) string { |
| 354 | if wireProtocol == wire.ProtocolV2 { |
| 355 | return wire.ProtocolV2 |
| 356 | } |
| 357 | return wire.ProtocolV1 |
| 358 | } |
| 359 |
| 360 | func joinSUDPMessageBridge( |
| 361 | proxyConn io.ReadWriteCloser, |
| 362 | visitorConn io.ReadWriteCloser, |
| 363 | proxyWireProtocol string, |
| 364 | visitorWireProtocol string, |
| 365 | xl *xlog.Logger, |
| 366 | ) (inCount int64, outCount int64, errs []error) { |
| 367 | // The mixed bridge decodes and re-encodes messages, so raw framed byte counts |
| 368 | // are not available. Count UDP payload bytes and ignore heartbeat traffic. |
| 369 | proxyRW := msg.NewReadWriter(proxyConn, proxyWireProtocol) |
| 370 | visitorRW := msg.NewReadWriter(visitorConn, visitorWireProtocol) |
| 371 |
| 372 | var ( |
| 373 | once sync.Once |
| 374 | wait sync.WaitGroup |
| 375 | recordErrs = make([]error, 2) |
| 376 | ) |
| 377 | closeBoth := func() { |
| 378 | _ = proxyConn.Close() |
| 379 | _ = visitorConn.Close() |
| 380 | } |
| 381 |
| 382 | wait.Add(2) |
| 383 | go func() { |
| 384 | defer wait.Done() |
| 385 | defer once.Do(closeBoth) |
| 386 | recordErrs[0] = bridgeSUDPProxyToVisitor(proxyRW, visitorRW, &outCount, xl) |
| 387 | }() |
| 388 | go func() { |
| 389 | defer wait.Done() |
| 390 | defer once.Do(closeBoth) |
| 391 | recordErrs[1] = bridgeSUDPVisitorToProxy(visitorRW, proxyRW, &inCount, xl) |
| 392 | }() |
| 393 | wait.Wait() |
| 394 |
| 395 | for _, err := range recordErrs { |
| 396 | if err != nil { |
| 397 | errs = append(errs, err) |
| 398 | } |
| 399 | } |
| 400 | return |
| 401 | } |
| 402 |
| 403 | func bridgeSUDPProxyToVisitor(from msg.ReadWriter, to msg.ReadWriter, count *int64, xl *xlog.Logger) error { |
| 404 | for { |
| 405 | rawMsg, err := from.ReadMsg() |
| 406 | if err != nil { |
| 407 | return normalizeSUDPBridgeError(err) |
| 408 | } |
| 409 |
| 410 | switch m := rawMsg.(type) { |
| 411 | case *msg.UDPPacket: |
| 412 | if err := to.WriteMsg(m); err != nil { |
| 413 | return normalizeSUDPBridgeError(err) |
| 414 | } |
| 415 | *count += int64(len(m.Content)) |
| 416 | case *msg.Ping: |
| 417 | traceSUDPBridge(xl, "bridge SUDP ping from proxy to visitor") |
| 418 | if err := to.WriteMsg(m); err != nil { |
| 419 | return normalizeSUDPBridgeError(err) |
| 420 | } |
| 421 | default: |
| 422 | return fmt.Errorf("unexpected SUDP proxy message %T", rawMsg) |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 |
| 427 | func bridgeSUDPVisitorToProxy(from msg.ReadWriter, to msg.ReadWriter, count *int64, xl *xlog.Logger) error { |
| 428 | for { |
| 429 | rawMsg, err := from.ReadMsg() |
| 430 | if err != nil { |
| 431 | return normalizeSUDPBridgeError(err) |
| 432 | } |
| 433 |
| 434 | switch m := rawMsg.(type) { |
| 435 | case *msg.UDPPacket: |
| 436 | if err := to.WriteMsg(m); err != nil { |
| 437 | return normalizeSUDPBridgeError(err) |
| 438 | } |
| 439 | *count += int64(len(m.Content)) |
| 440 | case *msg.Ping: |
| 441 | traceSUDPBridge(xl, "drop SUDP ping from visitor to proxy") |
| 442 | continue |
| 443 | default: |
| 444 | return fmt.Errorf("unexpected SUDP visitor message %T", rawMsg) |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 |
| 449 | func normalizeSUDPBridgeError(err error) error { |
| 450 | if err == nil || errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed) { |
| 451 | return nil |
| 452 | } |
| 453 | return err |
| 454 | } |
| 455 |
| 456 | func traceSUDPBridge(xl *xlog.Logger, format string, args ...any) { |
| 457 | if xl != nil { |
| 458 | xl.Tracef(format, args...) |
| 459 | } |
| 460 | } |
| 461 |
| 462 | type Options struct { |
| 463 | UserInfo plugin.UserInfo |
| 464 | LoginMsg *msg.Login |
| 465 | PoolCount int |
| 466 | ResourceController *controller.ResourceController |
| 467 | GetWorkConnFn GetWorkConnFn |
| 468 | Configurer v1.ProxyConfigurer |
| 469 | ServerCfg *v1.ServerConfig |
| 470 | EncryptionKey []byte |
| 471 | WireProtocol string |
| 472 | } |
| 473 |
| 474 | func NewProxy(ctx context.Context, options *Options) (pxy Proxy, err error) { |
| 475 | configurer := options.Configurer |
| 476 | xl := xlog.FromContextSafe(ctx).Spawn().AppendPrefix(configurer.GetBaseConfig().Name) |
| 477 |
| 478 | var limiter *rate.Limiter |
| 479 | limitBytes := configurer.GetBaseConfig().Transport.BandwidthLimit.Bytes() |
| 480 | if limitBytes > 0 && configurer.GetBaseConfig().Transport.BandwidthLimitMode == types.BandwidthLimitModeServer { |
| 481 | limiter = rate.NewLimiter(rate.Limit(float64(limitBytes)), int(limitBytes)) |
| 482 | } |
| 483 |
| 484 | basePxy := BaseProxy{ |
| 485 | name: configurer.GetBaseConfig().Name, |
| 486 | rc: options.ResourceController, |
| 487 | listeners: make([]net.Listener, 0), |
| 488 | poolCount: options.PoolCount, |
| 489 | getWorkConnFn: options.GetWorkConnFn, |
| 490 | serverCfg: options.ServerCfg, |
| 491 | encryptionKey: options.EncryptionKey, |
| 492 | limiter: limiter, |
| 493 | xl: xl, |
| 494 | ctx: xlog.NewContext(ctx, xl), |
| 495 | userInfo: options.UserInfo, |
| 496 | loginMsg: options.LoginMsg, |
| 497 | configurer: configurer, |
| 498 | wireProtocol: options.WireProtocol, |
| 499 | } |
| 500 |
| 501 | factory := proxyFactoryRegistry[reflect.TypeOf(configurer)] |
| 502 | if factory == nil { |
| 503 | return pxy, fmt.Errorf("proxy type not support") |
| 504 | } |
| 505 | pxy = factory(&basePxy) |
| 506 | if pxy == nil { |
| 507 | return nil, fmt.Errorf("proxy not created") |
| 508 | } |
| 509 | return pxy, nil |
| 510 | } |
| 511 |
| 512 | type Manager struct { |
| 513 | // proxies indexed by proxy name |
| 514 | pxys map[string]Proxy |
| 515 |
| 516 | mu sync.RWMutex |
| 517 | } |
| 518 |
| 519 | func NewManager() *Manager { |
| 520 | return &Manager{ |
| 521 | pxys: make(map[string]Proxy), |
| 522 | } |
| 523 | } |
| 524 |
| 525 | func (pm *Manager) Add(name string, pxy Proxy) error { |
| 526 | pm.mu.Lock() |
| 527 | defer pm.mu.Unlock() |
| 528 | if _, ok := pm.pxys[name]; ok { |
| 529 | return fmt.Errorf("proxy name [%s] is already in use", name) |
| 530 | } |
| 531 |
| 532 | pm.pxys[name] = pxy |
| 533 | return nil |
| 534 | } |
| 535 |
| 536 | func (pm *Manager) Exist(name string) bool { |
| 537 | pm.mu.RLock() |
| 538 | defer pm.mu.RUnlock() |
| 539 | _, ok := pm.pxys[name] |
| 540 | return ok |
| 541 | } |
| 542 |
| 543 | func (pm *Manager) Del(name string) { |
| 544 | pm.mu.Lock() |
| 545 | defer pm.mu.Unlock() |
| 546 | delete(pm.pxys, name) |
| 547 | } |
| 548 |
| 549 | func (pm *Manager) GetByName(name string) (pxy Proxy, ok bool) { |
| 550 | pm.mu.RLock() |
| 551 | defer pm.mu.RUnlock() |
| 552 | pxy, ok = pm.pxys[name] |
| 553 | return |
| 554 | } |