server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP added in v1.2.0

func GetIP(conn net.Conn) net.IP

Types

type BotHandler

type BotHandler struct {
	CustomMessage []byte
	// contains filtered or unexported fields
}

func (*BotHandler) ServeHTTP

func (w *BotHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)

type CIDRRange added in v1.2.0

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

this is lightweight cidr range checker just for this project it's only support ipv4 ( all telegram ip rangers are ipv4 ) after initiating first time cannot add rangers only checkings ip

func (*CIDRRange) Contains added in v1.2.0

func (c *CIDRRange) Contains(ip net.IP) bool

type IPNode added in v1.2.0

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

type ListenOption added in v1.2.0

type ListenOption struct {
	AllowdIPCidr      []string `json:"allowd_cidr"`
	ConnRejectMessage string   `json:"reject_message"`
	ServerName        string   `json:"server_name"`
	Cert              string   `json:"cert"`
	Key               string   `json:"key"`
	Addr              string   `json:"addr"`
}

type RangeCheck added in v1.2.0

type RangeCheck interface {
	Contains(ip net.IP) bool
}

func NewCIDRRange added in v1.2.0

func NewCIDRRange(cidrList []string) (RangeCheck, error)

type ServerOption

type ServerOption struct {
	HttpPath          string       `json:"http_path"`
	AllowedUpdates    []string     `json:"allowed_updates,omitempty"`
	FullUrl           string       `json:"full_url"`
	Secret            string       `json:"secret"`
	DisableWebhookSet bool         `json:"disable_setwebhook"`
	Custom_Message    string       `json:"req_reject_message"`
	ListenOption      ListenOption `json:"listen_option"`
}

type SimpleRangeCheck added in v1.2.0

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

func (*SimpleRangeCheck) Contains added in v1.2.0

func (s *SimpleRangeCheck) Contains(ip net.IP) bool

type UnknownRemote added in v1.2.0

type UnknownRemote string

func (UnknownRemote) Error added in v1.2.0

func (e UnknownRemote) Error() string

func (UnknownRemote) Temporary added in v1.2.0

func (e UnknownRemote) Temporary() bool

func (UnknownRemote) Timeout added in v1.2.0

func (e UnknownRemote) Timeout() bool

type Webhookserver

type Webhookserver struct {
	http.Server
	Handler http.Handler

	AllowdObs         []string
	FullUrl           string
	DIsableWebhookSet bool
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, srvopt *ServerOption, parser parser.Parserwrap, logger *zap.Logger) *Webhookserver

func (*Webhookserver) Close

func (w *Webhookserver) Close() error

func (*Webhookserver) Start

func (w *Webhookserver) Start(botapi botapi.BotAPI, errchan chan error) error

Jump to

Keyboard shortcuts

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