50 lines
2.0 KiB
Go
50 lines
2.0 KiB
Go
|
package tunnelbroker
|
||
|
|
||
|
import (
|
||
|
`encoding/xml`
|
||
|
`net`
|
||
|
`net/netip`
|
||
|
|
||
|
`github.com/go-resty/resty/v2`
|
||
|
`r00t2.io/gobroke/conf`
|
||
|
)
|
||
|
|
||
|
type Client struct {
|
||
|
tunCfg *conf.Config
|
||
|
myAddr net.IP
|
||
|
}
|
||
|
|
||
|
type TunnelList struct {
|
||
|
XMLName xml.Name `json:"-" xml:"tunnels" yaml:"-"`
|
||
|
Tunnels []*Tunnel `json:"tunnels" xml:"tunnel" yaml:"Tunnels"`
|
||
|
}
|
||
|
|
||
|
type Tunnel struct {
|
||
|
XMLName xml.Name `json:"-" xml:"tunnel" yaml:"-"`
|
||
|
ID uint `json:"id" xml:"id,attr" yaml:"ID" db:"tun_id"`
|
||
|
Description string `json:"desc" xml:"description" yaml:"Description" db:"desc"`
|
||
|
ServerIPv4 net.IP `json:"tgt_v4" xml:"serverv4" yaml:"IPv4 Tunnel Target" db:"server_v4"`
|
||
|
ClientIPv4 net.IP `json:"client_v4" xml:"clientv4" yaml:"Configured IPv4 Client Address" db:"current_client_v4"`
|
||
|
ServerIPv6 net.IP `json:"server_v6" xml:"serverv6" yaml:"IPv6 Endpoint" db:"tunnel_server_v6"`
|
||
|
ClientIPv6 net.IP `json:"client_v6" xml:"clientv6" yaml:"IPv6 Tunnel Client Address" db:"tunnel_client_v6"`
|
||
|
Routed64 netip.Prefix `json:"routed_64" xml:"routed64" yaml:"Routed /64" db:"prefix_64"`
|
||
|
Routed48 *netip.Prefix `json:"routed_48,omitempty" xml:"routed48,omitempty" yaml:"Routed /48,omitempty" db:"prefix_48"`
|
||
|
RDNS1 *string `json:"rdns_1,omitempty" xml:"rdns1,omitempty" yaml:"RDNS #1,omitempty" db:"rdns_1"`
|
||
|
RDNS2 *string `json:"rdns_2,omitempty" xml:"rdns2,omitempty" yaml:"RDNS #2,omitempty" db:"rdns_2"`
|
||
|
RDNS3 *string `json:"rdns_3,omitempty" xml:"rdns3,omitempty" yaml:"RDNS #3,omitempty" db:"rdns_3"`
|
||
|
RDNS4 *string `json:"rdns_4,omitempty" xml:"rdns4,omitempty" yaml:"RDNS #4,omitempty" db:"rdns_4"`
|
||
|
RDNS5 *string `json:"rdns_5,omitempty" xml:"rdns5,omitempty" yaml:"RDNS #5,omitempty" db:"rdns_5"`
|
||
|
client *Client
|
||
|
heClient *resty.Client
|
||
|
tunCfg *conf.Tunnel
|
||
|
}
|
||
|
|
||
|
type FetchedIP struct {
|
||
|
NewClientIPv4 net.IP `json:"new_client_v4" xml:"newClientv4,attr" yaml:"Evaluated IPv4 Client Address" db:"client_ip"`
|
||
|
}
|
||
|
|
||
|
type FetchedTunnel struct {
|
||
|
*Tunnel
|
||
|
*FetchedIP
|
||
|
}
|