Documentation
¶
Overview ¶
Package netchan provides a network communication framework using channels.
Index ¶
- Variables
- func AdvancedDial(addr string) (sendChan chan Message, receiveChan chan Message, err error)
- func AdvancedListen(addr string) (sendChan chan Message, receiveChan chan Message, err error)
- func Dial(address string) (dispatcherSend chan interface{}, dispatcherReceive chan interface{}, err error)
- func ErrorLogWorker()
- func Listen(address string) (dispatcherSend chan interface{}, dispatcherReceive chan interface{}, err error)
- func Println(message string)
- func Printonce(message string)
- type LogData
- type Message
Constants ¶
This section is empty.
Variables ¶
var LogTask chan LogData
LogTask is a channel that transmits LogData instances for logging.
Functions ¶
func AdvancedDial ¶
AdvancedDial establishes a secure TLS connection to the given address. It returns two channels for sending and receiving Message structs, and an error if the initial connection setup fails.
func AdvancedListen ¶
AdvancedListen sets up a secure TCP listener using TLS. It returns two channels for sending and receiving messages in special netchan type, along with an error. addr: The network address to listen on.
func Dial ¶
func Dial(address string) (dispatcherSend chan interface{}, dispatcherReceive chan interface{}, err error)
Dial creates channels for sending and receiving data to a specified address. It uses AdvancedDial to establish a network connection and then sets up channels to send and receive data.
func ErrorLogWorker ¶
func ErrorLogWorker()
ErrorLogWorker is a background worker function that processes log messages from the LogTask channel.
func Listen ¶
func Listen(address string) (dispatcherSend chan interface{}, dispatcherReceive chan interface{}, err error)
Listen sets up a dispatcher for handling messages between clients and the server. It returns two channels for sending and receiving any data types, along with an error. address: The network address on which the server will listen.
Types ¶
type LogData ¶
type LogData struct {
// contains filtered or unexported fields
}
LogData is a structure that holds a log message and a flag indicating if the message can be repeated.
type Message ¶
type Message struct { To string //recepient network address and port hash (plain text) From string //sender network address and port hash (encrypted by recepient public key) Payload interface{} //channel data packed in GOB (encrypted by recepient public key) Secret string //random per session secret (encrypted by recepient public key) }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
internet/cluster-benchmark
Client example demonstrates the use of the netchan package for creating a simple cluster.
|
Client example demonstrates the use of the netchan package for creating a simple cluster. |
localhost
Example demonstrates the use of the netchan package for creating a simple cluster.
|
Example demonstrates the use of the netchan package for creating a simple cluster. |