MCPcopy
hub / github.com/grpc/grpc-go / newLocalIPMatcher

Function newLocalIPMatcher

internal/xds/rbac/matchers.go:363–370  ·  view source on GitHub ↗
(cidrRange *v3corepb.CidrRange)

Source from the content-addressed store, hash-verified

361}
362
363func newLocalIPMatcher(cidrRange *v3corepb.CidrRange) (*localIPMatcher, error) {
364 cidrRangeString := fmt.Sprintf("%s/%d", cidrRange.AddressPrefix, cidrRange.PrefixLen.Value)
365 ipNet, err := netip.ParsePrefix(cidrRangeString)
366 if err != nil {
367 return nil, err
368 }
369 return &localIPMatcher{ipNet: ipNet.Masked()}, nil
370}
371
372func (dim *localIPMatcher) match(data *rpcData) bool {
373 host, _, err := net.SplitHostPort(data.localAddr.String())

Callers 1

matchersFromPermissionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected