ipv4

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Block

type Block struct {
	Id              uint     `json:"id"`              // ip地址id
	Path            string   `json:"path"`            // 子网
	Gid             uint     `json:"gid"`             // 分组id
	Type            string   `json:"type"`            // 类型
	Label           string   `json:"label"`           // 标签
	Disabled        int      `json:"disabled"`        // 状态
	Netmask         string   `json:"netmask"`         // 掩码
	Gateway         string   `json:"gateway"`         // 网关
	Vlan            string   `json:"vlan"`            // VLAN
	AssignTime      any      `json:"assign_time"`     // 分配时间
	ServerId        int      `json:"server_id"`       // 服务器id
	UserId          any      `json:"user_id"`         // 用户id
	Auto            int      `json:"auto"`            // 是否自动分配
	UsableipNum     int      `json:"usableip_num"`    // 可使用的ip数量
	UsingipNum      int      `json:"usingip_num"`     // 使用中的ip数量
	TotalipNum      int      `json:"totalip_num"`     // 使用中的ip数量
	SpecialipNum    int      `json:"specialip_num"`   // 特殊ip数量
	Remark          string   `json:"remark"`          // 备注
	IsLock          int      `json:"is_lock"`         // 是否锁定
	CreatedAt       string   `json:"created_at"`      // 创建时间
	UpdatedAt       string   `json:"updated_at"`      // 修改时间
	ServerName      string   `json:"server_name"`     // 服务器名称
	Dns1            string   `json:"dns_1"`           // DNS1
	Dns2            string   `json:"dns_2"`           // DNS2
	GroupName       string   `json:"group_name"`      // 分组名称
	Cidr            string   `json:"cidr"`            // CIDR
	IsPiecewise     bool     `json:"is_piecewise"`    // 是否分段
	FillIp          bool     `json:"fill_ip"`         // 是否自动填充ip
	CanAllocate     bool     `json:"can_allocate"`    // 是否可分配
	Username        string   `json:"username"`        // 用户名
	DatacenterId    []uint   `json:"datacenter_id"`   // 机房id
	DatacenterName  []string `json:"datacenter_name"` // 机房名称
	Child           []any    `json:"child"`
	AllIp           bool     `json:"all_ip"` // 是否全ip
	Ipv4Datacenters []struct {
		Id           int    `json:"id"`
		BlockId      int    `json:"block_id"`      // ip段id
		DatacenterId int    `json:"datacenter_id"` // 机房id
		CreatedAt    string `json:"created_at"`
		UpdatedAt    string `json:"updated_at"`
		Datacenter   struct {
			Id          int    `json:"id"`
			Name        string `json:"name"`        // 机房名称
			Geographicg string `json:"geographicg"` // 位置
			Bandwidth   int    `json:"bandwidth"`   // 带宽
			Voltage     int    `json:"voltage"`     // 电力
			Contact     struct {
				Name  string `json:"name"`  // 姓名
				Tel   string `json:"tel"`   // 电话
				Email string `json:"email"` // 邮箱
			} `json:"contact"` // 联系信息
			InternalCidr string `json:"internal_cidr"` // 重装系统使用网段
			VlanOs       int    `json:"vlan_os"`       // 重装系统临时VLAN
			SpeedOs      int    `json:"speed_os"`      // 重装系统端口限速
			ArpOs        int    `json:"arp_os"`        // 重装系统Arp绑定
			CreatedAt    int    `json:"created_at"`
			UpdatedAt    int    `json:"updated_at"`
		} `json:"datacenter"` // 机房
	} `json:"ipv4datacenters"` // IP段绑定机房列表
}

type CalcReq

type CalcReq struct {
	Block string `json:"block" url:"block"` // IP段
}

func (*CalcReq) Body

func (r *CalcReq) Body() (body any)

func (*CalcReq) Method

func (r *CalcReq) Method() (method string)

func (*CalcReq) Url

func (r *CalcReq) Url() (url string)

func (*CalcReq) Values

func (r *CalcReq) Values() (values url.Values)

type CalcResp

type CalcResp struct {
	Success  bool     `json:"success"`
	Error    string   `json:"error"`
	CidrInfo CidrInfo `json:"cidr_info"`
}

func (CalcResp) Err

func (r CalcResp) Err() (err error)

func (CalcResp) Ok

func (r CalcResp) Ok() (ok bool)

type CidrInfo

type CidrInfo struct {
	FirstIp        string `json:"first_ip"`         // 首位ip
	LastIp         string `json:"last_ip"`          // 末尾ip
	NetworkIp      string `json:"network_ip"`       // 网络ip
	BroadcastIp    string `json:"broadcast_ip"`     // 广播
	Cidr           string `json:"cidr"`             // CIDR(ipv4段)
	Netmask        string `json:"netmask"`          // 子网掩码
	Total          int    `json:"total"`            // 总条数
	GatewayFirstIp string `json:"gateway_first_ip"` // 网关首位ip
	GatewayLastIp  string `json:"gateway_last_ip"`  // 网关末尾ip
}

type CreateReq

