Home / Function/ checkIfPrivate() — supabase Function Reference

checkIfPrivate() — supabase Function Reference

Architecture documentation for the checkIfPrivate() function in NetworkRestrictions.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  275823bb_fd38_e088_0b7a_84342295b9d0["checkIfPrivate()"]
  4ff86e27_10bd_51fe_bb6f_c71cd9f5b6f7["AddRestrictionModal()"]
  4ff86e27_10bd_51fe_bb6f_c71cd9f5b6f7 -->|calls| 275823bb_fd38_e088_0b7a_84342295b9d0
  style 275823bb_fd38_e088_0b7a_84342295b9d0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Settings/Database/NetworkRestrictions/NetworkRestrictions.utils.ts lines 19–33

export const checkIfPrivate = (type: 'IPv4' | 'IPv6', cidr: string) => {
  try {
    if (type === 'IPv4') {
      const address = IPv4CidrRange.fromCidr(`${cidr}/32`)
      const res = privateIPv4Ranges.map((range) => address.inside(range))
      return res.includes(true)
    } else {
      const address = IPv6CidrRange.fromCidr(`${cidr}/128`)
      const res = privateIPv6Ranges.map((range) => address.inside(range))
      return res.includes(true)
    }
  } catch (error) {
    return false
  }
}

Subdomains

Frequently Asked Questions

What does checkIfPrivate() do?
checkIfPrivate() is a function in the supabase codebase.
What calls checkIfPrivate()?
checkIfPrivate() is called by 1 function(s): AddRestrictionModal.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free