pushed final docs for initial merge

This commit is contained in:
2025-01-21 21:08:22 +00:00
parent 1bd3a35992
commit a07f9588fb
17 changed files with 2774 additions and 6 deletions

174
server/docker/docs.md Normal file
View File

@@ -0,0 +1,174 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# docker
```go
import "github.com/Akilan1999/p2p-rendering-computation/server/docker"
```
## Index
- [func StopAndRemoveContainer\(containername string\) error](<#StopAndRemoveContainer>)
- [type DockerContainer](<#DockerContainer>)
- [type DockerContainers](<#DockerContainers>)
- [func ViewAllContainers\(\) \(\*DockerContainers, error\)](<#ViewAllContainers>)
- [type DockerVM](<#DockerVM>)
- [func BuildRunContainer\(NumPorts int, GPU string, ContainerName string, baseImage string, publicKey string\) \(\*DockerVM, error\)](<#BuildRunContainer>)
- [func \(d \*DockerVM\) CopyToTmpContainer\(\) error](<#DockerVM.CopyToTmpContainer>)
- [func \(d \*DockerVM\) TemplateDockerContainer\(\) error](<#DockerVM.TemplateDockerContainer>)
- [type ErrorDetail](<#ErrorDetail>)
- [type ErrorLine](<#ErrorLine>)
- [type Port](<#Port>)
- [type Ports](<#Ports>)
- [func OpenPortsFile\(filename string\) \(\*Ports, error\)](<#OpenPortsFile>)
<a name="StopAndRemoveContainer"></a>
## func [StopAndRemoveContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L340>)
```go
func StopAndRemoveContainer(containername string) error
```
StopAndRemoveContainer Stop and remove a container Reference \(https://gist.github.com/frikky/e2efcea6c733ea8d8d015b7fe8a91bf6\)
<a name="DockerContainer"></a>
## type [DockerContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L40-L43>)
```go
type DockerContainer struct {
ContainerName string `json:"DockerContainerName"`
ContainerDescription string `json:"ContainerDescription"`
}
```
<a name="DockerContainers"></a>
## type [DockerContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L36-L38>)
```go
type DockerContainers struct {
DockerContainer []DockerContainer `json:"DockerContainer"`
}
```
<a name="ViewAllContainers"></a>
### func [ViewAllContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L387>)
```go
func ViewAllContainers() (*DockerContainers, error)
```
ViewAllContainers returns all containers runnable and which can be built
<a name="DockerVM"></a>
## type [DockerVM](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L22-L34>)
```go
type DockerVM struct {
SSHUsername string `json:"SSHUsername"`
SSHPublcKey string `json:"SSHPublicKey"`
ID string `json:"ID"`
TagName string `json:"TagName"`
ImagePath string `json:"ImagePath"`
Ports Ports `json:"Ports"`
GPU string `json:"GPU"`
TempPath string
BaseImage string
LogsPath string
SSHCommand string `json:"SSHCommand"`
}
```
<a name="BuildRunContainer"></a>
### func [BuildRunContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L70>)
```go
func BuildRunContainer(NumPorts int, GPU string, ContainerName string, baseImage string, publicKey string) (*DockerVM, error)
```
BuildRunContainer Function is incharge to invoke building and running contianer and also allocating external ports
<a name="DockerVM.CopyToTmpContainer"></a>
### func \(\*DockerVM\) [CopyToTmpContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L493>)
```go
func (d *DockerVM) CopyToTmpContainer() error
```
CopyToTmpContainer Creates a copy of the docker folder
<a name="DockerVM.TemplateDockerContainer"></a>
### func \(\*DockerVM\) [TemplateDockerContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L464>)
```go
func (d *DockerVM) TemplateDockerContainer() error
```
TemplateDockerContainer This function templates the docker container with the base docker image to use
<a name="ErrorDetail"></a>
## type [ErrorDetail](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L62-L64>)
```go
type ErrorDetail struct {
Message string `json:"message"`
}
```
<a name="ErrorLine"></a>
## type [ErrorLine](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L57-L60>)
```go
type ErrorLine struct {
Error string `json:"error"`
ErrorDetail ErrorDetail `json:"errorDetail"`
}
```
<a name="Port"></a>
## type [Port](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L48-L55>)
```go
type Port struct {
PortName string `json:"PortName"`
InternalPort int `json:"InternalPort"`
Type string `json:"Type"`
ExternalPort int `json:"ExternalPort"`
IsUsed bool `json:"IsUsed"`
Description string `json:"Description"`
}
```
<a name="Ports"></a>
## type [Ports](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L45-L47>)
```go
type Ports struct {
PortSet []Port `json:"Port"`
}
```
<a name="OpenPortsFile"></a>
### func [OpenPortsFile](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/docker/docker.go#L447>)
```go
func OpenPortsFile(filename string) (*Ports, error)
```
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)

227
server/docs.md Normal file
View File

@@ -0,0 +1,227 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# server
```go
import "github.com/Akilan1999/p2p-rendering-computation/server"
```
source:https://github.com/afoley587/go-rev-proxy/tree/main
## Index
- [Variables](<#variables>)
- [func GetScheme\(c \*gin.Context\) string](<#GetScheme>)
- [func MapPort\(port string, domainName string, serverAddress string\) \(string, string, error\)](<#MapPort>)
- [func Proxy\(c \*gin.Context\)](<#Proxy>)
- [func ProxyRun\(port string\)](<#ProxyRun>)
- [func SaveRegistration\(OutsideHost string, InsideHost string\) error](<#SaveRegistration>)
- [func Server\(\) \(\*gin.Engine, error\)](<#Server>)
- [type Gpu](<#Gpu>)
- [type GpuClock](<#GpuClock>)
- [type GpuTemperature](<#GpuTemperature>)
- [type GpuUtilization](<#GpuUtilization>)
- [type Query](<#Query>)
- [func GPUInfo\(\) \(\*Query, error\)](<#GPUInfo>)
- [type RegistrationRequest](<#RegistrationRequest>)
- [type ReverseProxy](<#ReverseProxy>)
- [type SysInfo](<#SysInfo>)
- [func ServerInfo\(\) \*SysInfo](<#ServerInfo>)
## Variables
<a name="KnownAddresses"></a>
```go
var (
//RunPort = 2002 // The server port to run on
//ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address
//InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network
//OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network
KnownAddresses = map[string]string{} // Known Addresses
)
```
<a name="ReverseProxies"></a>ReverseProxies Reverse to the map such as ReverseProxies\[\<domain nane\>\]ReverseProxy type
```go
var ReverseProxies map[string]ReverseProxy
```
<a name="GetScheme"></a>
## func [GetScheme](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/ReverseProxy.go#L29>)
```go
func GetScheme(c *gin.Context) string
```
This function checks if TLS was enabled on the request and translates it to the proper scheme \(http or https\)
<a name="MapPort"></a>
## func [MapPort](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/server.go#L378>)
```go
func MapPort(port string, domainName string, serverAddress string) (string, string, error)
```
<a name="Proxy"></a>
## func [Proxy](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/ReverseProxy.go#L84>)
```go
func Proxy(c *gin.Context)
```
Proxy runs the actual proxy and will look at the hostnames requested from the received request. It will then translate that to the inside hostname and forward the request
<a name="ProxyRun"></a>
## func [ProxyRun](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/ReverseProxy.go#L130>)
```go
func ProxyRun(port string)
```
<a name="SaveRegistration"></a>
## func [SaveRegistration](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/ReverseProxy.go#L66>)
```go
func SaveRegistration(OutsideHost string, InsideHost string) error
```
SaveRegistration Creates registration of proxy node
<a name="Server"></a>
## func [Server](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/server.go#L31>)
```go
func Server() (*gin.Engine, error)
```
<a name="Gpu"></a>
## type [Gpu](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L13-L20>)
```go
type Gpu struct {
GpuName string `xml:"product_name"`
BiosVersion string `xml:"vbios_version"`
FanSpeed string `xml:"fan_speed"`
Utilization GpuUtilization `xml:"utilization"`
Temperature GpuTemperature `xml:"temperature"`
Clock GpuClock `xml:"clocks"`
}
```
<a name="GpuClock"></a>
## type [GpuClock](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L31-L34>)
```go
type GpuClock struct {
GpuClock string `xml:"graphics_clock"`
GpuMemClock string `xml:"mem_clock"`
}
```
<a name="GpuTemperature"></a>
## type [GpuTemperature](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L27-L29>)
```go
type GpuTemperature struct {
GpuTemp string `xml:"gpu_temp"`
}
```
<a name="GpuUtilization"></a>
## type [GpuUtilization](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L22-L25>)
```go
type GpuUtilization struct {
GpuUsage string `xml:"gpu_util"`
MemoryUsage string `xml:"memory_util"`
}
```
<a name="Query"></a>
## type [Query](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L8-L11>)
```go
type Query struct {
DriveVersion string `xml:"driver_version"`
Gpu Gpu `xml:"gpu"`
}
```
<a name="GPUInfo"></a>
### func [GPUInfo](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gpu.go#L38>)
```go
func GPUInfo() (*Query, error)
```
Gets GPU information by calling nvidia\-smi in XML output
<a name="RegistrationRequest"></a>
## type [RegistrationRequest](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/ReverseProxy.go#L22-L25>)
```go
type RegistrationRequest struct {
OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost
InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5
}
```
<a name="ReverseProxy"></a>
## type [ReverseProxy](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/server.go#L23-L26>)
```go
type ReverseProxy struct {
IPAddress string
Port string
}
```
<a name="SysInfo"></a>
## type [SysInfo](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gopsutil.go#L11-L18>)
SysInfo saves the basic system information
```go
type SysInfo struct {
Hostname string `bson:hostname`
Platform string `bson:platform`
CPU string `bson:cpu`
RAM uint64 `bson:ram`
Disk uint64 `bson:disk`
GPU *Query `xml: GpuInfo`
}
```
<a name="ServerInfo"></a>
### func [ServerInfo](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/server/gopsutil.go#L20>)
```go
func ServerInfo() *SysInfo
```
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)