Class: ProxyProtocol::Socket

Inherits:
Socket
  • Object
show all
Includes:
Header
Defined in:
lib/proxyprotocol/socket.rb

Instance Method Summary collapse

Methods included from Header

#ip_version, #proxy_protocol_header

Constructor Details

#initialize(domain, socktype, protocol = 0, source_ip = nil, source_port = nil, dest_ip = nil, dest_port = nil, local_host = nil, local_port = nil) ⇒ Socket

Returns a new instance of Socket.



6
7
8
9
10
11
# File 'lib/proxyprotocol/socket.rb', line 6

def initialize(domain, socktype, protocol=0, source_ip=nil, source_port=nil,
               dest_ip=nil, dest_port=nil, local_host=nil, local_port=nil)
  @header = proxy_protocol_header(source_ip, source_port, dest_ip,
                                  dest_port)
  super(domain, socktype, protocol=0)
end

Instance Method Details

#connect(remote_sockaddr) ⇒ Object



13
14
15
16
# File 'lib/proxyprotocol/socket.rb', line 13

def connect(remote_sockaddr)
  super
  write(@header)
end