typedef.go 1.4 KB

123456789101112131415161718192021222324252627282930
  1. package fileservers
  2. /*
  3. Type defination of fileserver Manager
  4. */
  5. import user "imuslab.com/arozos/mod/user"
  6. type Endpoint struct {
  7. ProtocolName string //Protocol name of the endpoint, e.g. ftp
  8. Port int //Port for the endpoint, e.g. 21
  9. Subpath string //Subpath of the endpoint, e.g. /webdav/user
  10. }
  11. type Server struct {
  12. ID string //ID of the File Server Type
  13. Name string //Name of the File Server Type. E.g. FTP
  14. Desc string //Description of the File Server Type, e.g. File Transfer Protocol
  15. IconPath string //Path for the protocol Icon, if any
  16. DefaultPorts []int //Default ports aquire by the Server. Override by Ports if set
  17. Ports []int //Ports required by the File Server Type that might need port forward. e.g. 21, 22
  18. ForwardPortIfUpnp bool //Forward the port if UPnP is enabled
  19. ConnInstrPage string //Connection instruction page, visable by all users
  20. ConfigPage string //Config page for changing settings of this File Server Type, admin only
  21. //Generic operation endpoints
  22. EnableCheck func() bool `json:"-"` //Return the status of if the server is currently runnign
  23. ToggleFunc func(bool) error `json:"-"` //Toggle on/off of this service
  24. GetEndpoints func(*user.User) []*Endpoint `json:"-"` //Get the accessible endpoints for this user
  25. }