handleClientNodeRequests validates GetUpdateSelf requests and declines ReadyForHandshake requests
(req *proto.CoordinateRequest)
| 130 | |
| 131 | // handleClientNodeRequests validates GetUpdateSelf requests and declines ReadyForHandshake requests |
| 132 | func handleClientNodeRequests(req *proto.CoordinateRequest) error { |
| 133 | if upd := req.GetUpdateSelf(); upd != nil { |
| 134 | for _, addrStr := range upd.Node.Addresses { |
| 135 | pre, err := netip.ParsePrefix(addrStr) |
| 136 | if err != nil { |
| 137 | return xerrors.Errorf("parse node address: %w", err) |
| 138 | } |
| 139 | |
| 140 | if pre.Bits() != 128 { |
| 141 | return InvalidAddressBitsError{pre.Bits()} |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | if rfh := req.GetReadyForHandshake(); rfh != nil { |
| 147 | return xerrors.Errorf("clients may not send ready_for_handshake") |
| 148 | } |
| 149 | return nil |
| 150 | } |
| 151 | |
| 152 | // tunnelStore contains tunnel information and allows querying it. It is not threadsafe and all |
| 153 | // methods must be serialized by holding, e.g. the core mutex. |
no test coverage detected