service

package
v0.0.0-...-86b787e Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPDownloadDatabase

func HTTPDownloadDatabase(host, key, dbname, newdbname string) error

func HTTPSensorHealthCheckAndStatus

func HTTPSensorHealthCheckAndStatus(auth *models.SensorAuth) (*models.Sensor, error)

func LastHeartbeat

func LastHeartbeat() (time.Time, error)

func ParseSensorJSON

func ParseSensorJSON() (*models.SensorAuth, error)

func PeekConnection

func PeekConnection(conn net.Conn) *peekConnection

func Run

func Run(overState overseer.State)

func TimeoutConn

func TimeoutConn(conn net.Conn, duration time.Duration) net.Conn

func ToAddr

func ToAddr(input string) (net.Addr, string, int, error)

Addr, proto, port, error

func ValidateAuth

func ValidateAuth() (*models.SensorAuth, error)

Types

type CanHandlerer

type CanHandlerer interface {
	CanHandle([]byte) bool
}

type Comms

type Comms struct {
	Heartbeat time.Time
}

type Hub

type Hub struct {
	Auth *models.SensorAuth
	// contains filtered or unexported fields
}

type Listener

type Listener interface {
	Start(ctx context.Context) error
	Accept() (net.Conn, error)
}

type Mapper

type Mapper struct {
	ServiceMap []*ServiceMap
}

func ParseServices

func ParseServices() (*Mapper, error)

type Service

type Service struct {
	Port int
}

type ServiceAngel

type ServiceAngel struct {
	Auth *models.SensorAuth

	AngelCtx    context.Context
	AngelCancel context.CancelFunc

	SensorCtx    context.Context
	SensorCancel context.CancelFunc

	Sensor *models.Sensor
	Reboot chan bool
}

func CreateRun

func CreateRun() (*ServiceAngel, error)

func NewServiceAngel

func NewServiceAngel(auth *models.SensorAuth, sensor *models.Sensor) *ServiceAngel

type ServiceMap

type ServiceMap struct {
	Service Servicer `json:"service"`

	SensorName string `json:"sensor_name"`
	Type       string `json:"type"`
	Port       string `json:"port`
	DB         *storm.DB
}

Wraps a Servicer, adding some metadata

func HTTPServicesConfig

func HTTPServicesConfig(host, key string, ctx context.Context) ([]*ServiceMap, error)

type Servicer

type Servicer interface {
	Handle(context.Context, net.Conn, *storm.DB) error
	SetApiKey(k string)
	SetHost(h string)
}

type TmpMap

type TmpMap struct {
	Service interface{} `json:"service"`

	SensorName string `json:"sensor_name"`
	Type       string `json:"type"`
	Port       string `json:"port`
}

Jump to

Keyboard shortcuts

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