Files
p2p-rendering-computation/server/docs.md

228 lines
6.2 KiB
Markdown

<!-- 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>)