net

package
v0.0.0-...-0d01ef4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: BSD-1-Clause Imports: 5 Imported by: 0

README

net

This package contains basic network code for a TCP client. It allows establishment of a connection over a regular TCP channel, or using a TLS encrypted version by supplying a valid X509 certificate and key file.

Usage

go get github.com/jteeuwen/ircb/net

License

Unless otherwise stated, all of the work in this project is subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.

Documentation

Overview

This package contains basic network code for a TCP client. It allows establishment of a connection over a regular TCP channel, or using a TLS encrypted version by supplying a valid X509 certificate and key file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn represents a single tcp connection.

func Dial

func Dial(address, cert, key string) (c *Conn, err error)

Dial opens a connection to the given address. Optionally it runs in secure mode (TLS). But only if both key and cert contain valid paths to respective x509 key and certificate files.

func (*Conn) Close

func (c *Conn) Close() (err error)

Close closes the connection.

func (*Conn) Read

func (c *Conn) Read(p []byte) (n int, err error)

func (*Conn) ReadLine

func (c *Conn) ReadLine() (data []byte, err error)

ReadLine reads a single line from the underlying stream.

func (*Conn) Write

func (c *Conn) Write(p []byte) (n int, err error)

Write writes the given message to the underlying stream. It ensures the data does not exceed 512 bytes as this is the limit for IRC payloads. Any excess data is simply truncated.

Jump to

Keyboard shortcuts

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