ntripcaster

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ICY_200_OK         = "ICY 200 OK\r\n\r\n"
	ERR_BADPASS        = "ERROR - Bad Password\r\n"
	NTRIP_UNAUTHORIZED = "HTTP/1.0 401 Unauthorized"
	ERR_INNER          = "ERROR - Inner error \r\n"
	ERR_BADMountPoint  = "ERROR - Bad MountPoint\r\n"
	ERR_INVALIDHEAD    = "ERROR - InvalidHead \r\n"
)
View Source
const (
	ClosedState = CloseReason(iota + 1)
	ParseError
	ReadError
	WriteError
	WriteTimeout
	SlowConsumerPendingBytes
	AuthError
	RequestClose
)

Variables

View Source
var (
	GetBufFromPool func(sz int) []byte
	PutBuf2Pool    func(b []byte)
)
View Source
var (
	CasterAliveN atomic.Int32
)
View Source
var (
	CloseReasonString = [RequestClose + 1]string{"", "Closed", "ParseError", "ReadError", "WriteError", "WriteTimeout", "SlowConsumer", "AuthError", "RequestClose"}
)

Functions

func FreeBuffers2Pool

func FreeBuffers2Pool(v *net.Buffers)

func NewFakeConn

func NewFakeConn(name string) *fakeConn

func TryClose

func TryClose(obj interface{}) (bool, error)

func Write2Buffers

func Write2Buffers(buf []byte, dst *net.Buffers)

dst can't be nil

Types

type Client

type Client struct {
	Tag interface{}
	// contains filtered or unexported fields
}

func (*Client) GetCID

func (this *Client) GetCID() uint64

func (*Client) GetCloseReason

func (this *Client) GetCloseReason() string

func (*Client) GetKind

func (this *Client) GetKind() utils.ClientKind

func (*Client) GetPendingBytesSize

func (this *Client) GetPendingBytesSize() int64

func (*Client) PostBuf

func (this *Client) PostBuf(data []byte) error

func (*Client) RemoteAddr

func (this *Client) RemoteAddr() string

func (*Client) ReqDis

func (this *Client) ReqDis(reason CloseReason)

func (*Client) WriteAndReqDis

func (this *Client) WriteAndReqDis(data []byte, reason CloseReason) error

type ClientSate

type ClientSate uint16
const (
	CloseConnectionState ClientSate = 1 << iota
	FlushOutboundState
	WriteLoopWaitState
	NtripOnRecv
	NtripOnClose
	NtripOnSend
)

func (*ClientSate) Clear

func (cf *ClientSate) Clear(c ClientSate)

Clear the flag

func (ClientSate) IsSet

func (cf ClientSate) IsSet(c ClientSate) bool

IsSet returns true if the flag is Set, false otherwise

func (*ClientSate) Set

func (cf *ClientSate) Set(c ClientSate)

Set the flag

func (*ClientSate) SetIfNotSet

func (cf *ClientSate) SetIfNotSet(c ClientSate) bool

SetIfNotSet will Set the flag `c` if that flag was not already

type CloseReason

type CloseReason int

type NtripCaster

type NtripCaster struct {
	OnNtripAccept   func(c *Client, req *utils.NtripRequestHead, data []byte)
	OnNtripDataRecv func(c *Client, data []byte)

	// sent data is pool block in net.buffers
	OnNtripDataSend func(c *Client, data []byte)

	OnNtripClose func(c *Client)
	// contains filtered or unexported fields
}

func NewNtripCaster

func NewNtripCaster(opts *ServerOptions) *NtripCaster

func (*NtripCaster) Actived

func (this *NtripCaster) Actived() bool

func (*NtripCaster) Close

func (this *NtripCaster) Close() error

func (*NtripCaster) FakeClient

func (this *NtripCaster) FakeClient(conn net.Conn) *Client

func (*NtripCaster) FakeClientStart

func (this *NtripCaster) FakeClientStart(c *Client)

func (*NtripCaster) GetClientAliveN

func (this *NtripCaster) GetClientAliveN() int32

func (*NtripCaster) GetOnline

func (this *NtripCaster) GetOnline() int

func (*NtripCaster) ListenAddr

func (this *NtripCaster) ListenAddr() string

func (*NtripCaster) SetLogger

func (this *NtripCaster) SetLogger(logger log.Logger)

func (*NtripCaster) Start

func (this *NtripCaster) Start() error

func (*NtripCaster) StatusString

func (this *NtripCaster) StatusString() string

func (*NtripCaster) WaitShutdown

func (this *NtripCaster) WaitShutdown()

type NtripMountPoint

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

type ServerOptions

type ServerOptions struct {
	WriteDeadline time.Duration
	MaxPending    int64
	Logger        log.Logger
	Addr          string
}

func DefaultServerOptions

func DefaultServerOptions() *ServerOptions

type TcpListener

type TcpListener struct {
	HandleConnFunc func(conn net.Conn)
	OnErr          func(err error)
	OnListenSucc   func(network, addr string)
	// contains filtered or unexported fields
}

func NewTcpListener

func NewTcpListener() *TcpListener

func (*TcpListener) Active

func (this *TcpListener) Active() bool

func (*TcpListener) CheckStart

func (this *TcpListener) CheckStart()

func (*TcpListener) Close

func (this *TcpListener) Close() error

func (*TcpListener) Config

func (this *TcpListener) Config(network, addr string) bool

func (*TcpListener) Open

func (this *TcpListener) Open()

func (*TcpListener) Status

func (this *TcpListener) Status() int
1: Listen success

-1: Listen failed

0: Not started

func (*TcpListener) StatusString

func (this *TcpListener) StatusString() string

Jump to

Keyboard shortcuts

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