dc

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: BSD-3-Clause Imports: 16 Imported by: 0

README

Go Hub

Github Release

Direct Connect hub implementation for ADC and NMDC protocols.

Requires Go 1.12+.

Features:

  • Fully multi-threaded.
  • Support NMDC, ADC and IRC users on the same hub.
  • Uses a single port for all protocols (protocol auto-detection).
  • Search between NMDC and ADC.
  • Supports TLS for ADC (adcs://) and NMDC (nmdcs://).
  • Automatic TLS certificate generation.
  • HTTP(S) pinger support.
  • User registration.
  • User profiles and operators.
  • User commands.
  • Chat rooms.
  • Go plugins.

TODO:

  • Scripts.
  • Spam filters.
  • Get certificates from LetsEncrypt.
Building on Linux

Download and install Go 1.12+ from this page, or install it with Snap:

# install the Snap package manager:
sudo apt install snapd
# install the latest stable Go version:
sudo snap install --classic go

And build the hub binary:

go build ./cmd/go-hub
Building on Windows

Download and install Go 1.12+ from this page. You may also need to install Git.

To build the hub binary, run:

go build .\cmd\go-hub
Running the hub

First, run the hub configuration:

./go-hub init

This will create a file called hub.yml with the default configuration.

To create a user with admin permissions:

./go-hub user add Bob password root 

To run the hub:

./go-hub serve

Check help for additional commands and flags:

./go-hub -h
Profiling

To enable performance profiling:

./go-hub serve --pprof

A profiling endpoint will be available at http://localhost:6060/debug/pprof.

See pprof documentation for more details.

License

BSD 3-Clause License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool
View Source
var (
	ErrUnsupportedProtocol = errors.New("unsupported protocol")
)

Functions

func Probe

func Probe(rctx context.Context, addr string) (*url.URL, error)

Probe tries to detect the protocol on a specified host or host:port. It returns a canonical address with an appropriate URI scheme.

Types

type HubInfo

type HubInfo struct {
	Name     string    `json:"name" xml:"Name,attr"`
	Desc     string    `json:"desc,omitempty" xml:"Description,attr,omitempty"`
	Addr     []string  `json:"addr,omitempty" xml:"Address,attr,omitempty"`
	Icon     string    `json:"icon,omitempty" xml:"Icon,attr,omitempty"`
	Owner    string    `json:"owner,omitempty" xml:"Owner,attr,omitempty"`
	Website  string    `json:"website,omitempty" xml:"Website,attr,omitempty"`
	Email    string    `json:"email,omitempty" xml:"Email,attr,omitempty"`
	Enc      string    `json:"encoding,omitempty" xml:"Encoding,attr,omitempty"`
	Server   *Software `json:"soft,omitempty" xml:"Software,omitempty"`
	Uptime   uint64    `json:"uptime,omitempty" xml:"Uptime,attr,omitempty"`
	Users    int       `json:"users" xml:"Users,attr"`
	Files    uint64    `json:"files,omitempty" xml:"Files,attr,omitempty"`
	Share    uint64    `json:"share,omitempty" xml:"Shared,attr,omitempty"`
	Redirect string    `json:"redirect,omitempty" xml:"Redirect,attr,omitempty"`
	UserList []HubUser `json:"userlist,omitempty" xml:"User,attr,omitempty"`
}

func Ping

func Ping(ctx context.Context, addr string, conf *PingConfig) (*HubInfo, error)

Ping fetches the information about the specified hub.

type HubUser

type HubUser struct {
	Name   string    `json:"name" xml:"Name,attr"`
	Client *Software `json:"soft,omitempty" xml:"Software,omitempty"`
	Files  int       `json:"files,omitempty" xml:"Files,attr,omitempty"`
	Share  uint64    `json:"share,omitempty" xml:"Shared,attr,omitempty"`
	Email  string    `json:"email,omitempty" xml:"Email,attr,omitempty"`
}

type PingConfig added in v0.8.12

type PingConfig = adc.PingConfig

type Software

type Software struct {
	Name    string   `json:"name" xml:"Name,attr"`
	Version string   `json:"vers,omitempty" xml:"Version,attr,omitempty"`
	Ext     []string `json:"ext,omitempty" xml:"Ext,attr,omitempty"`
}

Software version.

Directories

Path Synopsis
adc
cmd
dcping command
go-hub command
dctor module
hub
plugins/tor module
internal

Jump to

Keyboard shortcuts

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