runtime

package
v2018.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FREQ_THREASHOLD = 5000
)
View Source
const LOCATION_EQUAL_FORMAT_STRING = "%.6f"

Variables

View Source
var (
	ChannelEU = true

	ChannelList = map[uint32]*Channel{
		1: &Channel{Frequenz: 2412, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},

		5: &Channel{Frequenz: 2432, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},

		9: &Channel{Frequenz: 2452, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},

		13: &Channel{Frequenz: 2472, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},

		34: &Channel{Frequenz: 5170, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
		36: &Channel{Frequenz: 5180, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
		38: &Channel{Frequenz: 5190, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},

		42: &Channel{Frequenz: 5210, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
		44: &Channel{Frequenz: 5220, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
		46: &Channel{Frequenz: 5230, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},

		52: &Channel{Frequenz: 5260, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
		54: &Channel{Frequenz: 5270, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},

		58: &Channel{Frequenz: 5290, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},
		60: &Channel{Frequenz: 5300, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
		62: &Channel{Frequenz: 5310, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},

		68:  &Channel{Frequenz: 5340, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
		96:  &Channel{Frequenz: 5480, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
		100: &Channel{Frequenz: 5500, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
		102: &Channel{Frequenz: 5510, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},

		106: &Channel{Frequenz: 5530, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
		108: &Channel{Frequenz: 5540, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
		110: &Channel{Frequenz: 5550, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},

		114: &Channel{Frequenz: 5570, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},

		134: &Channel{Frequenz: 5670, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},

		138: &Channel{Frequenz: 5690, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
	}
)

Functions

func ChannelIs5GHz

func ChannelIs5GHz(channel uint32) bool

Types

type Channel

type Channel struct {
	Frequenz    uint32
	AllowedInEU bool
	DFS         bool
	Indoor      bool
	SDR         bool
}

func GetChannel

func GetChannel(channel uint32) *Channel

type Config

type Config struct {
	// prevent crashes
	DatabaseType       string `toml:"db_type"`
	DatabaseConnection string `toml:"db_connection"`

	// address on which the api and static content webserver runs
	WebserverBind string `toml:"webserver_bind"`
	// path to deliver static content
	Webroot string `toml:"webroot"`

	// auth secret
	Secret string `toml:"secret"`

	// SSH private key
	SSHPrivateKey      string            `toml:"ssh_key"`
	SSHIPAddressSuffix string            `toml:"ssh_ipaddress_suffix"`
	SSHTimeout         duration.Duration `toml:"ssh_timeout"`

	// yanic socket
	YanicEnable          bool                         `toml:"yanic_enable"`
	YanicSynchronize     duration.Duration            `toml:"yanic_synchronize"`
	YanicCollectInterval duration.Duration            `toml:"yanic_collect_interval"`
	Yanic                respondYanic.InterfaceConfig `toml:"yanic"`
}

config file of this daemon (for more the config_example.conf in git repository)

type Node

type Node struct {
	Lastseen  jsontime.Time      `json:"lastseen" mapstructure:"-"`
	NodeID    string             `json:"node_id" gorm:"primary_key" mapstructure:"node_id"`
	Hostname  string             `json:"hostname"`
	Location  yanicData.Location `json:"location" gorm:"embedded;embedded_prefix:location_"`
	Wireless  yanicData.Wireless `json:"wireless" gorm:"embedded;embedded_prefix:wireless_"`
	Owner     string             `json:"owner"`
	Blacklist bool               `json:"blacklist" gorm:"-" mapstructure:"-"`
	Address   string             `json:"ip" mapstructure:"-"`
	Stats     struct {
		Wireless yanicData.WirelessStatistics `json:"wireless"`
		Clients  yanicData.Clients            `json:"clients"`
	} `json:"statistics" mapstructure:"-"`
}

func NewNode

func NewNode(nodeOrigin *yanicRuntime.Node, ipPrefix string) *Node

func (*Node) GetAddress

func (n *Node) GetAddress() net.TCPAddr

func (*Node) IsEqual

func (n *Node) IsEqual(node *Node) bool

func (*Node) SSHUpdate

func (n *Node) SSHUpdate(sshmgmt *ssh.Manager, oldnode *Node)

func (*Node) Update

func (n *Node) Update(node *yanicRuntime.Node)

type YanicDB

type YanicDB struct {
	databaseYanic.Connection
	// contains filtered or unexported fields
}

func NewYanicDB

func NewYanicDB(db *gorm.DB, ssh *ssh.Manager, sendNode func(*Node, bool), sendStats func(*runtimeYanic.GlobalStats), prefix string) *YanicDB

func (*YanicDB) Close

func (conn *YanicDB) Close()

func (*YanicDB) InsertGlobals

func (conn *YanicDB) InsertGlobals(stats *runtimeYanic.GlobalStats, time time.Time, site string, domain string)
func (conn *YanicDB) InsertLink(link *runtimeYanic.Link, time time.Time)

func (*YanicDB) InsertNode

func (conn *YanicDB) InsertNode(n *runtimeYanic.Node)

func (*YanicDB) PruneNodes

func (conn *YanicDB) PruneNodes(deleteAfter time.Duration)

Jump to

Keyboard shortcuts

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