Documentation
¶
Index ¶
- Variables
- func HttpPost(baseURL string, route string, data []byte) ([]byte, error)
- func PostReq(req *http.Request) ([]byte, error)
- func StartHTTP(okHandler func(http.ResponseWriter, *http.Request), port int) error
- func WriteFile(w http.ResponseWriter, resfork embed.FS, filename string) error
- type HttpRequest
- func (*HttpRequest) Descriptor() ([]byte, []int)deprecated
- func (pb *HttpRequest) DumpClient()
- func (pb *HttpRequest) DumpRemoteAddr() string
- func (pb *HttpRequest) DumpUserAgent() string
- func (x *HttpRequest) GetClientData() []byte
- func (x *HttpRequest) GetClientDataLen() int64
- func (x *HttpRequest) GetCtime() *timestamppb.Timestamp
- func (x *HttpRequest) GetHeaders() map[string]string
- func (x *HttpRequest) GetHost() string
- func (x *HttpRequest) GetHostname() string
- func (x *HttpRequest) GetIP() string
- func (x *HttpRequest) GetLogs() []string
- func (x *HttpRequest) GetMethod() string
- func (x *HttpRequest) GetNamespace() string
- func (x *HttpRequest) GetProto() string
- func (x *HttpRequest) GetQuery() map[string]string
- func (x *HttpRequest) GetRemoteAddr() string
- func (x *HttpRequest) GetRoute() string
- func (x *HttpRequest) GetServerData() []byte
- func (x *HttpRequest) GetServerDataLen() int64
- func (x *HttpRequest) GetURL() string
- func (x *HttpRequest) GetUserAgent() string
- func (pb *HttpRequest) Log(a ...any)
- func (pb *HttpRequest) Logf(s string, a ...any)
- func (*HttpRequest) ProtoMessage()
- func (x *HttpRequest) ProtoReflect() protoreflect.Message
- func (x *HttpRequest) Reset()
- func (x *HttpRequest) String() string
- type HttpRequestScanner
- type HttpRequests
- func (x *HttpRequests) All() *HttpRequestScanner
- func (x *HttpRequests) Append(y *HttpRequest)
- func (x *HttpRequests) Clone(y *HttpRequest) *HttpRequest
- func (x *HttpRequests) Delete(y *HttpRequest) bool
- func (*HttpRequests) Descriptor() ([]byte, []int)deprecated
- func (v *HttpRequests) FormatJSON() string
- func (v *HttpRequests) FormatTEXT() string
- func (x *HttpRequests) GetHttpRequests() []*HttpRequest
- func (x *HttpRequests) GetUuid() string
- func (x *HttpRequests) GetVersion() string
- func (x *HttpRequests) IterAll() iter.Seq[*HttpRequest]
- func (x *HttpRequests) Len() int
- func (v *HttpRequests) Marshal() ([]byte, error)
- func (v *HttpRequests) MarshalJSON() ([]byte, error)
- func (*HttpRequests) ProtoMessage()
- func (x *HttpRequests) ProtoReflect() protoreflect.Message
- func (x *HttpRequests) Reset()
- func (x *HttpRequests) String() string
- func (v *HttpRequests) Unmarshal(data []byte) error
- func (v *HttpRequests) UnmarshalJSON(data []byte) error
- func (v *HttpRequests) UnmarshalTEXT(data []byte) error
- type HttpRequestsScanner
Constants ¶
This section is empty.
Variables ¶
var File_httpRequest_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type HttpRequest ¶
type HttpRequest struct {
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` // The request method, e.g., "GET", "POST".
URL string `protobuf:"bytes,2,opt,name=URL,proto3" json:"URL,omitempty"` // The full URL of the request, including scheme, host, path, and query string.
Route string `protobuf:"bytes,3,opt,name=route,proto3" json:"route,omitempty"` // just the route: "/add/" or "/find/"
Proto string `protobuf:"bytes,4,opt,name=proto,proto3" json:"proto,omitempty"` // The protocol version, e.g., "HTTP/1.1", "HTTP/2.0".
Headers map[string]string `` // The map of request headers. Header names are case-insensitive,
/* 155-byte string literal not displayed */
IP string `protobuf:"bytes,6,opt,name=IP,proto3" json:"IP,omitempty"` // The remote IP address of the client, after resolving proxies.
Host string `protobuf:"bytes,7,opt,name=host,proto3" json:"host,omitempty"` // The host on which the URL is sought (www.wit.com)
Hostname string `protobuf:"bytes,8,opt,name=hostname,proto3" json:"hostname,omitempty"` // The hostname of the client if passed from the client (mylaptop.fun.me)
Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace,omitempty"` // This is the pb namespace ("go.wit.com/lib/protobuf/virtpb")
Ctime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=ctime,proto3" json:"ctime,omitempty"` // create time of the patch
ClientData []byte `protobuf:"bytes,11,opt,name=clientData,proto3" json:"clientData,omitempty"` // the client payload
ClientDataLen int64 `protobuf:"varint,12,opt,name=clientDataLen,proto3" json:"clientDataLen,omitempty"` // len(body)
ServerData []byte `protobuf:"bytes,13,opt,name=serverData,proto3" json:"serverData,omitempty"` // the server response
ServerDataLen int64 `protobuf:"varint,14,opt,name=serverDataLen,proto3" json:"serverDataLen,omitempty"` // len(data)
Logs []string `protobuf:"bytes,15,rep,name=logs,proto3" json:"logs,omitempty"` // use this to store whatever you want while the whole POST happens
UserAgent string `protobuf:"bytes,16,opt,name=userAgent,proto3" json:"userAgent,omitempty"` // client user-agent
Query map[string]string `` // r.URL.Query()
/* 152-byte string literal not displayed */
RemoteAddr string `protobuf:"bytes,18,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"` // r.RemoteAddr
// contains filtered or unexported fields
}
func DoPost ¶ added in v0.0.5
func DoPost(baseURL string, route string, data []byte) (*HttpRequest, error)
standard protobuf POST returns *HttpRequst protobuf
func ReqToPB ¶ added in v0.0.3
func ReqToPB(r *http.Request) (*HttpRequest, error)
converts an *http.Request to an http PB
func (*HttpRequest) Descriptor
deprecated
func (*HttpRequest) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead.
func (*HttpRequest) DumpClient ¶ added in v0.0.8
func (pb *HttpRequest) DumpClient()
todo: convert this code
func (*HttpRequest) DumpRemoteAddr ¶ added in v0.0.8
func (pb *HttpRequest) DumpRemoteAddr() string
func (*HttpRequest) DumpUserAgent ¶ added in v0.0.8
func (pb *HttpRequest) DumpUserAgent() string
func (*HttpRequest) GetClientData ¶ added in v0.0.6
func (x *HttpRequest) GetClientData() []byte
func (*HttpRequest) GetClientDataLen ¶ added in v0.0.6
func (x *HttpRequest) GetClientDataLen() int64
func (*HttpRequest) GetCtime ¶
func (x *HttpRequest) GetCtime() *timestamppb.Timestamp
func (*HttpRequest) GetHeaders ¶
func (x *HttpRequest) GetHeaders() map[string]string
func (*HttpRequest) GetHost ¶
func (x *HttpRequest) GetHost() string
func (*HttpRequest) GetHostname ¶
func (x *HttpRequest) GetHostname() string
func (*HttpRequest) GetIP ¶ added in v0.0.4
func (x *HttpRequest) GetIP() string
func (*HttpRequest) GetLogs ¶ added in v0.0.8
func (x *HttpRequest) GetLogs() []string
func (*HttpRequest) GetMethod ¶
func (x *HttpRequest) GetMethod() string
func (*HttpRequest) GetNamespace ¶
func (x *HttpRequest) GetNamespace() string
func (*HttpRequest) GetProto ¶
func (x *HttpRequest) GetProto() string
func (*HttpRequest) GetQuery ¶ added in v0.0.8
func (x *HttpRequest) GetQuery() map[string]string
func (*HttpRequest) GetRemoteAddr ¶
func (x *HttpRequest) GetRemoteAddr() string
func (*HttpRequest) GetRoute ¶
func (x *HttpRequest) GetRoute() string
func (*HttpRequest) GetServerData ¶ added in v0.0.6
func (x *HttpRequest) GetServerData() []byte
func (*HttpRequest) GetServerDataLen ¶ added in v0.0.6
func (x *HttpRequest) GetServerDataLen() int64
func (*HttpRequest) GetURL ¶ added in v0.0.4
func (x *HttpRequest) GetURL() string
func (*HttpRequest) GetUserAgent ¶ added in v0.0.8
func (x *HttpRequest) GetUserAgent() string
func (*HttpRequest) Log ¶ added in v0.0.7
func (pb *HttpRequest) Log(a ...any)
func (*HttpRequest) Logf ¶ added in v0.0.8
func (pb *HttpRequest) Logf(s string, a ...any)
func (*HttpRequest) ProtoMessage ¶
func (*HttpRequest) ProtoMessage()
func (*HttpRequest) ProtoReflect ¶
func (x *HttpRequest) ProtoReflect() protoreflect.Message
func (*HttpRequest) Reset ¶
func (x *HttpRequest) Reset()
func (*HttpRequest) String ¶
func (x *HttpRequest) String() string
type HttpRequestScanner ¶
func (*HttpRequestScanner) Next ¶
func (it *HttpRequestScanner) Next() *HttpRequest
Next() returns the next thing in the array
func (*HttpRequestScanner) Scan ¶
func (it *HttpRequestScanner) Scan() bool
type HttpRequests ¶
type HttpRequests struct {
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:1524ed43-e57d-4bf9-9449-1cdfdc498605`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1`
HttpRequests []*HttpRequest `protobuf:"bytes,3,rep,name=HttpRequests,proto3" json:"HttpRequests,omitempty"` // THIS MUST BE HttpRequest and then HttpRequests
// contains filtered or unexported fields
}
func NewHttpRequests ¶
func NewHttpRequests() *HttpRequests
func (*HttpRequests) All ¶
func (x *HttpRequests) All() *HttpRequestScanner
func (*HttpRequests) Append ¶
func (x *HttpRequests) Append(y *HttpRequest)
a Append() shortcut (that does Clone() with a mutex) notsure if it really works doesn't allow nil
func (*HttpRequests) Clone ¶ added in v0.0.15
func (x *HttpRequests) Clone(y *HttpRequest) *HttpRequest
a Clone() shortcut (with a mutex). notsure if it really works
func (*HttpRequests) Delete ¶
func (x *HttpRequests) Delete(y *HttpRequest) bool
func (*HttpRequests) Descriptor
deprecated
func (*HttpRequests) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequests.ProtoReflect.Descriptor instead.
func (*HttpRequests) FormatTEXT ¶
func (v *HttpRequests) FormatTEXT() string
apparently this isn't stable, but it's awesomely better https://protobuf.dev/reference/go/faq/#unstable-text it's brilliant for config files!
func (*HttpRequests) GetHttpRequests ¶
func (x *HttpRequests) GetHttpRequests() []*HttpRequest
func (*HttpRequests) GetUuid ¶
func (x *HttpRequests) GetUuid() string
func (*HttpRequests) GetVersion ¶
func (x *HttpRequests) GetVersion() string
func (*HttpRequests) IterAll ¶
func (x *HttpRequests) IterAll() iter.Seq[*HttpRequest]
Iterate 'for x := range' syntax using the awesome golang 1.24 'iter'
func (*HttpRequests) Len ¶
func (x *HttpRequests) Len() int
func (*HttpRequests) Marshal ¶
func (v *HttpRequests) Marshal() ([]byte, error)
marshal to wire. This is called winning.
func (*HttpRequests) MarshalJSON ¶
func (v *HttpRequests) MarshalJSON() ([]byte, error)
marshal json
func (*HttpRequests) ProtoMessage ¶
func (*HttpRequests) ProtoMessage()
func (*HttpRequests) ProtoReflect ¶
func (x *HttpRequests) ProtoReflect() protoreflect.Message
func (*HttpRequests) Reset ¶
func (x *HttpRequests) Reset()
func (*HttpRequests) String ¶
func (x *HttpRequests) String() string
func (*HttpRequests) Unmarshal ¶
func (v *HttpRequests) Unmarshal(data []byte) error
unmarshal from wire. You have won.
func (*HttpRequests) UnmarshalJSON ¶
func (v *HttpRequests) UnmarshalJSON(data []byte) error
unmarshal json
func (*HttpRequests) UnmarshalTEXT ¶
func (v *HttpRequests) UnmarshalTEXT(data []byte) error
unmarshalTEXT. This reads the .text config file back in after the user edits it
type HttpRequestsScanner ¶
func (*HttpRequestsScanner) Next ¶
func (it *HttpRequestsScanner) Next() *HttpRequests
Next() returns the next thing in the array
func (*HttpRequestsScanner) Scan ¶
func (it *HttpRequestsScanner) Scan() bool