dns

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 5

README

dns

编译状态 Golang质量 版本 仓库大小 最后提交 授权协议 语言个数 最佳语言 星星个数

一个Golang应用程序快速开发框架,有以下特性

  • 快速开发
  • 内置配置文件加载
    • Yaml
    • Toml
    • Json
    • XML
    • 很方便定制自己的配置文件加载器
  • 内置强大的数据验证
    • 内置强大的且非常多的数据验证器
    • 很方便的定制自己的数据验证器
  • 强大的扩展功能
  • 强大的配置功能
    • 徽标
    • 帮助信息
    • 命令行
    • 一切可配置点皆可配置
  • 线程安全
  • 内置依赖注入
  • 语义化
    • 方便使用
    • 多态行为,同一个调用在不同的场景下有不同的意义

快速开始

Pangu使用非常简单,只需要定义两部分代码启动方法启动器以及依赖关系,对于依赖关系

  • 可以没有依赖,如果没有,就不需要处理依赖
  • 一般稍微大型一点的系统都会有复杂的依赖关系,而这正是盘古框架的强项
  • 对于没有依赖或者依赖非常少的项目,使用盘古反而会使代码变多,这个需要大家酌情考虑

启动方法代码如下

package main

import (
    `github.com/pangum/pangu`
    `github.com/pangum/pangum`
)

func main() {
    panic(pangu.New(
        pangu.Named(`ziyunix`),
        pangu.Banner(`Ziyunix Server`, pangu.BannerTypeAscii),
    ).Run(newBootstrap))
}

启动器的代码如下

package main

type bootstrap struct {
    application *pangu.Application
}

func newBootstrap(application *pangu.Application) pangu.Bootstrap {
    return &bootstrap{
        application: application,
    }
}

依赖关系建议像如下处理

package rest

import (
	`github.com/pangum/pangu`
)

type Server struct {}

func newServer(/* 如果有依赖,可以在这里增加依赖:api *Api */) *Server {
	return new(Server)
}

func init() {
	pangu.New().Dependencies(
		newServer,
		// 其它依赖
		// ...
	)
}

Pangu有非常多的配置项,请参看使用文档

文档

点击这里查看最新文档

使用示例

点击这里查看最新的代码示例

项目实践

交流

微信群

捐助

支持宝 微信

感谢Jetbrains

本项目通过Jetbrains开源许可IDE编写源代码,特此感谢 Jetbrains图标

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A

func A() *optionType

A 地址解析

func AAAA

func AAAA() *optionType

AAAA 地址解析

func Aliyun

func Aliyun() *optionProvider

Aliyun 阿里云

func CNAME

func CNAME() *optionType

CNAME CNAME解析

func Provider added in v0.0.6

func Provider(provider provider) *optionProvider

Provider 厂商

func Secret

func Secret(ak string, sk string) *optionSecret

Secret 授权

func TTL

func TTL(ttl time.Duration) *optionTtl

TTL 生存时间

func TencentCloud added in v0.0.6

func TencentCloud() *optionProvider

TencentCloud 腾讯云

func Ttl

func Ttl(ttl time.Duration) *optionTtl

Ttl 生存时间

Types

type Client

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

Client 客户端

func New

func New(opts ...option) (client *Client)

New 创建客户端

func (*Client) Add

func (c *Client) Add(ctx context.Context, domain string, subdomain string, value string, opts ...option) (err error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, record *Record, opts ...option) (err error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, domain string, subdomain string, opts ...option) (record *Record, err error)

func (*Client) Resolve

func (c *Client) Resolve(
	ctx context.Context,
	domain string, subdomain string, value string,
	opts ...option,
) (original string, do bool, err error)

func (*Client) Update

func (c *Client) Update(ctx context.Context, record *Record, value string, opts ...option) (err error)

type Options

type Options []option

func NewOptions

func NewOptions(opts ...option) Options

NewOptions 创建选项

func (*Options) Add

func (o *Options) Add(opts ...option)

type Record

type Record struct {
	// 编号
	Id string `json:"id"`
	// 域名
	Name string `json:"name"`
	// 子域名
	Subdomain string `json:"subdomain"`
	// 类型
	Type string `json:"type"`
	// 值
	Value string `json:"value"`
}

Record 记录

func (*Record) Final

func (r *Record) Final() string

func (*Record) TencentCloudId added in v0.0.6

func (r *Record) TencentCloudId() (id *uint64, err error)

type Type

type Type string

Type 类型

const (
	TypeA     Type = `A`
	TypeCname Type = `CNAME`
	TypeAAAA  Type = `AAAA`
)

Jump to

Keyboard shortcuts

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