github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+incompatible/plugin/rpcplugin/sandbox/sandbox.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package sandbox 5 6 import ( 7 "context" 8 "io" 9 10 "github.com/mattermost/mattermost-server/plugin/rpcplugin" 11 ) 12 13 type MountPoint struct { 14 Source string 15 Destination string 16 Type string 17 ReadOnly bool 18 } 19 20 type Configuration struct { 21 MountPoints []*MountPoint 22 WorkingDirectory string 23 } 24 25 // NewProcess is like rpcplugin.NewProcess, but launches the process in a sandbox. 26 func NewProcess(ctx context.Context, config *Configuration, path string) (rpcplugin.Process, io.ReadWriteCloser, error) { 27 return newProcess(ctx, config, path) 28 } 29 30 // CheckSupport inspects the platform and environment to determine whether or not there are any 31 // expected issues with sandboxing. If nil is returned, sandboxing should be used. 32 func CheckSupport() error { 33 return checkSupport() 34 }