mirror of
https://github.com/coder/coder.git
synced 2025-07-29 10:35:52 +00:00
feat: add port-sharing backend (#11939)
This commit is contained in:
25
coderd/portsharing/portsharing.go
Normal file
25
coderd/portsharing/portsharing.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package portsharing
|
||||
|
||||
import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
)
|
||||
|
||||
type PortSharer interface {
|
||||
AuthorizedPortSharingLevel(template database.Template, level codersdk.WorkspaceAgentPortShareLevel) error
|
||||
ValidateTemplateMaxPortSharingLevel(level codersdk.WorkspaceAgentPortShareLevel) error
|
||||
}
|
||||
|
||||
type AGPLPortSharer struct{}
|
||||
|
||||
func (AGPLPortSharer) AuthorizedPortSharingLevel(_ database.Template, _ codersdk.WorkspaceAgentPortShareLevel) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (AGPLPortSharer) ValidateTemplateMaxPortSharingLevel(_ codersdk.WorkspaceAgentPortShareLevel) error {
|
||||
return xerrors.New("Restricting port sharing level is an enterprise feature that is not enabled.")
|
||||
}
|
||||
|
||||
var DefaultPortSharer PortSharer = AGPLPortSharer{}
|
Reference in New Issue
Block a user