Documentation
¶
Index ¶
- Constants
- Variables
- func FreeBuffers2Pool(v *net.Buffers)
- func NewFakeConn(name string) *fakeConn
- func TryClose(obj interface{}) (bool, error)
- func Write2Buffers(buf []byte, dst *net.Buffers)
- type Client
- func (this *Client) GetCID() uint64
- func (this *Client) GetCloseReason() string
- func (this *Client) GetKind() utils.ClientKind
- func (this *Client) GetPendingBytesSize() int64
- func (this *Client) PostBuf(data []byte) error
- func (this *Client) RemoteAddr() string
- func (this *Client) ReqDis(reason CloseReason)
- func (this *Client) WriteAndReqDis(data []byte, reason CloseReason) error
- type ClientSate
- type CloseReason
- type NtripCaster
- func (this *NtripCaster) Actived() bool
- func (this *NtripCaster) Close() error
- func (this *NtripCaster) FakeClient(conn net.Conn) *Client
- func (this *NtripCaster) FakeClientStart(c *Client)
- func (this *NtripCaster) GetClientAliveN() int32
- func (this *NtripCaster) GetOnline() int
- func (this *NtripCaster) ListenAddr() string
- func (this *NtripCaster) SetLogger(logger log.Logger)
- func (this *NtripCaster) Start() error
- func (this *NtripCaster) StatusString() string
- func (this *NtripCaster) WaitShutdown()
- type NtripMountPoint
- type ServerOptions
- type TcpListener
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 NewFakeConn ¶
func NewFakeConn(name string) *fakeConn
Types ¶
type Client ¶
type Client struct {
Tag interface{}
// contains filtered or unexported fields
}
func (*Client) GetCloseReason ¶
func (*Client) GetKind ¶
func (this *Client) GetKind() utils.ClientKind
func (*Client) GetPendingBytesSize ¶
func (*Client) RemoteAddr ¶
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) IsSet ¶
func (cf ClientSate) IsSet(c ClientSate) bool
IsSet returns true if the flag is Set, false otherwise
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
Click to show internal directories.
Click to hide internal directories.