p2p

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

P2P (Peer-to-Peer) Network

This package provides a framework to create a P2P Network

Modules

  • Broker
    • Server
      • Manages connections between Broker Clients.
      • Right now, a network can only have one Broker Server.
      • This is by design as a Broker Server has the sole task of brokering between Clients. It does not act as a Relay.
    • Client
      • Standalone entity used to connect to other clients (peers).
  • Relay
    • When a P2P connection cannot be established, the clients can request route traffic through a relay.
    • There can be multiple relays in a P2P network. A client choses the one closest to it (by pinging) to relay it's connection.
    • A client can also use a predefined relay instead of dynamically choosing one closest to it.
  • Server
    • Used in Broker - Server
    • Helps in establishing P2P connections between clients.
  • Client
    • Used in Broker - Client
    • Manages P2P connections with other clients.

Examples

  • xTUNNEL - Tunnel TCP/UDP traffic between nodes

Documentation

Overview

Package p2p provides Peer-to-Peer network functionality

Index

Constants

View Source
const (
	TickerDuration    = time.Second * 15
	RequestTimeout    = time.Second * 5
	ConnectionTimeout = time.Second * 15
)
View Source
const (
	KEY_PORT          = "PORT"
	KEY_CONNECTION_ID = "CONNECTION_ID"

	KEY_STREAM_IGNORE  = "STREAM_IGNORE"
	KEY_STREAM_MESSAGE = "STREAM_MESSAGE"
)
View Source
const (
	TAG_RELAY = "relay"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionMode

type ConnectionMode string
const (
	ConnectionModeRelay ConnectionMode = "relay"
	ConnectionModeP2P   ConnectionMode = "p2p"
)

type ConnectionState

type ConnectionState int
const (
	ConnectionStateDisconnected ConnectionState = iota
	ConnectionStateConnecting
	ConnectionStateConnected
)

Directories

Path Synopsis
broker
client
Package brokerc provides functionality to create a Broker Client
Package brokerc provides functionality to create a Broker Client
server
Package brokers provides functionality to create a Broker Server
Package brokers provides functionality to create a Broker Server
Package p2pc extends udpc to provide P2P functionality
Package p2pc extends udpc to provide P2P functionality
Package relay provides functionality to create a Relay Server
Package relay provides functionality to create a Relay Server
Package p2ps extends udps to provide P2P functionality
Package p2ps extends udps to provide P2P functionality

Jump to

Keyboard shortcuts

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