proplo

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 10 Imported by: 0

README

proplo

ProxyProtocol Logger daemon

Usage

$ proplo
proplo [local_host:port] [upstream_host:port]

Example

Run proplo on 127.0.0.1:9876 which proxy to 10.8.0.1:80.

$ proplo 127.0.0.1:9876 10.8.0.1:80
2020/02/25 00:52:07 [info] Upstream 10.8.0.1:80
2020/02/25 00:52:07 [info] Listening 127.0.0.1:9876

Try connect to proplo with Proxy Protocol and send some payloads.

$ telnet 127.0.0.1 9876
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
PROXY TCP4 192.168.1.1 172.16.0.1 9999 8888
GET / HTTP/1.0

proplo proxies the payloads to the upstream and outputs logs of the connection.

{"id":"e4640056-4811-4fce-9948-d00231cf5454","type":"connect","time":"2020-02-25T00:52:36.68708+09:00","client_addr":"192.168.1.1:9999","proxy_addr":"10.8.0.6:61424","upstream_addr":"10.8.0.1:80","status":"connected","client_at":"2020-02-25T00:52:17.000776+09:00","upstream_at":"2020-02-25T00:52:36.687079+09:00"}
{"id":"e4640056-4811-4fce-9948-d00231cf5454","type":"transfer","time":"2020-02-25T00:52:44.835855+09:00","src_addr":"10.8.0.1:80","proxy_addr":"10.8.0.6:61424","dest_addr":"192.168.1.1:9999","bytes":337,"duration":27.834918903,"error":null}
{"id":"e4640056-4811-4fce-9948-d00231cf5454","type":"transfer","time":"2020-02-25T00:52:44.836469+09:00","src_addr":"192.168.1.1:9999","proxy_addr":"10.8.0.6:61424","dest_addr":"10.8.0.1:80","bytes":18,"duration":27.835533649,"error":null}

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opt *Options) error

Run runs proplo

Types

type LogConnect

type LogConnect struct {
	ID           string    `json:"id"`
	Type         string    `json:"type"`
	Time         time.Time `json:"time"`
	ClientAddr   string    `json:"client_addr"`
	ProxyAddr    string    `json:"proxy_addr"`
	UpstreamAddr string    `json:"upstream_addr"`
	Status       string    `json:"status"`
	ClientAt     time.Time `json:"client_at"`
	UpstreamAt   time.Time `json:"upstream_at"`
}

LogConnect represents log at connected

func (LogConnect) Print

func (l LogConnect) Print(status string) error

type LogProxy

type LogProxy struct {
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	Time      time.Time `json:"time"`
	SrcAddr   string    `json:"src_addr"`
	ProxyAddr string    `json:"proxy_addr"`
	DestAddr  string    `json:"dest_addr"`
	Bytes     int64     `json:"bytes"`
	Duration  float64   `json:"duration"`
	Error     error     `json:"error"`
}

func (LogProxy) Print

func (l LogProxy) Print() error

type Options added in v0.0.3

type Options struct {
	LocalAddr    string
	UpstreamAddr string
	IgnoreCIDR   string
	// contains filtered or unexported fields
}

func (*Options) Ignore added in v0.0.3

func (o *Options) Ignore(ip net.IP) bool

func (*Options) Validate added in v0.0.3

func (o *Options) Validate() error

Directories

Path Synopsis
cmd
proplo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL