upstream

package
v0.0.0-...-23d3adf Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Upstream

type Upstream struct {
	Key         string
	List        []string
	Strategy    string
	DialTimeOut int
}

func (*Upstream) RecycleDgram

func (this *Upstream) RecycleDgram(conn *UpstreamTypeDgram)

func (*Upstream) RecycleStream

func (this *Upstream) RecycleStream(conn *UpstreamTypeStream)

func (*Upstream) RecycleTcp

func (this *Upstream) RecycleTcp(tcpConn UpstreamTcpConn)

func (*Upstream) RecycleUdp

func (this *Upstream) RecycleUdp(udpConn UpstreamUdpConn)

func (*Upstream) SelectDgram

func (this *Upstream) SelectDgram(key int, dial bool) (*UpstreamTypeDgram, error)

func (*Upstream) SelectStream

func (this *Upstream) SelectStream(key int, dial bool) (*UpstreamTypeStream, error)

func (*Upstream) SelectTcp

func (this *Upstream) SelectTcp(key int, dial bool) (UpstreamTcpConn, error)
Example
package main

import (
	"fmt"

	"github.com/goodplayer/asa/core/upstream"
)

func main() {
	up := upstream.Upstream{
		List: []string{"tcp://127.0.0.1:8012"},
	}

	conn, err := up.SelectTcp(1)
	fmt.Println(err, conn.TCPConn.RemoteAddr())
}
Output:

func (*Upstream) SelectUdp

func (this *Upstream) SelectUdp(key int, dial bool) (UpstreamUdpConn, error)

type UpstreamTcpConn

type UpstreamTcpConn struct {
	*net.TCPConn
	Addr string
	// contains filtered or unexported fields
}

type UpstreamTypeDgram

type UpstreamTypeDgram struct {
	net.PacketConn
	Addr string
	// contains filtered or unexported fields
}

type UpstreamTypeStream

type UpstreamTypeStream struct {
	net.Conn
	Addr string
	// contains filtered or unexported fields
}

type UpstreamUdpConn

type UpstreamUdpConn struct {
	*net.UDPConn
	Addr string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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