type CreateReq struct {
	DatacenterId []uint `json:"datacenter_id"` // 机房Ids
	Gid          uint   `json:"gid"`           // 分组Id
	Cidr         string `json:"cidr"`          // IPV4段
	FirstIp      string `json:"first_ip"`      // 第一个IP
	LastIp       string `json:"last_ip"`       // 最后一个IP
	Type         string `json:"type"`          // ip段类别 IPMI:IPMI;Temporary:临时IP;Public:公网IP;Private:内网IP;UserPrivate:客户内网IP;Other:其他
	Netmask      string `json:"netmask"`       // 子网掩码
	Dns1         string `json:"dns1"`          // 首选DNS
	Dns2         string `json:"dns2"`          // 备用DNS
	Gateway      string `json:"gateway"`       // 网关
	Label        string `json:"label"`         // 标签(页面不填写,后端调用接口传固定值)
	Remark       string `json:"remark"`        // 备注

}

func (*CreateReq) Body

func (r *CreateReq) Body() (body any)

func (*CreateReq) Method

func (r *CreateReq) Method() (method string)

func (*CreateReq) Url

func (r *CreateReq) Url() (url string)

func (*CreateReq) Values

func (r *CreateReq) Values() (values url.Values)

type CreateResp

type CreateResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	BlockId uint   `json:"block_id"`
	Pending bool   `json:"pending"` // 是否等待
}

func (CreateResp) Err

func (c CreateResp) Err() (err error)

func (CreateResp) ID

func (c CreateResp) ID() uint

func (CreateResp) Ok

func (c CreateResp) Ok() (ok bool)

type DeleteReq

type DeleteReq struct {
	Id uint `json:"-"`
}

func (*DeleteReq) Body

func (r *DeleteReq) Body() (body any)

func (*DeleteReq) Method

func (r *DeleteReq) Method() (method string)

func (*DeleteReq) Url

func (r *DeleteReq) Url() (url string)

func (*DeleteReq) Values

func (r *DeleteReq) Values() (values url.Values)

type DetailReq

type DetailReq struct {
	Id int `json:"-"`
}

func (*DetailReq) Body

func (r *DetailReq) Body() (body any)

func (*DetailReq) Method

func (r *DetailReq) Method() (method string)

func (*DetailReq) Url

func (r *DetailReq) Url() (url string)

func (*DetailReq) Values

func (r *DetailReq) Values() (values url.Values)

type DetailResp

type DetailResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func Detail

func Detail(ctx *dcimsdk.Context, request *DetailReq) (resp DetailResp, err error)

Detail 获取IP段详情 https://www.eolink.com/share/inside/XIPzIs/api/1392256/detail/5758800

type GroupsListReq

type GroupsListReq struct{}

func (*GroupsListReq) Body

func (r *GroupsListReq) Body() (body any)

func (*GroupsListReq) Method

func (r *GroupsListReq) Method() (method string)

func (*GroupsListReq) Url

func (r *GroupsListReq) Url() (url string)

func (*GroupsListReq) Values

func (r *GroupsListReq) Values() (values url.Values)

type GroupsListResp

type GroupsListResp struct {
	Success bool          `json:"success"`
	Error   string        `json:"error"`
	Groups  []SimpleGroup `json:"groups"`
}

func GroupsList

func GroupsList(ctx *dcimsdk.Context, request *GroupsListReq) (resp GroupsListResp, err error)

GroupsList 获取IP分组列表(简易) https://www.eolink.com/share/inside/XIPzIs/api/1392254/detail/5745551

func (GroupsListResp) Err

func (r GroupsListResp) Err() (err error)

func (GroupsListResp) Ok

func (r GroupsListResp) Ok() (ok bool)

type ListReq

type ListReq struct {
	Page     uint   `url:"page"`
	PageSize uint   `url:"page_size"`
	Type     string `url:"type"`
}

func (*ListReq) Body

func (r *ListReq) Body() (body any)

func (*ListReq) Method

func (r *ListReq) Method() (method string)

func (*ListReq) Url

func (r *ListReq) Url() (url string)

func (*ListReq) Values

func (r *ListReq) Values() (values url.Values)

type ListResp

type ListResp struct {
	Success    bool    `json:"success"`
	Error      string  `json:"error"`
	Ipv4Blocks []Block `json:"ipv4blocks"` // IP段列表
	Total      int     `json:"total"`
}

func List

func List(ctx *dcimsdk.Context, request *ListReq) (resp ListResp, err error)

List 获取IP段列表 https://www.eolink.com/share/inside/XIPzIs/api/1392256/detail/5745855

func (ListResp) Err

func (r ListResp) Err() (err error)

func (ListResp) Ok

func (r ListResp) Ok() (ok bool)

type SimpleGroup

type SimpleGroup struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type UpdateReq

type UpdateReq struct {
	Id           uint   `json:"-"`
	DatacenterId []uint `json:"datacenter_id"`     // 机房Ids
	Gid          uint   `json:"gid,omitempty"`     // 分组Id
	Type         string `json:"type,omitempty"`    // ip段类别 IPMI:IPMI;Temporary:临时IP;Public:公网IP;Private:内网IP;UserPrivate:客户内网IP;Other:其他
	Dns1         string `json:"dns1,omitempty"`    // 首选DNS
	Dns2         string `json:"dns2,omitempty"`    // 备用DNS
	Gateway      string `json:"gateway,omitempty"` // 网关
	Label        string `json:"label,omitempty"`   // 标签(页面不填写,后端调用接口传固定值)
	Remark       string `json:"remark,omitempty"`  // 备注

}

func (*UpdateReq) Body

func (r *UpdateReq) Body() (body any)

func (*UpdateReq) Method

func (r *UpdateReq) Method() (method string)

func (*UpdateReq) Url

func (r *UpdateReq) Url() (url string)

func (*UpdateReq) Values

func (r *UpdateReq) Values() (values url.Values)

Jump to

Keyboard shortcuts

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