cloudflare_ddns

package module
v0.0.0-...-25cf476 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 14 Imported by: 0

README

CloudFlare-DDNS

GitHub Last Commit GitHub License

A CloudFlare DDNS service.

Instructions

1. Install
  • Build from source

You need to install upx-ucl and p7zip-full, the compiled files are located in the release folder.

git clone https://github.com/kallydev/cloudflare-ddns
cd cloudflare-ddns
bash script/build.sh --release
2. Config

If you need to enable TLS, please see config.json.

  • Client example
{
  "cloud_flare": {
    "key": "b57a34a824e81f05c6fee5be3cef10f015665"
  },
  "client": {
    "server": "example.com:50051",
    "domain": "www.example.com"
  }
}
  • Server example
{
  "cloud_flare": {
    "email": "example@email.com",
    "key": "b57a34a824e81f05c6fee5be3cef10f015665",
    "zone_id": "c0a6482d6cb17960b5bfdfa3d256f5f1",
    "account_id": "95cbb560688820be3be3e08571da12b4"
  },
  "server": {
    "host": "0.0.0.0",
    "port": 50051
  }
}
3. Run
  • Server
./cloudflare-ddns_linux_amd64 server -c config.json
  • Client
./cloudflare-ddns_linux_amd64 client -c config.json

License

Copyright (c) KallyDev. All rights reserved.

Licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(conf *Config) *Client

func (*Client) Start

func (cli *Client) Start() (err error)

type Config

type Config struct {
	CloudFlare *ConfigCloudFlare `json:"cloud_flare"`
	TLS        *ConfigTLS        `json:"tls"`
	Client     *ConfigClient     `json:"client"`
	Server     *ConfigServer     `json:"server"`
}

func NewConfig

func NewConfig(filename string) *Config

func (*Config) Marshal

func (conf *Config) Marshal() ([]byte, error)

func (*Config) Unmarshal

func (conf *Config) Unmarshal(data []byte) error

type ConfigClient

type ConfigClient struct {
	Server string `json:"server"`
	Domain string `json:"domain"`
}

type ConfigCloudFlare

type ConfigCloudFlare struct {
	Email     string `json:"email"`
	Key       string `json:"key"`
	ZoneID    string `json:"zone_id"`
	AccountID string `json:"account_id"`
}

type ConfigServer

type ConfigServer struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

type ConfigTLS

type ConfigTLS struct {
	Cert string `json:"cert"`
	Key  string `json:"key"`
}

type Server

type Server struct {
	pb.CloudFlareDDNSServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *Config) *Server

func (*Server) CreateDNSRecord

func (svr *Server) CreateDNSRecord(_type, name, context string) error

func (*Server) GetClientIP

func (svr *Server) GetClientIP(ctx context.Context) (ip string, err error)

func (*Server) GetDNSRecords

func (svr *Server) GetDNSRecords() ([]cloudflare.DNSRecord, error)

func (*Server) RefreshDDNSRecord

func (svr *Server) RefreshDDNSRecord(ctx context.Context, request *pb.RefreshDNSRecordRequest) (*pb.RefreshDNSRecordResponse, error)

func (*Server) Start

func (svr *Server) Start() error

func (*Server) UpdateDNSRecords

func (svr *Server) UpdateDNSRecords(recordID, name, context string) error

Directories

Path Synopsis
common

Jump to

Keyboard shortcuts

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