Skip to content

Commit

Permalink
refactor: refactor make trust ip
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadrezamomeni committed Jan 1, 2024
1 parent 162a228 commit 354cfa9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/ip.go
Expand Up @@ -2,6 +2,7 @@ package utils

import (
"net"
"strings"
)

func parseIP(ip string) (net.IP, error) {
Expand All @@ -17,6 +18,9 @@ func parseIP(ip string) (net.IP, error) {
}

func MakeTrustIP(trustedIP string) (string, error) {
if strings.Contains(trustedIP, "/") {
return trustedIP, nil
}
ip, err := parseIP(trustedIP)

if err != nil {
Expand Down

0 comments on commit 354cfa9

Please sign in to comment.