nmdc

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug bool

	DefaultFallbackEncoding encoding.Encoding
)
View Source
var (
	ErrRegisteredOnly = errors.New("registered users only")
)

Functions

This section is empty.

Types

type Conn

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

Conn is a NMDC protocol connection.

func Dial

func Dial(addr string) (*Conn, error)

Dial connects to a specified address.

func DialContext

func DialContext(ctx context.Context, addr string) (*Conn, error)

DialContext connects to a specified address.

func NewConn

func NewConn(conn net.Conn) (*Conn, error)

NewConn runs an NMDC protocol over a specified connection.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) FallbackEncoding added in v0.8.11

func (c *Conn) FallbackEncoding() encoding.Encoding

func (*Conn) Flush

func (c *Conn) Flush() error

func (*Conn) GetKeyPrints added in v0.25.0

func (c *Conn) GetKeyPrints() []string

GetKeyPrints returns keyprints set by TLS, if any.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) OnLineR added in v0.16.4

func (c *Conn) OnLineR(fnc func(line []byte) (bool, error))

func (*Conn) OnLineW added in v0.16.4

func (c *Conn) OnLineW(fnc func(line []byte) (bool, error))

func (*Conn) OnMessageR added in v0.16.4

func (c *Conn) OnMessageR(fnc func(m nmdc.Message) (bool, error))

func (*Conn) OnMessageW added in v0.16.4

func (c *Conn) OnMessageW(fnc func(m nmdc.Message) (bool, error))

func (*Conn) OnRawMessageR added in v0.16.4

func (c *Conn) OnRawMessageR(fnc func(cmd, data []byte) (bool, error))

func (*Conn) OnUnmarshalError added in v0.16.4

func (c *Conn) OnUnmarshalError(fnc func(line []byte, err error) (bool, error))

func (*Conn) ReadMsg

func (c *Conn) ReadMsg(deadline time.Time) (nmdc.Message, error)

func (*Conn) ReadMsgTo

func (c *Conn) ReadMsgTo(deadline time.Time, m nmdc.Message) error

func (*Conn) ReadMsgToAny added in v0.16.4

func (c *Conn) ReadMsgToAny(deadline time.Time, m ...nmdc.Message) (nmdc.Message, error)

func (*Conn) ReadValidateNick

func (c *Conn) ReadValidateNick(deadline time.Time) (*nmdc.ValidateNick, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SendClientHandshake

func (c *Conn) SendClientHandshake(deadline time.Time, ext ...string) (*nmdc.Lock, error)

func (*Conn) SendClientInfo

func (c *Conn) SendClientInfo(deadline time.Time, info *nmdc.MyINFO) error

func (*Conn) SendPingerInfo

func (c *Conn) SendPingerInfo(deadline time.Time, info *nmdc.MyINFO) error

func (*Conn) SetEncoding

func (c *Conn) SetEncoding(enc encoding.Encoding)

func (*Conn) SetFallbackEncoding

func (c *Conn) SetFallbackEncoding(enc encoding.Encoding)

func (*Conn) SetWriteDeadline added in v0.16.4

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) SetWriteTimeout added in v0.16.4

func (c *Conn) SetWriteTimeout(dt time.Duration)

func (*Conn) TextDecoder

func (c *Conn) TextDecoder() *encoding.Decoder

func (*Conn) TextEncoder

func (c *Conn) TextEncoder() *encoding.Encoder

func (*Conn) WriteLine added in v0.8.11

func (c *Conn) WriteLine(data []byte) error

func (*Conn) WriteMsg

func (c *Conn) WriteMsg(m ...nmdc.Message) error

func (*Conn) WriteOneLine added in v0.16.4

func (c *Conn) WriteOneLine(data []byte) error

func (*Conn) WriteOneMsg

func (c *Conn) WriteOneMsg(m nmdc.Message) error

func (*Conn) ZOn added in v0.18.0

func (c *Conn) ZOn(lvl int) error

type ErrBanned added in v0.25.0

type ErrBanned struct {
	Reason string
}

func (*ErrBanned) Error added in v0.25.0

func (e *ErrBanned) Error() string

type HubInfo

type HubInfo struct {
	Name      string
	Addr      string
	KeyPrints []string
	Desc      string
	Topic     string
	Failover  []string
	Encoding  string
	Owner     string
	Server    types.Software
	Ext       []string
	Users     []nmdc.MyINFO
	Ops       []string
	Bots      []string
	Redirect  string
}

func Ping

func Ping(ctx context.Context, addr string, conf PingConfig) (_ *HubInfo, gerr error)

type PingConfig added in v0.8.12

type PingConfig struct {
	Name  string
	Share uint64
	Slots int
	Hubs  int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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