Fix some typos and run gofmt on all .go files
This commit is contained in:
parent
b9f6e17a7d
commit
7ba32aca84
|
@ -41,7 +41,7 @@ var validUsernameRegexp = regexp.MustCompile(`^(?i)(.+)\.([a-z0-9]{8})$`)
|
|||
|
||||
func (r *PanelRequest) ValidateSftpCredentials(request SftpAuthRequest) (*SftpAuthResponse, error) {
|
||||
// If the username doesn't meet the expected format that the Panel would even recognize just go ahead
|
||||
// and bail out of the process here to avoid accidentially brute forcing the panel if a bot decides
|
||||
// and bail out of the process here to avoid accidentally brute forcing the panel if a bot decides
|
||||
// to connect to spam username attempts.
|
||||
if !validUsernameRegexp.MatchString(request.User) {
|
||||
log.WithFields(log.Fields{
|
||||
|
|
|
@ -66,7 +66,7 @@ func diagnosticsCmdRun(cmd *cobra.Command, args []string) {
|
|||
Name: "ReviewBeforeUpload",
|
||||
Prompt: &survey.Confirm{
|
||||
Message: "Do you want to review the collected data before uploading to hastebin.com?",
|
||||
Help: "The data, especially the logs, might contain sensitive information, so you should review it. You will be asked again if you want to uplaod.",
|
||||
Help: "The data, especially the logs, might contain sensitive information, so you should review it. You will be asked again if you want to upload.",
|
||||
Default: true,
|
||||
},
|
||||
},
|
||||
|
@ -82,7 +82,7 @@ func diagnosticsCmdRun(cmd *cobra.Command, args []string) {
|
|||
_ = dockerInfo
|
||||
|
||||
output := &strings.Builder{}
|
||||
fmt.Fprintln(output, "Pterodactly Wings - Diagnostics Report")
|
||||
fmt.Fprintln(output, "Pterodactyl Wings - Diagnostics Report")
|
||||
printHeader(output, "Versions")
|
||||
fmt.Fprintln(output, "wings:", system.Version)
|
||||
if dockerErr == nil {
|
||||
|
@ -210,7 +210,7 @@ func uploadToHastebin(hbUrl, content string) (string, error) {
|
|||
u.Path = path.Join(u.Path, key)
|
||||
return u.String(), nil
|
||||
}
|
||||
return "", errors.New("Couldn't find key in response")
|
||||
return "", errors.New("failed to find key in response")
|
||||
}
|
||||
|
||||
func redact(s string) string {
|
||||
|
|
|
@ -188,7 +188,7 @@ func NewFromPath(path string) (*Configuration, error) {
|
|||
}
|
||||
|
||||
// Sets the path where the configuration file is located on the server. This function should
|
||||
// not be called except by processes that are generating the configuration such as the configration
|
||||
// not be called except by processes that are generating the configuration such as the configuration
|
||||
// command shipped with this software.
|
||||
func (c *Configuration) unsafeSetPath(path string) {
|
||||
c.Lock()
|
||||
|
|
|
@ -64,7 +64,7 @@ func (sc *SystemConfiguration) ConfigureDirectories() error {
|
|||
|
||||
// There are a non-trivial number of users out there whose data directories are actually a
|
||||
// symlink to another location on the disk. If we do not resolve that final destination at this
|
||||
// point things will appear to work, but endless errors whill be encountered when we try to
|
||||
// point things will appear to work, but endless errors will be encountered when we try to
|
||||
// verify accessed paths since they will all end up resolving outside the expected data directory.
|
||||
//
|
||||
// For the sake of automating away as much of this as possible, see if the data directory is a
|
||||
|
@ -98,7 +98,7 @@ func (sc *SystemConfiguration) ConfigureDirectories() error {
|
|||
|
||||
// Writes a logrotate file for wings to the system logrotate configuration directory if one
|
||||
// exists and a logrotate file is not found. This allows us to basically automate away the log
|
||||
// rotatation for most installs, but also enable users to make modifications on their own.
|
||||
// rotation for most installs, but also enable users to make modifications on their own.
|
||||
func (sc *SystemConfiguration) EnableLogRotation() error {
|
||||
// Do nothing if not enabled.
|
||||
if sc.EnableLogRotate == false {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package config
|
||||
|
||||
type ConsoleThrottles struct {
|
||||
// Wether or not the throttler is enabled for this instance.
|
||||
// Whether or not the throttler is enabled for this instance.
|
||||
Enabled bool `json:"enabled" yaml:"enabled" default:"true"`
|
||||
|
||||
// The total number of throttle activations that must accumulate before a server is
|
||||
|
|
|
@ -52,7 +52,7 @@ func (c *Configuration) Limits() Limits {
|
|||
return c.settings.Limits
|
||||
}
|
||||
|
||||
// Rturns the allocations associated with this environment.
|
||||
// Returns the allocations associated with this environment.
|
||||
func (c *Configuration) Allocations() Allocations {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
|
|
|
@ -57,8 +57,8 @@ func (e *Environment) Attach() error {
|
|||
e.SetStream(nil)
|
||||
}()
|
||||
|
||||
// Poll resources in a seperate thread since this will block the copy call below
|
||||
// from being reached until it is completed if not run in a seperate process. However,
|
||||
// Poll resources in a separate thread since this will block the copy call below
|
||||
// from being reached until it is completed if not run in a separate process. However,
|
||||
// we still want it to be stopped when the copy operation below is finished running which
|
||||
// indicates that the container is no longer running.
|
||||
go func(ctx context.Context) {
|
||||
|
@ -167,7 +167,7 @@ func (e *Environment) Create() error {
|
|||
PortBindings: a.Bindings(),
|
||||
|
||||
// Configure the mounts for this container. First mount the server data directory
|
||||
// into the container as a r/w bine.
|
||||
// into the container as a r/w bind.
|
||||
Mounts: e.convertMounts(),
|
||||
|
||||
// Configure the /tmp folder mapping in containers. This is necessary for some
|
||||
|
@ -228,7 +228,7 @@ func (e *Environment) convertMounts() []mount.Mount {
|
|||
// Remove the Docker container from the machine. If the container is currently running
|
||||
// it will be forcibly stopped by Docker.
|
||||
func (e *Environment) Destroy() error {
|
||||
// We set it to stopping than offline to prevent crash detection from being triggeree.
|
||||
// We set it to stopping than offline to prevent crash detection from being triggered.
|
||||
e.setState(environment.ProcessStoppingState)
|
||||
|
||||
err := e.client.ContainerRemove(context.Background(), e.Id, types.ContainerRemoveOptions{
|
||||
|
@ -250,7 +250,7 @@ func (e *Environment) Destroy() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Attaches to the log for the container. This avoids us missing cruicial output that
|
||||
// Attaches to the log for the container. This avoids us missing crucial output that
|
||||
// happens in the split seconds before the code moves from 'Starting' to 'Attaching'
|
||||
// on the process.
|
||||
func (e *Environment) followOutput() error {
|
||||
|
@ -296,7 +296,7 @@ func (e *Environment) followOutput() error {
|
|||
// cases an outage shouldn't affect users too badly. It'll at least keep existing servers working
|
||||
// correctly if anything.
|
||||
//
|
||||
// TODO: handle authorization & local images
|
||||
// TODO: local images
|
||||
func (e *Environment) ensureImageExists(image string) error {
|
||||
// Give it up to 15 minutes to pull the image. I think this should cover 99.8% of cases where an
|
||||
// image pull might fail. I can't imagine it will ever take more than 15 minutes to fully pull
|
||||
|
@ -362,7 +362,7 @@ func (e *Environment) ensureImageExists(image string) error {
|
|||
log.WithField("image", image).Debug("pulling docker image... this could take a bit of time")
|
||||
|
||||
// I'm not sure what the best approach here is, but this will block execution until the image
|
||||
// is done being pulled, which is what we neee.
|
||||
// is done being pulled, which is what we need.
|
||||
scanner := bufio.NewScanner(out)
|
||||
for scanner.Scan() {
|
||||
continue
|
||||
|
|
|
@ -103,7 +103,7 @@ func (e *Environment) Events() *events.EventBus {
|
|||
// Determines if the container exists in this environment. The ID passed through should be the
|
||||
// server UUID since containers are created utilizing the server UUID as the name and docker
|
||||
// will work fine when using the container name as the lookup parameter in addition to the longer
|
||||
// ID auto-assigned when the container is createe.
|
||||
// ID auto-assigned when the container is created.
|
||||
func (e *Environment) Exists() (bool, error) {
|
||||
_, err := e.client.ContainerInspect(context.Background(), e.Id)
|
||||
|
||||
|
@ -137,7 +137,7 @@ func (e *Environment) IsRunning() (bool, error) {
|
|||
return c.State.Running, nil
|
||||
}
|
||||
|
||||
// Determine the container exit state and return the exit code and wether or not
|
||||
// Determine the container exit state and return the exit code and whether or not
|
||||
// the container was killed by the OOM killer.
|
||||
func (e *Environment) ExitState() (uint32, bool, error) {
|
||||
c, err := e.client.ContainerInspect(context.Background(), e.Id)
|
||||
|
@ -148,7 +148,7 @@ func (e *Environment) ExitState() (uint32, bool, error) {
|
|||
//
|
||||
// However, someone reported an error in Discord about this scenario happening,
|
||||
// so I guess this should prevent it? They didn't tell me how they caused it though
|
||||
// so that's a mystery that will have to go unsolvee.
|
||||
// so that's a mystery that will have to go unsolved.
|
||||
//
|
||||
// @see https://github.com/pterodactyl/panel/issues/2003
|
||||
if client.IsErrNotFound(err) {
|
||||
|
|
|
@ -35,7 +35,7 @@ func (e *Environment) OnBeforeStart() error {
|
|||
// container and data storage directory.
|
||||
//
|
||||
// This won't actually run an installation process however, it is just here to ensure the
|
||||
// environment gets created properly if it is missing and the server is startee. We're making
|
||||
// environment gets created properly if it is missing and the server is started. We're making
|
||||
// an assumption that all of the files will still exist at this point.
|
||||
if err := e.Create(); err != nil {
|
||||
return err
|
||||
|
@ -64,7 +64,7 @@ func (e *Environment) Start() error {
|
|||
|
||||
if c, err := e.client.ContainerInspect(context.Background(), e.Id); err != nil {
|
||||
// Do nothing if the container is not found, we just don't want to continue
|
||||
// to the next block of code here. This check was inlined here to guard againt
|
||||
// to the next block of code here. This check was inlined here to guard against
|
||||
// a nil-pointer when checking c.State below.
|
||||
//
|
||||
// @see https://github.com/pterodactyl/panel/issues/2000
|
||||
|
@ -128,7 +128,7 @@ func (e *Environment) Stop() error {
|
|||
|
||||
if s == nil || s.Type == api.ProcessStopSignal {
|
||||
if s == nil {
|
||||
log.WithField("container_id", e.Id).Warn("no stop configuration detected for environment, using termination proceedure")
|
||||
log.WithField("container_id", e.Id).Warn("no stop configuration detected for environment, using termination procedure")
|
||||
}
|
||||
|
||||
return e.Terminate(os.Kill)
|
||||
|
@ -217,7 +217,7 @@ func (e *Environment) Terminate(signal os.Signal) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// We set it to stopping than offline to prevent crash detection from being triggeree.
|
||||
// We set it to stopping than offline to prevent crash detection from being triggered.
|
||||
e.setState(environment.ProcessStoppingState)
|
||||
|
||||
sig := strings.TrimSuffix(strings.TrimPrefix(signal.String(), "signal "), "ed")
|
||||
|
|
|
@ -27,7 +27,7 @@ func (e *Environment) setState(state string) error {
|
|||
// Get the current state of the environment before changing it.
|
||||
prevState := e.State()
|
||||
|
||||
// Emit the event to any listeners that are currently registeree.
|
||||
// Emit the event to any listeners that are currently registered.
|
||||
if prevState != state {
|
||||
// If the state changed make sure we update the internal tracking to note that.
|
||||
e.stMu.Lock()
|
||||
|
|
|
@ -22,7 +22,7 @@ type Mount struct {
|
|||
// that we're mounting into the container at the Target location.
|
||||
Source string `json:"source"`
|
||||
|
||||
// Wether or not the directory is being mounted as read-only. It is up to the environment to
|
||||
// Whether or not the directory is being mounted as read-only. It is up to the environment to
|
||||
// handle this value correctly and ensure security expectations are met with its usage.
|
||||
ReadOnly bool `json:"read_only"`
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ func (f *ConfigurationFile) parseYamlFile(path string) error {
|
|||
|
||||
// Unmarshal the yaml data into a JSON interface such that we can work with
|
||||
// any arbitrary data structure. If we don't do this, I can't use gabs which
|
||||
// makes working with unknown JSON signficiantly easier.
|
||||
// makes working with unknown JSON significantly easier.
|
||||
jsonBytes, err := json.Marshal(dyno.ConvertMapI2MapS(i))
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -84,7 +84,7 @@ func postServerPower(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Pass the actual heavy processing off to a seperate thread to handle so that
|
||||
// Pass the actual heavy processing off to a separate thread to handle so that
|
||||
// we can immediately return a response from the server. Some of these actions
|
||||
// can take quite some time, especially stopping or restarting.
|
||||
go func(s *server.Server) {
|
||||
|
@ -176,7 +176,7 @@ func postServerReinstall(c *gin.Context) {
|
|||
c.Status(http.StatusAccepted)
|
||||
}
|
||||
|
||||
// Deletes a server from the wings daemon and deassociates its objects.
|
||||
// Deletes a server from the wings daemon and dissociate it's objects.
|
||||
func deleteServer(c *gin.Context) {
|
||||
s := GetServer(c.Param("server"))
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ func postCreateServer(c *gin.Context) {
|
|||
func postUpdateConfiguration(c *gin.Context) {
|
||||
// A backup of the configuration for error purposes.
|
||||
ccopy := *config.Get()
|
||||
// A copy of the configuration we're using to bind the data recevied into.
|
||||
// A copy of the configuration we're using to bind the data received into.
|
||||
cfg := *config.Get()
|
||||
|
||||
// BindJSON sends 400 if the request fails, all we need to do is return
|
||||
|
|
|
@ -147,11 +147,11 @@ func postTransfer(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
l.WithField("error", errors.WithStack(rerr)).Error("recieved error response from panel while notifying of transfer failure")
|
||||
l.WithField("error", errors.WithStack(rerr)).Error("received error response from panel while notifying of transfer failure")
|
||||
return
|
||||
}
|
||||
|
||||
l.Debug("notified panel of tranfer failure")
|
||||
l.Debug("notified panel of transfer failure")
|
||||
}()
|
||||
|
||||
// Make a new GET request to the URL the panel gave us.
|
||||
|
|
|
@ -16,7 +16,7 @@ type Message struct {
|
|||
//
|
||||
// - status : Returns the server's power state.
|
||||
// - logs : Returns the server log data at the time of the request.
|
||||
// - power : Performs a power action aganist the server based the data.
|
||||
// - power : Performs a power action against the server based the data.
|
||||
// - command : Performs a command on a server using the data field.
|
||||
Event string `json:"event"`
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ func (s *Server) Throttler() *ConsoleThrottler {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Sends output to the server console formatted to appear correctly as being sent
|
||||
// from Wings.
|
||||
func (s *Server) PublishConsoleOutputFromDaemon(data string) {
|
||||
|
|
|
@ -35,7 +35,7 @@ func (cd *CrashHandler) SetLastCrash(t time.Time) {
|
|||
// if it was the result of an event that we should try to recover from.
|
||||
//
|
||||
// This function assumes it is called under circumstances where a crash is suspected
|
||||
// of occuring. It will not do anything to determine if it was actually a crash, just
|
||||
// of occurring. It will not do anything to determine if it was actually a crash, just
|
||||
// look at the exit state and check if it meets the criteria of being called a crash
|
||||
// by Wings.
|
||||
//
|
||||
|
|
|
@ -183,14 +183,14 @@ func (fs *Filesystem) ParallelSafePath(paths []string) ([]string, error) {
|
|||
pi := p
|
||||
|
||||
// Recursively call this function to continue digging through the directory tree within
|
||||
// a seperate goroutine. If the context is canceled abort this process.
|
||||
// a separate goroutine. If the context is canceled abort this process.
|
||||
g.Go(func() error {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
// If the callback returns true, go ahead and keep walking deeper. This allows
|
||||
// us to programatically continue deeper into directories, or stop digging
|
||||
// us to programmatically continue deeper into directories, or stop digging
|
||||
// if that pathway knows it needs nothing else.
|
||||
if c, err := fs.SafePath(pi); err != nil {
|
||||
return err
|
||||
|
@ -647,7 +647,7 @@ func (fs *Filesystem) Copy(p string) error {
|
|||
// Deletes a file or folder from the system. Prevents the user from accidentally
|
||||
// (or maliciously) removing their root server data directory.
|
||||
func (fs *Filesystem) Delete(p string) error {
|
||||
// This is one of the few (only?) places in the codebase where we're explictly not using
|
||||
// This is one of the few (only?) places in the codebase where we're explicitly not using
|
||||
// the SafePath functionality when working with user provided input. If we did, you would
|
||||
// not be able to delete a file that is a symlink pointing to a location outside of the data
|
||||
// directory.
|
||||
|
|
|
@ -9,5 +9,5 @@ import (
|
|||
func (s *Stat) CTime() time.Time {
|
||||
st := s.Info.Sys().(*syscall.Stat_t)
|
||||
|
||||
return time.Unix(int64(st.Ctimespec.Sec), int64(st.Ctimespec.Nsec))
|
||||
return time.Unix(st.Ctimespec.Sec, st.Ctimespec.Nsec)
|
||||
}
|
|
@ -9,5 +9,5 @@ import (
|
|||
func (s *Stat) CTime() time.Time {
|
||||
st := s.Info.Sys().(*syscall.Stat_t)
|
||||
|
||||
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
|
||||
return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
||||
}
|
|
@ -25,7 +25,7 @@ import (
|
|||
// Executes the installation stack for a server process. Bubbles any errors up to the calling
|
||||
// function which should handle contacting the panel to notify it of the server state.
|
||||
//
|
||||
// Pass true as the first arugment in order to execute a server sync before the process to
|
||||
// Pass true as the first argument in order to execute a server sync before the process to
|
||||
// ensure the latest information is used.
|
||||
func (s *Server) Install(sync bool) error {
|
||||
if sync {
|
||||
|
@ -197,7 +197,7 @@ func (ip *InstallationProcess) RemoveContainer() {
|
|||
}
|
||||
}
|
||||
|
||||
// Runs the installation process, this is done as a backgrounded thread. This will configure
|
||||
// Runs the installation process, this is done as in a background thread. This will configure
|
||||
// the required environment, and then spin up the installation container.
|
||||
//
|
||||
// Once the container finishes installing the results will be stored in an installation
|
||||
|
@ -210,7 +210,7 @@ func (ip *InstallationProcess) Run() error {
|
|||
|
||||
// We now have an exclusive lock on this installation process. Ensure that whenever this
|
||||
// process is finished that the semaphore is released so that other processes and be executed
|
||||
// without encounting a wait timeout.
|
||||
// without encountering a wait timeout.
|
||||
defer func() {
|
||||
ip.Server.Log().Debug("releasing installation process lock")
|
||||
ip.Server.installer.sem.Release(1)
|
||||
|
@ -464,13 +464,13 @@ func (ip *InstallationProcess) Execute() (string, error) {
|
|||
ip.Server.Events().Publish(DaemonMessageEvent, "Installation process completed.")
|
||||
}(r.ID)
|
||||
|
||||
sChann, eChann := ip.client.ContainerWait(ip.context, r.ID, container.WaitConditionNotRunning)
|
||||
sChan, eChan := ip.client.ContainerWait(ip.context, r.ID, container.WaitConditionNotRunning)
|
||||
select {
|
||||
case err := <-eChann:
|
||||
case err := <-eChan:
|
||||
if err != nil {
|
||||
return "", errors.WithStack(err)
|
||||
}
|
||||
case <-sChann:
|
||||
case <-sChan:
|
||||
}
|
||||
|
||||
return r.ID, nil
|
||||
|
|
|
@ -33,8 +33,10 @@ func (s *Server) StartEventListeners() {
|
|||
|
||||
// Also pass the data along to the console output channel.
|
||||
s.onConsoleOutput(data.Data)
|
||||
|
||||
case data := <-state:
|
||||
s.SetState(data.Data)
|
||||
|
||||
case data := <-stats:
|
||||
st := new(environment.Stats)
|
||||
if err := json.Unmarshal([]byte(data.Data), st); err != nil {
|
||||
|
|
|
@ -94,7 +94,7 @@ func (s *Server) HandlePowerAction(action PowerAction, waitSeconds ...int) error
|
|||
|
||||
return s.Environment.Start()
|
||||
case PowerActionStop:
|
||||
// We're specificially waiting for the process to be stopped here, otherwise the lock is released
|
||||
// We're specifically waiting for the process to be stopped here, otherwise the lock is released
|
||||
// too soon, and you can rack up all sorts of issues.
|
||||
return s.Environment.WaitForStop(10*60, true)
|
||||
case PowerActionRestart:
|
||||
|
@ -148,7 +148,7 @@ func (s *Server) onBeforeStart() error {
|
|||
|
||||
// Update the configuration files defined for the server before beginning the boot process.
|
||||
// This process executes a bunch of parallel updates, so we just block until that process
|
||||
// is completee. Any errors as a result of this will just be bubbled out in the logger,
|
||||
// is complete. Any errors as a result of this will just be bubbled out in the logger,
|
||||
// we don't need to actively do anything about it at this point, worst comes to worst the
|
||||
// server starts in a weird state and the user can manually adjust.
|
||||
s.PublishConsoleOutputFromDaemon("Updating process configuration files...")
|
||||
|
|
|
@ -39,10 +39,14 @@ func (s *Server) emitProcUsage() {
|
|||
s.resources.mu.RLock()
|
||||
defer s.resources.mu.RUnlock()
|
||||
|
||||
b, _ := json.Marshal(s.resources)
|
||||
b, err := json.Marshal(s.resources)
|
||||
if err == nil {
|
||||
s.Events().Publish(StatsEvent, string(b))
|
||||
}
|
||||
|
||||
// TODO: This might be a good place to add a debug log if stats are not sending.
|
||||
}
|
||||
|
||||
// Returns the servers current state.
|
||||
func (ru *ResourceUsage) getInternalState() string {
|
||||
ru.mu.RLock()
|
||||
|
|
|
@ -156,7 +156,7 @@ func (s *Server) IsBootable() bool {
|
|||
return exists
|
||||
}
|
||||
|
||||
// Initalizes a server instance. This will run through and ensure that the environment
|
||||
// Initializes a server instance. This will run through and ensure that the environment
|
||||
// for the server is setup, and that all of the necessary files are created.
|
||||
func (s *Server) CreateEnvironment() error {
|
||||
// Ensure the data directory exists before getting too far through this process.
|
||||
|
|
|
@ -16,7 +16,7 @@ type FileSystem struct {
|
|||
UUID string
|
||||
Permissions []string
|
||||
ReadOnly bool
|
||||
User SftpUser
|
||||
User User
|
||||
Cache *cache.Cache
|
||||
|
||||
PathValidator func(fs FileSystem, p string) (string, error)
|
||||
|
@ -351,7 +351,7 @@ func (fs FileSystem) Filelist(request *sftp.Request) (sftp.ListerAt, error) {
|
|||
default:
|
||||
// Before adding readlink support we need to evaluate any potential security risks
|
||||
// as a result of navigating around to a location that is outside the home directory
|
||||
// for the logged in user. I don't forsee it being much of a problem, but I do want to
|
||||
// for the logged in user. I don't foresee it being much of a problem, but I do want to
|
||||
// check it out before slapping some code here. Until then, we'll just return an
|
||||
// unsupported response code.
|
||||
return nil, sftp.ErrSshFxOpUnsupported
|
||||
|
|
|
@ -27,7 +27,7 @@ type Settings struct {
|
|||
BindAddress string
|
||||
}
|
||||
|
||||
type SftpUser struct {
|
||||
type User struct {
|
||||
Uid int
|
||||
Gid int
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ type Server struct {
|
|||
cache *cache.Cache
|
||||
|
||||
Settings Settings
|
||||
User SftpUser
|
||||
User User
|
||||
|
||||
PathValidator func(fs FileSystem, p string) (string, error)
|
||||
DiskSpaceValidator func(fs FileSystem) bool
|
||||
|
|
|
@ -12,7 +12,7 @@ var noMatchingServerError = errors.New("no matching server with that UUID was fo
|
|||
|
||||
func Initialize(config config.SystemConfiguration) error {
|
||||
s := &Server{
|
||||
User: SftpUser{
|
||||
User: User{
|
||||
Uid: config.User.Uid,
|
||||
Gid: config.User.Gid,
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ func validateDiskSpace(fs FileSystem) bool {
|
|||
return s.Filesystem.HasSpaceAvailable(true)
|
||||
}
|
||||
|
||||
// Validates a set of credentials for a SFTP login aganist Pterodactyl Panel and returns
|
||||
// Validates a set of credentials for a SFTP login against Pterodactyl Panel and returns
|
||||
// the server's UUID if the credentials were valid.
|
||||
func validateCredentials(c api.SftpAuthRequest) (*api.SftpAuthResponse, error) {
|
||||
f := log.Fields{"subsystem": "sftp", "username": c.User, "ip": c.IP}
|
||||
|
|
Loading…
Reference in New Issue
Block a user