server

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPTypes

type IPTypes struct {
	VirtualIP string
	PrivateIP string
}

IPTypes defines struct that holds virtual IP and privateIP

type MNEDCServer

type MNEDCServer interface {
	CreateServer(string, string, bool) (*Server, error)
	Run()
	AcceptRoutine()
	HandleConnection(net.Conn)
	SetVirtualIP(string) string
	DispatchRoutine()
	Route(*NetPacket)
	SetClientAddress(string, string)
	SetClientIP(string, string, string)
	RemoveClient(string)
	GetClientIPMap() map[string]IPTypes
	TunReadRoutine()
	TunWriteRoutine()
	Close() error
	GetVirtualIP() string
}

MNEDCServer declares methods related to MNEDC server

func GetInstance

func GetInstance() MNEDCServer

GetInstance returns server instance

type NetPacket

type NetPacket struct {
	Packet []byte
}

NetPacket defines the packet struct

type NetPacketIP

type NetPacketIP struct {
	Packet   *NetPacket
	ClientID string
}

NetPacketIP defines the IP packet struct

type Server

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

Server defines MNEDC server struct

func (*Server) AcceptRoutine

func (s *Server) AcceptRoutine()

AcceptRoutine accepts client connections

func (*Server) Close

func (s *Server) Close() error

Close shuts down the server, reversing configuration changes to the system.

func (*Server) CreateServer

func (s *Server) CreateServer(address, port string, isSecure bool) (*Server, error)

CreateServer creates a Server structure and returns it

func (*Server) DispatchRoutine

func (s *Server) DispatchRoutine()

DispatchRoutine sends packets from inboundIPPkts/inboundDevPkts to client/TUN.

func (*Server) GetClientIPMap

func (s *Server) GetClientIPMap() map[string]IPTypes

GetClientIPMap returns clientIPInfoByDeviceID map to proxy server

func (*Server) GetVirtualIP

func (s *Server) GetVirtualIP() string

GetVirtualIP returns the server virtualIP

func (*Server) HandleConnection

func (s *Server) HandleConnection(conn net.Conn)

HandleConnection handles new client registration

func (*Server) RemoveClient

func (s *Server) RemoveClient(deviceID string)

RemoveClient removes a client connection

func (*Server) Route

func (s *Server) Route(pkt *NetPacket)

Route channels the packet to appropriate destination

func (*Server) Run

func (s *Server) Run()

Run starts the server and starts to accept clients

func (*Server) SetClientAddress

func (s *Server) SetClientAddress(deviceID string, addr string)

SetClientAddress puts the device ID in the map

func (*Server) SetClientIP

func (s *Server) SetClientIP(deviceID, privateIP, virtualIP string)

SetClientIP saves new device ipInfo from broadcast server

func (*Server) SetVirtualIP

func (s *Server) SetVirtualIP(deviceID string) string

SetVirtualIP builds the parameters to be sent to client

func (*Server) TunReadRoutine

func (s *Server) TunReadRoutine()

TunReadRoutine reads from tun virtual interface and sends the packet to server

func (*Server) TunWriteRoutine

func (s *Server) TunWriteRoutine()

TunWriteRoutine reads the outgoing packets from server and writes on tun virtual Interface

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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