proxy

package
v0.0.0-...-ed4090f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package proxy provides proxy service and redirects requests form proxy.Addr to remote.Addr.

Package proxy provides proxy service and redirects requests form proxy.Addr to remote.Addr.

Index

Constants

View Source
const (
	// Query - Query message.
	Query = 'Q'
	// Bind
	Bind = 'P'
)

Variables

This section is empty.

Functions

func ResultFormater

func ResultFormater(res sql.Result)

Parse exec's results and formate it,then will be print in command line such as: OK, [n] rows affected else error

func RowsFormater

func RowsFormater(rows *sql.Rows)

Parse query's results and formate it,then will be print in command line such as: +---------+----------------+----------+ | ID | IP | NAME | +---------+----------------+----------+ | 1 | 180.17.95.2 | Jack | | 2 | 180.17.95.3 | Wong | | 3 | 180.17.95.4 | Lin | | 4 | 180.17.95.5 | Trump | +---------+----------------+----------+ else error

func Start

func Start(proxyHost, remoteHost string, handler Handler)

Start proxy server needed receive and proxyHost, all the request or database's sql of receive will redirect to remoteHost.

Types

type Handler

type Handler func(get []byte) ([]byte, error)

Handler function from proxy to postgresql for rewrite request or sql.

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy - Manages a Proxy connection, piping data between proxy and remote.

func New

func New(conn *net.TCPConn, proxyAddr, remoteAddr *net.TCPAddr, connid uint64) *Proxy

New - Create a new Proxy instance. Takes over local connection passed in, and closes it when finished.

Jump to

Keyboard shortcuts

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