MCPcopy Index your code
hub / github.com/subtrace/subtrace / getRemotePeerAddr

Method getRemotePeerAddr

cmd/run/socket/inode.go:82–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80}
81
82func (s *ImmutableState) getRemotePeerAddr() (netip.AddrPort, syscall.Errno, error) {
83 switch s.state {
84 case StatePassive:
85 return netip.AddrPort{}, 0, nil
86
87 case StateConnected:
88 addr, err := netip.ParseAddrPort(s.connected.proxy.external.RemoteAddr().String())
89 if err != nil {
90 return netip.AddrPort{}, 0, fmt.Errorf("external conn: parse remote addr: %w", err)
91 }
92 return addr, 0, nil
93
94 case StateConnecting:
95 return s.connecting.peer, 0, nil
96
97 case StateListening:
98 return netip.AddrPort{}, unix.EINVAL, nil
99
100 case StateClosed:
101 return netip.AddrPort{}, unix.EBADF, nil
102 }
103 panic("unreachable")
104}
105
106type Inode struct {
107 Domain int

Callers 1

PeerAddrMethod · 0.80

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected