pkg

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright © 2021 Sebastien Leger

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	MaxMetadataLen       = 1024 // https://cips.cardano.org/cips/cip6/
	RequestMaxWaitTime   = 1 * time.Second
	MaxWorkers           = 16
	WebsocketMethodName  = "Query"
	WebsocketServiceName = "p2p"
	WebsocketQueryType   = "jsonwsp/request"
	WebsocketVersion     = "1.0"
)

Variables

This section is empty.

Functions

func Fetch added in v0.1.2

func Fetch(bg context.Context, clioEndpoint string, magic int64, fetchMax int64, ipVersion int64) ([]byte, error)

func GetBlockHeight added in v0.1.2

func GetBlockHeight(url string) (*int64, error)

func Push

func Push(config *server.ClientConfig, ch chan<- Producer)

func PushBlockNo added in v0.1.2

func PushBlockNo(bg context.Context, clioEndpoint string, magic int64, port int64, blockNo int64) ([]byte, error)

func Serve

func Serve(config *server.ServerConfig, ch chan Producer)

Types

type BlockHeightResponse added in v0.1.2

type BlockHeightResponse struct {
	Result *int64 `json:"result"`
}

type FetchRequest

type FetchRequest struct {
	Magic     uint64 `validate:"min=0"`
	Max       int    `validate:"min=1,max=20"`
	IpVersion int    `validate:"min=4"`
}

type PoolIdsResponse added in v0.1.0

type PoolIdsResponse struct {
	Result []string `json:"result"`
}

type PoolMetadata

type PoolMetadata struct {
	Url  string `json:"url"`
	Hash string `json:"hash"`
}

type PoolParameters added in v0.1.0

type PoolParameters struct {
	Id            string       `json:"id"`
	Vrf           string       `json:"vrf"`
	Pledge        uint64       `json:"pledge"`
	Cost          uint64       `json:"cost"`
	Margin        string       `json:"margin"`
	RewardAccount string       `json:"rewardAccount"`
	Owners        []string     `json:"owners"`
	Relays        []PoolRelay  `json:"relays"`
	Metadata      PoolMetadata `json:"metadata"`
}

func VetPools added in v0.1.0

func VetPools(url string) ([]*PoolParameters, error)

type PoolParametersResponse added in v0.1.0

type PoolParametersResponse struct {
	Result map[string]PoolParameters `json:"result"`
}

type PoolRelay

type PoolRelay struct {
	Port     int     `json:"port"`
	Ip4      *string `json:"ipv4"`
	Ip6      *string `json:"ipv6"`
	HostName *string `json:"hostname"`
}

type Producer

type Producer struct {
	Addr    string `json:"addr"`
	Port    int    `json:"port"`
	Valency int    `json:"valency"`
}

type PullPayload

type PullPayload struct {
	ResultCode string     `json:"resultcode"`
	Date       string     `json:"datetime"`
	ClientIp   string     `json:"clientIp"`
	IpType     int        `json:"iptype"`
	Msg        string     `json:"msg"`
	Producers  []Producer `json:"Producers"`
}

type PushPayload

type PushPayload struct {
	ResultCode string `json:"resultcode"`
	Date       string `json:"datetime"`
	ClientIp   string `json:"clientIp"`
	IpType     int    `json:"iptype"`
	Msg        string `json:"msg"`
}

type Query added in v0.1.0

type Query struct {
	MethodName  string    `json:"methodname"`
	ServiceName string    `json:"servicename"`
	QueryType   string    `json:"type"`
	Version     string    `json:"version"`
	QueryArgs   QueryArgs `json:"args"`
}

type QueryArgs added in v0.1.0

type QueryArgs struct {
	Query interface{} `json:"query"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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