blob: b293afe166c686235701fb946ae4097eeddb58a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
module Gitlab
module UrlBlockers
class IpAllowlistEntry
attr_reader :ip, :port
# Argument ip should be an IPAddr object
def initialize(ip, port: nil)
@ip = ip
@port = port
end
def match?(requested_ip, requested_port = nil)
return false unless ip.include?(requested_ip)
return true if port.nil?
port == requested_port
end
end
end
end
|