id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
23,500
gravitational/teleport
lib/asciitable/table.go
MakeHeadlessTable
func MakeHeadlessTable(columnCount int) Table { return Table{ columns: make([]column, columnCount), rows: make([][]string, 0), } }
go
func MakeHeadlessTable(columnCount int) Table { return Table{ columns: make([]column, columnCount), rows: make([][]string, 0), } }
[ "func", "MakeHeadlessTable", "(", "columnCount", "int", ")", "Table", "{", "return", "Table", "{", "columns", ":", "make", "(", "[", "]", "column", ",", "columnCount", ")", ",", "rows", ":", "make", "(", "[", "]", "[", "]", "string", ",", "0", ")", ...
// MakeTable creates a new instance of the table without any column names. // The number of columns is required.
[ "MakeTable", "creates", "a", "new", "instance", "of", "the", "table", "without", "any", "column", "names", ".", "The", "number", "of", "columns", "is", "required", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/asciitable/table.go#L53-L58
23,501
gravitational/teleport
lib/asciitable/table.go
AddRow
func (t *Table) AddRow(row []string) { limit := min(len(row), len(t.columns)) for i := 0; i < limit; i++ { cellWidth := len(row[i]) t.columns[i].width = max(cellWidth, t.columns[i].width) } t.rows = append(t.rows, row[:limit]) }
go
func (t *Table) AddRow(row []string) { limit := min(len(row), len(t.columns)) for i := 0; i < limit; i++ { cellWidth := len(row[i]) t.columns[i].width = max(cellWidth, t.columns[i].width) } t.rows = append(t.rows, row[:limit]) }
[ "func", "(", "t", "*", "Table", ")", "AddRow", "(", "row", "[", "]", "string", ")", "{", "limit", ":=", "min", "(", "len", "(", "row", ")", ",", "len", "(", "t", ".", "columns", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "limit",...
// AddRow adds a row of cells to the table.
[ "AddRow", "adds", "a", "row", "of", "cells", "to", "the", "table", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/asciitable/table.go#L61-L68
23,502
gravitational/teleport
lib/asciitable/table.go
IsHeadless
func (t *Table) IsHeadless() bool { total := 0 for i := range t.columns { total += len(t.columns[i].title) } return total == 0 }
go
func (t *Table) IsHeadless() bool { total := 0 for i := range t.columns { total += len(t.columns[i].title) } return total == 0 }
[ "func", "(", "t", "*", "Table", ")", "IsHeadless", "(", ")", "bool", "{", "total", ":=", "0", "\n", "for", "i", ":=", "range", "t", ".", "columns", "{", "total", "+=", "len", "(", "t", ".", "columns", "[", "i", "]", ".", "title", ")", "\n", "...
// IsHeadless returns true if none of the table title cells contains any text.
[ "IsHeadless", "returns", "true", "if", "none", "of", "the", "table", "title", "cells", "contains", "any", "text", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/asciitable/table.go#L104-L110
23,503
gravitational/teleport
lib/utils/uri.go
ParseSessionsURI
func ParseSessionsURI(in string) (*url.URL, error) { if in == "" { return nil, trace.BadParameter("uri is empty") } u, err := url.Parse(in) if err != nil { return nil, trace.BadParameter("failed to parse URI %q: %v", in, err) } if u.Scheme == "" { u.Scheme = teleport.SchemeFile } return u, nil }
go
func ParseSessionsURI(in string) (*url.URL, error) { if in == "" { return nil, trace.BadParameter("uri is empty") } u, err := url.Parse(in) if err != nil { return nil, trace.BadParameter("failed to parse URI %q: %v", in, err) } if u.Scheme == "" { u.Scheme = teleport.SchemeFile } return u, nil }
[ "func", "ParseSessionsURI", "(", "in", "string", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "if", "in", "==", "\"", "\"", "{", "return", "nil", ",", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "u", ",", "...
// ParseSessionsURI parses uri per convention of session upload URIs // file is a default scheme
[ "ParseSessionsURI", "parses", "uri", "per", "convention", "of", "session", "upload", "URIs", "file", "is", "a", "default", "scheme" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/uri.go#L28-L40
23,504
gravitational/teleport
lib/utils/cli.go
GetIterations
func GetIterations() int { out := os.Getenv(teleport.IterationsEnvVar) if out == "" { return 1 } iter, err := strconv.Atoi(out) if err != nil { panic(err) } log.Debugf("Starting tests with %v iterations.", iter) return iter }
go
func GetIterations() int { out := os.Getenv(teleport.IterationsEnvVar) if out == "" { return 1 } iter, err := strconv.Atoi(out) if err != nil { panic(err) } log.Debugf("Starting tests with %v iterations.", iter) return iter }
[ "func", "GetIterations", "(", ")", "int", "{", "out", ":=", "os", ".", "Getenv", "(", "teleport", ".", "IterationsEnvVar", ")", "\n", "if", "out", "==", "\"", "\"", "{", "return", "1", "\n", "}", "\n", "iter", ",", "err", ":=", "strconv", ".", "Ato...
// GetIterations provides a simple way to add iterations to the test // by setting environment variable "ITERATIONS", by default it returns 1
[ "GetIterations", "provides", "a", "simple", "way", "to", "add", "iterations", "to", "the", "test", "by", "setting", "environment", "variable", "ITERATIONS", "by", "default", "it", "returns", "1" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/cli.go#L103-L114
23,505
gravitational/teleport
lib/utils/cli.go
UserMessageFromError
func UserMessageFromError(err error) string { // untrusted cert? switch innerError := trace.Unwrap(err).(type) { case x509.HostnameError: return fmt.Sprintf("Cannot establish https connection to %s:\n%s\n%s\n", innerError.Host, innerError.Error(), "try a different hostname for --proxy or specify --insecur...
go
func UserMessageFromError(err error) string { // untrusted cert? switch innerError := trace.Unwrap(err).(type) { case x509.HostnameError: return fmt.Sprintf("Cannot establish https connection to %s:\n%s\n%s\n", innerError.Host, innerError.Error(), "try a different hostname for --proxy or specify --insecur...
[ "func", "UserMessageFromError", "(", "err", "error", ")", "string", "{", "// untrusted cert?", "switch", "innerError", ":=", "trace", ".", "Unwrap", "(", "err", ")", ".", "(", "type", ")", "{", "case", "x509", ".", "HostnameError", ":", "return", "fmt", "....
// UserMessageFromError returns user friendly error message from error
[ "UserMessageFromError", "returns", "user", "friendly", "error", "message", "from", "error" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/cli.go#L117-L167
23,506
gravitational/teleport
lib/utils/cli.go
InitCLIParser
func InitCLIParser(appName, appHelp string) (app *kingpin.Application) { app = kingpin.New(appName, appHelp) // hide "--help" flag app.HelpFlag.Hidden() app.HelpFlag.NoEnvar() // set our own help template return app.UsageTemplate(defaultUsageTemplate) }
go
func InitCLIParser(appName, appHelp string) (app *kingpin.Application) { app = kingpin.New(appName, appHelp) // hide "--help" flag app.HelpFlag.Hidden() app.HelpFlag.NoEnvar() // set our own help template return app.UsageTemplate(defaultUsageTemplate) }
[ "func", "InitCLIParser", "(", "appName", ",", "appHelp", "string", ")", "(", "app", "*", "kingpin", ".", "Application", ")", "{", "app", "=", "kingpin", ".", "New", "(", "appName", ",", "appHelp", ")", "\n\n", "// hide \"--help\" flag", "app", ".", "HelpFl...
// InitCLIParser configures kingpin command line args parser with // some defaults common for all Teleport CLI tools
[ "InitCLIParser", "configures", "kingpin", "command", "line", "args", "parser", "with", "some", "defaults", "common", "for", "all", "Teleport", "CLI", "tools" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/cli.go#L185-L194
23,507
gravitational/teleport
lib/utils/cli.go
needsQuoting
func needsQuoting(text string) bool { for _, r := range text { if !strconv.IsPrint(r) { return true } } return false }
go
func needsQuoting(text string) bool { for _, r := range text { if !strconv.IsPrint(r) { return true } } return false }
[ "func", "needsQuoting", "(", "text", "string", ")", "bool", "{", "for", "_", ",", "r", ":=", "range", "text", "{", "if", "!", "strconv", ".", "IsPrint", "(", "r", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}...
// needsQuoting returns true if any non-printable characters are found.
[ "needsQuoting", "returns", "true", "if", "any", "non", "-", "printable", "characters", "are", "found", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/cli.go#L208-L215
23,508
gravitational/teleport
lib/web/ui/server.go
MakeServers
func MakeServers(clusterName string, servers []services.Server) []Server { uiServers := []Server{} for _, server := range servers { uiLabels := []Label{} serverLabels := server.GetLabels() for name, value := range serverLabels { uiLabels = append(uiLabels, Label{ Name: name, Value: value, }) } ...
go
func MakeServers(clusterName string, servers []services.Server) []Server { uiServers := []Server{} for _, server := range servers { uiLabels := []Label{} serverLabels := server.GetLabels() for name, value := range serverLabels { uiLabels = append(uiLabels, Label{ Name: name, Value: value, }) } ...
[ "func", "MakeServers", "(", "clusterName", "string", ",", "servers", "[", "]", "services", ".", "Server", ")", "[", "]", "Server", "{", "uiServers", ":=", "[", "]", "Server", "{", "}", "\n", "for", "_", ",", "server", ":=", "range", "servers", "{", "...
// MakeServers creates server objects for webapp
[ "MakeServers", "creates", "server", "objects", "for", "webapp" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/ui/server.go#L63-L95
23,509
gravitational/teleport
lib/service/signals.go
printShutdownStatus
func (process *TeleportProcess) printShutdownStatus(ctx context.Context) { t := time.NewTicker(defaults.HighResReportingPeriod) defer t.Stop() for { select { case <-ctx.Done(): return case <-t.C: log.Infof("Waiting for services: %v to finish.", process.Supervisor.Services()) } } }
go
func (process *TeleportProcess) printShutdownStatus(ctx context.Context) { t := time.NewTicker(defaults.HighResReportingPeriod) defer t.Stop() for { select { case <-ctx.Done(): return case <-t.C: log.Infof("Waiting for services: %v to finish.", process.Supervisor.Services()) } } }
[ "func", "(", "process", "*", "TeleportProcess", ")", "printShutdownStatus", "(", "ctx", "context", ".", "Context", ")", "{", "t", ":=", "time", ".", "NewTicker", "(", "defaults", ".", "HighResReportingPeriod", ")", "\n", "defer", "t", ".", "Stop", "(", ")"...
// printShutdownStatus prints running services until shut down
[ "printShutdownStatus", "prints", "running", "services", "until", "shut", "down" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L38-L49
23,510
gravitational/teleport
lib/service/signals.go
closeImportedDescriptors
func (process *TeleportProcess) closeImportedDescriptors(prefix string) error { process.Lock() defer process.Unlock() var errors []error for i := range process.importedDescriptors { d := process.importedDescriptors[i] if strings.HasPrefix(d.Type, prefix) { process.Infof("Closing imported but unused descript...
go
func (process *TeleportProcess) closeImportedDescriptors(prefix string) error { process.Lock() defer process.Unlock() var errors []error for i := range process.importedDescriptors { d := process.importedDescriptors[i] if strings.HasPrefix(d.Type, prefix) { process.Infof("Closing imported but unused descript...
[ "func", "(", "process", "*", "TeleportProcess", ")", "closeImportedDescriptors", "(", "prefix", "string", ")", "error", "{", "process", ".", "Lock", "(", ")", "\n", "defer", "process", ".", "Unlock", "(", ")", "\n\n", "var", "errors", "[", "]", "error", ...
// closeImportedDescriptors closes imported but unused file descriptors, // what could happen if service has updated configuration
[ "closeImportedDescriptors", "closes", "imported", "but", "unused", "file", "descriptors", "what", "could", "happen", "if", "service", "has", "updated", "configuration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L186-L199
23,511
gravitational/teleport
lib/service/signals.go
importListener
func (process *TeleportProcess) importListener(listenerType, address string) (net.Listener, error) { process.Lock() defer process.Unlock() for i := range process.importedDescriptors { d := process.importedDescriptors[i] if d.Type == listenerType && d.Address == address { l, err := d.ToListener() if err !=...
go
func (process *TeleportProcess) importListener(listenerType, address string) (net.Listener, error) { process.Lock() defer process.Unlock() for i := range process.importedDescriptors { d := process.importedDescriptors[i] if d.Type == listenerType && d.Address == address { l, err := d.ToListener() if err !=...
[ "func", "(", "process", "*", "TeleportProcess", ")", "importListener", "(", "listenerType", ",", "address", "string", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "process", ".", "Lock", "(", ")", "\n", "defer", "process", ".", "Unlock", "("...
// importListener imports listener passed by the parent process, if no listener is found // returns NotFound, otherwise removes the file from the list
[ "importListener", "imports", "listener", "passed", "by", "the", "parent", "process", "if", "no", "listener", "is", "found", "returns", "NotFound", "otherwise", "removes", "the", "file", "from", "the", "list" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L233-L251
23,512
gravitational/teleport
lib/service/signals.go
createListener
func (process *TeleportProcess) createListener(listenerType, address string) (net.Listener, error) { listener, err := net.Listen("tcp", address) if err != nil { return nil, trace.Wrap(err) } process.Lock() defer process.Unlock() r := RegisteredListener{Type: listenerType, Address: address, Listener: listener} ...
go
func (process *TeleportProcess) createListener(listenerType, address string) (net.Listener, error) { listener, err := net.Listen("tcp", address) if err != nil { return nil, trace.Wrap(err) } process.Lock() defer process.Unlock() r := RegisteredListener{Type: listenerType, Address: address, Listener: listener} ...
[ "func", "(", "process", "*", "TeleportProcess", ")", "createListener", "(", "listenerType", ",", "address", "string", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "listener", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "a...
// createListener creates listener and adds to a list of tracked listeners
[ "createListener", "creates", "listener", "and", "adds", "to", "a", "list", "of", "tracked", "listeners" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L254-L264
23,513
gravitational/teleport
lib/service/signals.go
ExportFileDescriptors
func (process *TeleportProcess) ExportFileDescriptors() ([]FileDescriptor, error) { var out []FileDescriptor process.Lock() defer process.Unlock() for _, r := range process.registeredListeners { file, err := utils.GetListenerFile(r.Listener) if err != nil { return nil, trace.Wrap(err) } out = append(out,...
go
func (process *TeleportProcess) ExportFileDescriptors() ([]FileDescriptor, error) { var out []FileDescriptor process.Lock() defer process.Unlock() for _, r := range process.registeredListeners { file, err := utils.GetListenerFile(r.Listener) if err != nil { return nil, trace.Wrap(err) } out = append(out,...
[ "func", "(", "process", "*", "TeleportProcess", ")", "ExportFileDescriptors", "(", ")", "(", "[", "]", "FileDescriptor", ",", "error", ")", "{", "var", "out", "[", "]", "FileDescriptor", "\n", "process", ".", "Lock", "(", ")", "\n", "defer", "process", "...
// ExportFileDescriptors exports file descriptors to be passed to child process
[ "ExportFileDescriptors", "exports", "file", "descriptors", "to", "be", "passed", "to", "child", "process" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L267-L279
23,514
gravitational/teleport
lib/service/signals.go
importFileDescriptors
func importFileDescriptors() ([]FileDescriptor, error) { // These files may be passed in by the parent process filesString := os.Getenv(teleportFilesEnvVar) if filesString == "" { return nil, nil } files, err := filesFromString(filesString) if err != nil { return nil, trace.BadParameter("child process has fa...
go
func importFileDescriptors() ([]FileDescriptor, error) { // These files may be passed in by the parent process filesString := os.Getenv(teleportFilesEnvVar) if filesString == "" { return nil, nil } files, err := filesFromString(filesString) if err != nil { return nil, trace.BadParameter("child process has fa...
[ "func", "importFileDescriptors", "(", ")", "(", "[", "]", "FileDescriptor", ",", "error", ")", "{", "// These files may be passed in by the parent process", "filesString", ":=", "os", ".", "Getenv", "(", "teleportFilesEnvVar", ")", "\n", "if", "filesString", "==", "...
// importFileDescriptors imports file descriptors from environment if there are any
[ "importFileDescriptors", "imports", "file", "descriptors", "from", "environment", "if", "there", "are", "any" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/signals.go#L282-L299
23,515
gravitational/teleport
lib/events/recorder.go
NewForwardRecorder
func NewForwardRecorder(cfg ForwardRecorderConfig) (*ForwardRecorder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } // Always write sessions to local disk first, then forward them to the Auth // Server later. auditLog, err := NewForwarder(ForwarderConfig{ SessionID: ...
go
func NewForwardRecorder(cfg ForwardRecorderConfig) (*ForwardRecorder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } // Always write sessions to local disk first, then forward them to the Auth // Server later. auditLog, err := NewForwarder(ForwarderConfig{ SessionID: ...
[ "func", "NewForwardRecorder", "(", "cfg", "ForwardRecorderConfig", ")", "(", "*", "ForwardRecorder", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", ...
// NewForwardRecorder returns a new instance of session recorder
[ "NewForwardRecorder", "returns", "a", "new", "instance", "of", "session", "recorder" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/recorder.go#L112-L139
23,516
gravitational/teleport
lib/events/recorder.go
Write
func (r *ForwardRecorder) Write(data []byte) (int, error) { // we are copying buffer to prevent data corruption: // io.Copy allocates single buffer and calls multiple writes in a loop // our PostSessionSlice is async and sends reader wrapping buffer // to the channel. This can lead to cases when the buffer is re-us...
go
func (r *ForwardRecorder) Write(data []byte) (int, error) { // we are copying buffer to prevent data corruption: // io.Copy allocates single buffer and calls multiple writes in a loop // our PostSessionSlice is async and sends reader wrapping buffer // to the channel. This can lead to cases when the buffer is re-us...
[ "func", "(", "r", "*", "ForwardRecorder", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "// we are copying buffer to prevent data corruption:", "// io.Copy allocates single buffer and calls multiple writes in a loop", "// our PostSess...
// Write takes a chunk and writes it into the audit log
[ "Write", "takes", "a", "chunk", "and", "writes", "it", "into", "the", "audit", "log" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/recorder.go#L147-L169
23,517
gravitational/teleport
lib/events/recorder.go
Close
func (r *ForwardRecorder) Close() error { var errors []error err := r.AuditLog.Close() errors = append(errors, err) // wait until all events from recorder get flushed, it is important // to do so before we send SessionEndEvent to advise the audit log // to release resources associated with this session. // not ...
go
func (r *ForwardRecorder) Close() error { var errors []error err := r.AuditLog.Close() errors = append(errors, err) // wait until all events from recorder get flushed, it is important // to do so before we send SessionEndEvent to advise the audit log // to release resources associated with this session. // not ...
[ "func", "(", "r", "*", "ForwardRecorder", ")", "Close", "(", ")", "error", "{", "var", "errors", "[", "]", "error", "\n", "err", ":=", "r", ".", "AuditLog", ".", "Close", "(", ")", "\n", "errors", "=", "append", "(", "errors", ",", "err", ")", "\...
// Close closes audit log session recorder
[ "Close", "closes", "audit", "log", "session", "recorder" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/recorder.go#L172-L191
23,518
gravitational/teleport
lib/backend/helpers.go
AcquireLock
func AcquireLock(ctx context.Context, backend Backend, lockName string, ttl time.Duration) (err error) { if lockName == "" { return trace.BadParameter("missing parameter lock name") } key := []byte(filepath.Join(locksPrefix, lockName)) for { // Get will clear TTL on a lock backend.Get(ctx, key) // CreateVa...
go
func AcquireLock(ctx context.Context, backend Backend, lockName string, ttl time.Duration) (err error) { if lockName == "" { return trace.BadParameter("missing parameter lock name") } key := []byte(filepath.Join(locksPrefix, lockName)) for { // Get will clear TTL on a lock backend.Get(ctx, key) // CreateVa...
[ "func", "AcquireLock", "(", "ctx", "context", ".", "Context", ",", "backend", "Backend", ",", "lockName", "string", ",", "ttl", "time", ".", "Duration", ")", "(", "err", "error", ")", "{", "if", "lockName", "==", "\"", "\"", "{", "return", "trace", "."...
// AcquireLock grabs a lock that will be released automatically in TTL
[ "AcquireLock", "grabs", "a", "lock", "that", "will", "be", "released", "automatically", "in", "TTL" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/helpers.go#L30-L51
23,519
gravitational/teleport
lib/backend/helpers.go
ReleaseLock
func ReleaseLock(ctx context.Context, backend Backend, lockName string) error { if lockName == "" { return trace.BadParameter("missing parameter lockName") } key := []byte(filepath.Join(locksPrefix, lockName)) if err := backend.Delete(ctx, key); err != nil { return trace.Wrap(err) } return nil }
go
func ReleaseLock(ctx context.Context, backend Backend, lockName string) error { if lockName == "" { return trace.BadParameter("missing parameter lockName") } key := []byte(filepath.Join(locksPrefix, lockName)) if err := backend.Delete(ctx, key); err != nil { return trace.Wrap(err) } return nil }
[ "func", "ReleaseLock", "(", "ctx", "context", ".", "Context", ",", "backend", "Backend", ",", "lockName", "string", ")", "error", "{", "if", "lockName", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n...
// ReleaseLock forces lock release
[ "ReleaseLock", "forces", "lock", "release" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/helpers.go#L54-L63
23,520
gravitational/teleport
lib/services/authority.go
Check
func (c *HostCertParams) Check() error { if c.HostID == "" && len(c.Principals) == 0 { return trace.BadParameter("HostID [%q] or Principals [%q] are required", c.HostID, c.Principals) } if c.ClusterName == "" { return trace.BadParameter("ClusterName [%q] is required", c.ClusterName) } if err := c.Roles.Che...
go
func (c *HostCertParams) Check() error { if c.HostID == "" && len(c.Principals) == 0 { return trace.BadParameter("HostID [%q] or Principals [%q] are required", c.HostID, c.Principals) } if c.ClusterName == "" { return trace.BadParameter("ClusterName [%q] is required", c.ClusterName) } if err := c.Roles.Che...
[ "func", "(", "c", "*", "HostCertParams", ")", "Check", "(", ")", "error", "{", "if", "c", ".", "HostID", "==", "\"", "\"", "&&", "len", "(", "c", ".", "Principals", ")", "==", "0", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ","...
// Check checks parameters for errors
[ "Check", "checks", "parameters", "for", "errors" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L57-L71
23,521
gravitational/teleport
lib/services/authority.go
MarshalCertRoles
func MarshalCertRoles(roles []string) (string, error) { out, err := json.Marshal(CertRoles{Version: V1, Roles: roles}) if err != nil { return "", trace.Wrap(err) } return string(out), err }
go
func MarshalCertRoles(roles []string) (string, error) { out, err := json.Marshal(CertRoles{Version: V1, Roles: roles}) if err != nil { return "", trace.Wrap(err) } return string(out), err }
[ "func", "MarshalCertRoles", "(", "roles", "[", "]", "string", ")", "(", "string", ",", "error", ")", "{", "out", ",", "err", ":=", "json", ".", "Marshal", "(", "CertRoles", "{", "Version", ":", "V1", ",", "Roles", ":", "roles", "}", ")", "\n", "if"...
// MarshalCertRoles marshal roles list to OpenSSH
[ "MarshalCertRoles", "marshal", "roles", "list", "to", "OpenSSH" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L133-L139
23,522
gravitational/teleport
lib/services/authority.go
UnmarshalCertRoles
func UnmarshalCertRoles(data string) ([]string, error) { var certRoles CertRoles if err := utils.UnmarshalWithSchema(CertRolesSchema, &certRoles, []byte(data)); err != nil { return nil, trace.BadParameter(err.Error()) } return certRoles.Roles, nil }
go
func UnmarshalCertRoles(data string) ([]string, error) { var certRoles CertRoles if err := utils.UnmarshalWithSchema(CertRolesSchema, &certRoles, []byte(data)); err != nil { return nil, trace.BadParameter(err.Error()) } return certRoles.Roles, nil }
[ "func", "UnmarshalCertRoles", "(", "data", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "certRoles", "CertRoles", "\n", "if", "err", ":=", "utils", ".", "UnmarshalWithSchema", "(", "CertRolesSchema", ",", "&", "certRoles", ",", "[...
// UnmarshalCertRoles marshals roles list to OpenSSH
[ "UnmarshalCertRoles", "marshals", "roles", "list", "to", "OpenSSH" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L142-L148
23,523
gravitational/teleport
lib/services/authority.go
CertPoolFromCertAuthorities
func CertPoolFromCertAuthorities(cas []CertAuthority) (*x509.CertPool, error) { certPool := x509.NewCertPool() for _, ca := range cas { keyPairs := ca.GetTLSKeyPairs() if len(keyPairs) == 0 { continue } for _, keyPair := range keyPairs { cert, err := tlsca.ParseCertificatePEM(keyPair.Cert) if err != ...
go
func CertPoolFromCertAuthorities(cas []CertAuthority) (*x509.CertPool, error) { certPool := x509.NewCertPool() for _, ca := range cas { keyPairs := ca.GetTLSKeyPairs() if len(keyPairs) == 0 { continue } for _, keyPair := range keyPairs { cert, err := tlsca.ParseCertificatePEM(keyPair.Cert) if err != ...
[ "func", "CertPoolFromCertAuthorities", "(", "cas", "[", "]", "CertAuthority", ")", "(", "*", "x509", ".", "CertPool", ",", "error", ")", "{", "certPool", ":=", "x509", ".", "NewCertPool", "(", ")", "\n", "for", "_", ",", "ca", ":=", "range", "cas", "{"...
// CertPoolFromCertAuthorities returns certificate pools from TLS certificates // set up in the certificate authorities list
[ "CertPoolFromCertAuthorities", "returns", "certificate", "pools", "from", "TLS", "certificates", "set", "up", "in", "the", "certificate", "authorities", "list" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L217-L234
23,524
gravitational/teleport
lib/services/authority.go
TLSCerts
func TLSCerts(ca CertAuthority) [][]byte { pairs := ca.GetTLSKeyPairs() out := make([][]byte, len(pairs)) for i, pair := range pairs { out[i] = append([]byte{}, pair.Cert...) } return out }
go
func TLSCerts(ca CertAuthority) [][]byte { pairs := ca.GetTLSKeyPairs() out := make([][]byte, len(pairs)) for i, pair := range pairs { out[i] = append([]byte{}, pair.Cert...) } return out }
[ "func", "TLSCerts", "(", "ca", "CertAuthority", ")", "[", "]", "[", "]", "byte", "{", "pairs", ":=", "ca", ".", "GetTLSKeyPairs", "(", ")", "\n", "out", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "pairs", ")", ")", "\n", "f...
// TLSCerts returns TLS certificates from CA
[ "TLSCerts", "returns", "TLS", "certificates", "from", "CA" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L255-L262
23,525
gravitational/teleport
lib/services/authority.go
NewCertAuthority
func NewCertAuthority(caType CertAuthType, clusterName string, signingKeys, checkingKeys [][]byte, roles []string) CertAuthority { return &CertAuthorityV2{ Kind: KindCertAuthority, Version: V2, SubKind: string(caType), Metadata: Metadata{ Name: clusterName, Namespace: defaults.Namespace, }, S...
go
func NewCertAuthority(caType CertAuthType, clusterName string, signingKeys, checkingKeys [][]byte, roles []string) CertAuthority { return &CertAuthorityV2{ Kind: KindCertAuthority, Version: V2, SubKind: string(caType), Metadata: Metadata{ Name: clusterName, Namespace: defaults.Namespace, }, S...
[ "func", "NewCertAuthority", "(", "caType", "CertAuthType", ",", "clusterName", "string", ",", "signingKeys", ",", "checkingKeys", "[", "]", "[", "]", "byte", ",", "roles", "[", "]", "string", ")", "CertAuthority", "{", "return", "&", "CertAuthorityV2", "{", ...
// NewCertAuthority returns new cert authority
[ "NewCertAuthority", "returns", "new", "cert", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L265-L282
23,526
gravitational/teleport
lib/services/authority.go
CertAuthoritiesToV1
func CertAuthoritiesToV1(in []CertAuthority) ([]CertAuthorityV1, error) { out := make([]CertAuthorityV1, len(in)) type cav1 interface { V1() *CertAuthorityV1 } for i, ca := range in { v1, ok := ca.(cav1) if !ok { return nil, trace.BadParameter("could not transform object to V1") } out[i] = *(v1.V1()) ...
go
func CertAuthoritiesToV1(in []CertAuthority) ([]CertAuthorityV1, error) { out := make([]CertAuthorityV1, len(in)) type cav1 interface { V1() *CertAuthorityV1 } for i, ca := range in { v1, ok := ca.(cav1) if !ok { return nil, trace.BadParameter("could not transform object to V1") } out[i] = *(v1.V1()) ...
[ "func", "CertAuthoritiesToV1", "(", "in", "[", "]", "CertAuthority", ")", "(", "[", "]", "CertAuthorityV1", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "CertAuthorityV1", ",", "len", "(", "in", ")", ")", "\n", "type", "cav1", "interface...
// CertAuthoritiesToV1 converts list of cert authorities to V1 slice
[ "CertAuthoritiesToV1", "converts", "list", "of", "cert", "authorities", "to", "V1", "slice" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L285-L298
23,527
gravitational/teleport
lib/services/authority.go
Clone
func (c *CertAuthorityV2) Clone() CertAuthority { out := *c out.Spec.CheckingKeys = utils.CopyByteSlices(c.Spec.CheckingKeys) out.Spec.SigningKeys = utils.CopyByteSlices(c.Spec.SigningKeys) for i, kp := range c.Spec.TLSKeyPairs { out.Spec.TLSKeyPairs[i] = TLSKeyPair{ Key: utils.CopyByteSlice(kp.Key), Cert:...
go
func (c *CertAuthorityV2) Clone() CertAuthority { out := *c out.Spec.CheckingKeys = utils.CopyByteSlices(c.Spec.CheckingKeys) out.Spec.SigningKeys = utils.CopyByteSlices(c.Spec.SigningKeys) for i, kp := range c.Spec.TLSKeyPairs { out.Spec.TLSKeyPairs[i] = TLSKeyPair{ Key: utils.CopyByteSlice(kp.Key), Cert:...
[ "func", "(", "c", "*", "CertAuthorityV2", ")", "Clone", "(", ")", "CertAuthority", "{", "out", ":=", "*", "c", "\n", "out", ".", "Spec", ".", "CheckingKeys", "=", "utils", ".", "CopyByteSlices", "(", "c", ".", "Spec", ".", "CheckingKeys", ")", "\n", ...
// Clone returns a copy of the cert authority object.
[ "Clone", "returns", "a", "copy", "of", "the", "cert", "authority", "object", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L321-L333
23,528
gravitational/teleport
lib/services/authority.go
GetRotation
func (c *CertAuthorityV2) GetRotation() Rotation { if c.Spec.Rotation == nil { return Rotation{} } return *c.Spec.Rotation }
go
func (c *CertAuthorityV2) GetRotation() Rotation { if c.Spec.Rotation == nil { return Rotation{} } return *c.Spec.Rotation }
[ "func", "(", "c", "*", "CertAuthorityV2", ")", "GetRotation", "(", ")", "Rotation", "{", "if", "c", ".", "Spec", ".", "Rotation", "==", "nil", "{", "return", "Rotation", "{", "}", "\n", "}", "\n", "return", "*", "c", ".", "Spec", ".", "Rotation", "...
// GetRotation returns rotation state.
[ "GetRotation", "returns", "rotation", "state", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L336-L341
23,529
gravitational/teleport
lib/services/authority.go
TLSCA
func (c *CertAuthorityV2) TLSCA() (*tlsca.CertAuthority, error) { if len(c.Spec.TLSKeyPairs) == 0 { return nil, trace.BadParameter("no TLS key pairs found for certificate authority") } return tlsca.New(c.Spec.TLSKeyPairs[0].Cert, c.Spec.TLSKeyPairs[0].Key) }
go
func (c *CertAuthorityV2) TLSCA() (*tlsca.CertAuthority, error) { if len(c.Spec.TLSKeyPairs) == 0 { return nil, trace.BadParameter("no TLS key pairs found for certificate authority") } return tlsca.New(c.Spec.TLSKeyPairs[0].Cert, c.Spec.TLSKeyPairs[0].Key) }
[ "func", "(", "c", "*", "CertAuthorityV2", ")", "TLSCA", "(", ")", "(", "*", "tlsca", ".", "CertAuthority", ",", "error", ")", "{", "if", "len", "(", "c", ".", "Spec", ".", "TLSKeyPairs", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "B...
// TLSCA returns TLS certificate authority
[ "TLSCA", "returns", "TLS", "certificate", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L349-L354
23,530
gravitational/teleport
lib/services/authority.go
String
func (c *CertAuthorityV2) String() string { return fmt.Sprintf("CA(name=%v, type=%v)", c.GetClusterName(), c.GetType()) }
go
func (c *CertAuthorityV2) String() string { return fmt.Sprintf("CA(name=%v, type=%v)", c.GetClusterName(), c.GetType()) }
[ "func", "(", "c", "*", "CertAuthorityV2", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "GetClusterName", "(", ")", ",", "c", ".", "GetType", "(", ")", ")", "\n", "}" ]
// String returns human readable version of the CertAuthorityV2.
[ "String", "returns", "human", "readable", "version", "of", "the", "CertAuthorityV2", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L402-L404
23,531
gravitational/teleport
lib/services/authority.go
AddRole
func (ca *CertAuthorityV2) AddRole(name string) { for _, r := range ca.Spec.Roles { if r == name { return } } ca.Spec.Roles = append(ca.Spec.Roles, name) }
go
func (ca *CertAuthorityV2) AddRole(name string) { for _, r := range ca.Spec.Roles { if r == name { return } } ca.Spec.Roles = append(ca.Spec.Roles, name) }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "AddRole", "(", "name", "string", ")", "{", "for", "_", ",", "r", ":=", "range", "ca", ".", "Spec", ".", "Roles", "{", "if", "r", "==", "name", "{", "return", "\n", "}", "\n", "}", "\n", "ca", "."...
// AddRole adds a role to ca role list
[ "AddRole", "adds", "a", "role", "to", "ca", "role", "list" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L417-L424
23,532
gravitational/teleport
lib/services/authority.go
SetSigningKeys
func (ca *CertAuthorityV2) SetSigningKeys(keys [][]byte) error { ca.Spec.SigningKeys = keys return nil }
go
func (ca *CertAuthorityV2) SetSigningKeys(keys [][]byte) error { ca.Spec.SigningKeys = keys return nil }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "SetSigningKeys", "(", "keys", "[", "]", "[", "]", "byte", ")", "error", "{", "ca", ".", "Spec", ".", "SigningKeys", "=", "keys", "\n", "return", "nil", "\n", "}" ]
// SetSigningKeys sets signing keys
[ "SetSigningKeys", "sets", "signing", "keys" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L432-L435
23,533
gravitational/teleport
lib/services/authority.go
SetCheckingKeys
func (ca *CertAuthorityV2) SetCheckingKeys(keys [][]byte) error { ca.Spec.CheckingKeys = keys return nil }
go
func (ca *CertAuthorityV2) SetCheckingKeys(keys [][]byte) error { ca.Spec.CheckingKeys = keys return nil }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "SetCheckingKeys", "(", "keys", "[", "]", "[", "]", "byte", ")", "error", "{", "ca", ".", "Spec", ".", "CheckingKeys", "=", "keys", "\n", "return", "nil", "\n", "}" ]
// SetCheckingKeys sets SSH public keys
[ "SetCheckingKeys", "sets", "SSH", "public", "keys" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L438-L441
23,534
gravitational/teleport
lib/services/authority.go
GetID
func (ca *CertAuthorityV2) GetID() CertAuthID { return CertAuthID{Type: ca.Spec.Type, DomainName: ca.Metadata.Name} }
go
func (ca *CertAuthorityV2) GetID() CertAuthID { return CertAuthID{Type: ca.Spec.Type, DomainName: ca.Metadata.Name} }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "GetID", "(", ")", "CertAuthID", "{", "return", "CertAuthID", "{", "Type", ":", "ca", ".", "Spec", ".", "Type", ",", "DomainName", ":", "ca", ".", "Metadata", ".", "Name", "}", "\n", "}" ]
// GetID returns certificate authority ID - // combined type and name
[ "GetID", "returns", "certificate", "authority", "ID", "-", "combined", "type", "and", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L445-L447
23,535
gravitational/teleport
lib/services/authority.go
SetRoleMap
func (c *CertAuthorityV2) SetRoleMap(m RoleMap) { c.Spec.RoleMap = []RoleMapping(m) }
go
func (c *CertAuthorityV2) SetRoleMap(m RoleMap) { c.Spec.RoleMap = []RoleMapping(m) }
[ "func", "(", "c", "*", "CertAuthorityV2", ")", "SetRoleMap", "(", "m", "RoleMap", ")", "{", "c", ".", "Spec", ".", "RoleMap", "=", "[", "]", "RoleMapping", "(", "m", ")", "\n", "}" ]
// SetRoleMap sets role map
[ "SetRoleMap", "sets", "role", "map" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L500-L502
23,536
gravitational/teleport
lib/services/authority.go
FirstSigningKey
func (ca *CertAuthorityV2) FirstSigningKey() ([]byte, error) { if len(ca.Spec.SigningKeys) == 0 { return nil, trace.NotFound("%v has no signing keys", ca.Metadata.Name) } return ca.Spec.SigningKeys[0], nil }
go
func (ca *CertAuthorityV2) FirstSigningKey() ([]byte, error) { if len(ca.Spec.SigningKeys) == 0 { return nil, trace.NotFound("%v has no signing keys", ca.Metadata.Name) } return ca.Spec.SigningKeys[0], nil }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "FirstSigningKey", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "ca", ".", "Spec", ".", "SigningKeys", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "NotFound"...
// FirstSigningKey returns first signing key or returns error if it's not here
[ "FirstSigningKey", "returns", "first", "signing", "key", "or", "returns", "error", "if", "it", "s", "not", "here" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L505-L510
23,537
gravitational/teleport
lib/services/authority.go
Checkers
func (ca *CertAuthorityV2) Checkers() ([]ssh.PublicKey, error) { out := make([]ssh.PublicKey, 0, len(ca.Spec.CheckingKeys)) for _, keyBytes := range ca.Spec.CheckingKeys { key, _, _, _, err := ssh.ParseAuthorizedKey(keyBytes) if err != nil { return nil, trace.BadParameter("invalid authority public key (len=%d)...
go
func (ca *CertAuthorityV2) Checkers() ([]ssh.PublicKey, error) { out := make([]ssh.PublicKey, 0, len(ca.Spec.CheckingKeys)) for _, keyBytes := range ca.Spec.CheckingKeys { key, _, _, _, err := ssh.ParseAuthorizedKey(keyBytes) if err != nil { return nil, trace.BadParameter("invalid authority public key (len=%d)...
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "Checkers", "(", ")", "(", "[", "]", "ssh", ".", "PublicKey", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "ssh", ".", "PublicKey", ",", "0", ",", "len", "(", "ca", ".", "Spec", "."...
// Checkers returns public keys that can be used to check cert authorities
[ "Checkers", "returns", "public", "keys", "that", "can", "be", "used", "to", "check", "cert", "authorities" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L519-L529
23,538
gravitational/teleport
lib/services/authority.go
Signers
func (ca *CertAuthorityV2) Signers() ([]ssh.Signer, error) { out := make([]ssh.Signer, 0, len(ca.Spec.SigningKeys)) for _, keyBytes := range ca.Spec.SigningKeys { signer, err := ssh.ParsePrivateKey(keyBytes) if err != nil { return nil, trace.Wrap(err) } out = append(out, signer) } return out, nil }
go
func (ca *CertAuthorityV2) Signers() ([]ssh.Signer, error) { out := make([]ssh.Signer, 0, len(ca.Spec.SigningKeys)) for _, keyBytes := range ca.Spec.SigningKeys { signer, err := ssh.ParsePrivateKey(keyBytes) if err != nil { return nil, trace.Wrap(err) } out = append(out, signer) } return out, nil }
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "Signers", "(", ")", "(", "[", "]", "ssh", ".", "Signer", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "ssh", ".", "Signer", ",", "0", ",", "len", "(", "ca", ".", "Spec", ".", "Si...
// Signers returns a list of signers that could be used to sign keys
[ "Signers", "returns", "a", "list", "of", "signers", "that", "could", "be", "used", "to", "sign", "keys" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L532-L542
23,539
gravitational/teleport
lib/services/authority.go
Check
func (ca *CertAuthorityV2) Check() error { err := ca.ID().Check() if err != nil { return trace.Wrap(err) } _, err = ca.Checkers() if err != nil { return trace.Wrap(err) } _, err = ca.Signers() if err != nil { return trace.Wrap(err) } // This is to force users to migrate if len(ca.Spec.Roles) != 0 && le...
go
func (ca *CertAuthorityV2) Check() error { err := ca.ID().Check() if err != nil { return trace.Wrap(err) } _, err = ca.Checkers() if err != nil { return trace.Wrap(err) } _, err = ca.Signers() if err != nil { return trace.Wrap(err) } // This is to force users to migrate if len(ca.Spec.Roles) != 0 && le...
[ "func", "(", "ca", "*", "CertAuthorityV2", ")", "Check", "(", ")", "error", "{", "err", ":=", "ca", ".", "ID", "(", ")", ".", "Check", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", ...
// Check checks if all passed parameters are valid
[ "Check", "checks", "if", "all", "passed", "parameters", "are", "valid" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L545-L566
23,540
gravitational/teleport
lib/services/authority.go
RemoveCASecrets
func RemoveCASecrets(ca CertAuthority) { ca.SetSigningKeys(nil) keyPairs := ca.GetTLSKeyPairs() for i := range keyPairs { keyPairs[i].Key = nil } ca.SetTLSKeyPairs(keyPairs) }
go
func RemoveCASecrets(ca CertAuthority) { ca.SetSigningKeys(nil) keyPairs := ca.GetTLSKeyPairs() for i := range keyPairs { keyPairs[i].Key = nil } ca.SetTLSKeyPairs(keyPairs) }
[ "func", "RemoveCASecrets", "(", "ca", "CertAuthority", ")", "{", "ca", ".", "SetSigningKeys", "(", "nil", ")", "\n", "keyPairs", ":=", "ca", ".", "GetTLSKeyPairs", "(", ")", "\n", "for", "i", ":=", "range", "keyPairs", "{", "keyPairs", "[", "i", "]", "...
// RemoveCASecrets removes secret values and keys // from the certificate authority
[ "RemoveCASecrets", "removes", "secret", "values", "and", "keys", "from", "the", "certificate", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L585-L592
23,541
gravitational/teleport
lib/services/authority.go
Matches
func (s *Rotation) Matches(rotation Rotation) bool { return s.CurrentID == rotation.CurrentID && s.State == rotation.State && s.Phase == rotation.Phase }
go
func (s *Rotation) Matches(rotation Rotation) bool { return s.CurrentID == rotation.CurrentID && s.State == rotation.State && s.Phase == rotation.Phase }
[ "func", "(", "s", "*", "Rotation", ")", "Matches", "(", "rotation", "Rotation", ")", "bool", "{", "return", "s", ".", "CurrentID", "==", "rotation", ".", "CurrentID", "&&", "s", ".", "State", "==", "rotation", ".", "State", "&&", "s", ".", "Phase", "...
// Matches returns true if this state rotation matches // external rotation state, phase and rotation ID should match, // notice that matches does not behave like Equals because it does not require // all fields to be the same.
[ "Matches", "returns", "true", "if", "this", "state", "rotation", "matches", "external", "rotation", "state", "phase", "and", "rotation", "ID", "should", "match", "notice", "that", "matches", "does", "not", "behave", "like", "Equals", "because", "it", "does", "...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L641-L643
23,542
gravitational/teleport
lib/services/authority.go
LastRotatedDescription
func (r *Rotation) LastRotatedDescription() string { if r.LastRotated.IsZero() { return "never updated" } return fmt.Sprintf("last rotated %v", r.LastRotated.Format(teleport.HumanDateFormatSeconds)) }
go
func (r *Rotation) LastRotatedDescription() string { if r.LastRotated.IsZero() { return "never updated" } return fmt.Sprintf("last rotated %v", r.LastRotated.Format(teleport.HumanDateFormatSeconds)) }
[ "func", "(", "r", "*", "Rotation", ")", "LastRotatedDescription", "(", ")", "string", "{", "if", "r", ".", "LastRotated", ".", "IsZero", "(", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r...
// LastRotatedDescription returns human friendly description.
[ "LastRotatedDescription", "returns", "human", "friendly", "description", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L646-L651
23,543
gravitational/teleport
lib/services/authority.go
PhaseDescription
func (r *Rotation) PhaseDescription() string { switch r.Phase { case RotationPhaseInit: return "initialized" case RotationPhaseStandby, "": return "on standby" case RotationPhaseUpdateClients: return "rotating clients" case RotationPhaseUpdateServers: return "rotating servers" case RotationPhaseRollback: ...
go
func (r *Rotation) PhaseDescription() string { switch r.Phase { case RotationPhaseInit: return "initialized" case RotationPhaseStandby, "": return "on standby" case RotationPhaseUpdateClients: return "rotating clients" case RotationPhaseUpdateServers: return "rotating servers" case RotationPhaseRollback: ...
[ "func", "(", "r", "*", "Rotation", ")", "PhaseDescription", "(", ")", "string", "{", "switch", "r", ".", "Phase", "{", "case", "RotationPhaseInit", ":", "return", "\"", "\"", "\n", "case", "RotationPhaseStandby", ",", "\"", "\"", ":", "return", "\"", "\"...
// PhaseDescription returns human friendly description of a current rotation phase.
[ "PhaseDescription", "returns", "human", "friendly", "description", "of", "a", "current", "rotation", "phase", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L654-L669
23,544
gravitational/teleport
lib/services/authority.go
String
func (r *Rotation) String() string { switch r.State { case "", RotationStateStandby: if r.LastRotated.IsZero() { return "never updated" } return fmt.Sprintf("rotated %v", r.LastRotated.Format(teleport.HumanDateFormatSeconds)) case RotationStateInProgress: return fmt.Sprintf("%v (mode: %v, started: %v, end...
go
func (r *Rotation) String() string { switch r.State { case "", RotationStateStandby: if r.LastRotated.IsZero() { return "never updated" } return fmt.Sprintf("rotated %v", r.LastRotated.Format(teleport.HumanDateFormatSeconds)) case RotationStateInProgress: return fmt.Sprintf("%v (mode: %v, started: %v, end...
[ "func", "(", "r", "*", "Rotation", ")", "String", "(", ")", "string", "{", "switch", "r", ".", "State", "{", "case", "\"", "\"", ",", "RotationStateStandby", ":", "if", "r", ".", "LastRotated", ".", "IsZero", "(", ")", "{", "return", "\"", "\"", "\...
// String returns user friendly information about certificate authority.
[ "String", "returns", "user", "friendly", "information", "about", "certificate", "authority", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L672-L689
23,545
gravitational/teleport
lib/services/authority.go
CheckAndSetDefaults
func (r *Rotation) CheckAndSetDefaults(clock clockwork.Clock) error { switch r.Phase { case "", RotationPhaseRollback, RotationPhaseUpdateClients, RotationPhaseUpdateServers: default: return trace.BadParameter("unsupported phase: %q", r.Phase) } switch r.Mode { case "", RotationModeAuto, RotationModeManual: de...
go
func (r *Rotation) CheckAndSetDefaults(clock clockwork.Clock) error { switch r.Phase { case "", RotationPhaseRollback, RotationPhaseUpdateClients, RotationPhaseUpdateServers: default: return trace.BadParameter("unsupported phase: %q", r.Phase) } switch r.Mode { case "", RotationModeAuto, RotationModeManual: de...
[ "func", "(", "r", "*", "Rotation", ")", "CheckAndSetDefaults", "(", "clock", "clockwork", ".", "Clock", ")", "error", "{", "switch", "r", ".", "Phase", "{", "case", "\"", "\"", ",", "RotationPhaseRollback", ",", "RotationPhaseUpdateClients", ",", "RotationPhas...
// CheckAndSetDefaults checks and sets default rotation parameters.
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "rotation", "parameters", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L692-L720
23,546
gravitational/teleport
lib/services/authority.go
GenerateSchedule
func GenerateSchedule(clock clockwork.Clock, gracePeriod time.Duration) (*RotationSchedule, error) { if gracePeriod <= 0 { return nil, trace.BadParameter("invalid grace period %q, provide value > 0", gracePeriod) } return &RotationSchedule{ UpdateClients: clock.Now().UTC().Add(gracePeriod / 3).UTC(), UpdateSer...
go
func GenerateSchedule(clock clockwork.Clock, gracePeriod time.Duration) (*RotationSchedule, error) { if gracePeriod <= 0 { return nil, trace.BadParameter("invalid grace period %q, provide value > 0", gracePeriod) } return &RotationSchedule{ UpdateClients: clock.Now().UTC().Add(gracePeriod / 3).UTC(), UpdateSer...
[ "func", "GenerateSchedule", "(", "clock", "clockwork", ".", "Clock", ",", "gracePeriod", "time", ".", "Duration", ")", "(", "*", "RotationSchedule", ",", "error", ")", "{", "if", "gracePeriod", "<=", "0", "{", "return", "nil", ",", "trace", ".", "BadParame...
// GenerateSchedule generates schedule based on the time period, using // even time periods between rotation phases.
[ "GenerateSchedule", "generates", "schedule", "based", "on", "the", "time", "period", "using", "even", "time", "periods", "between", "rotation", "phases", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L724-L733
23,547
gravitational/teleport
lib/services/authority.go
CheckAndSetDefaults
func (s *RotationSchedule) CheckAndSetDefaults(clock clockwork.Clock) error { if s.UpdateServers.IsZero() { return trace.BadParameter("phase %q has no time switch scheduled", RotationPhaseUpdateServers) } if s.Standby.IsZero() { return trace.BadParameter("phase %q has no time switch scheduled", RotationPhaseStan...
go
func (s *RotationSchedule) CheckAndSetDefaults(clock clockwork.Clock) error { if s.UpdateServers.IsZero() { return trace.BadParameter("phase %q has no time switch scheduled", RotationPhaseUpdateServers) } if s.Standby.IsZero() { return trace.BadParameter("phase %q has no time switch scheduled", RotationPhaseStan...
[ "func", "(", "s", "*", "RotationSchedule", ")", "CheckAndSetDefaults", "(", "clock", "clockwork", ".", "Clock", ")", "error", "{", "if", "s", ".", "UpdateServers", ".", "IsZero", "(", ")", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ","...
// CheckAndSetDefaults checks and sets default values of the rotation schedule.
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "values", "of", "the", "rotation", "schedule", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L736-L753
23,548
gravitational/teleport
lib/services/authority.go
String
func (c *CertAuthorityV1) String() string { return fmt.Sprintf("CA(name=%v, type=%v)", c.DomainName, c.Type) }
go
func (c *CertAuthorityV1) String() string { return fmt.Sprintf("CA(name=%v, type=%v)", c.DomainName, c.Type) }
[ "func", "(", "c", "*", "CertAuthorityV1", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "DomainName", ",", "c", ".", "Type", ")", "\n", "}" ]
// String returns human readable version of the CertAuthorityV1.
[ "String", "returns", "human", "readable", "version", "of", "the", "CertAuthorityV1", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L878-L880
23,549
gravitational/teleport
lib/services/authority.go
GetCertAuthoritySchema
func GetCertAuthoritySchema() string { return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(CertAuthoritySpecV2Schema, RotationSchema, RoleMapSchema), DefaultDefinitions) }
go
func GetCertAuthoritySchema() string { return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(CertAuthoritySpecV2Schema, RotationSchema, RoleMapSchema), DefaultDefinitions) }
[ "func", "GetCertAuthoritySchema", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "V2SchemaTemplate", ",", "MetadataSchema", ",", "fmt", ".", "Sprintf", "(", "CertAuthoritySpecV2Schema", ",", "RotationSchema", ",", "RoleMapSchema", ")", ",", "Defaul...
// GetCertAuthoritySchema returns JSON Schema for cert authorities
[ "GetCertAuthoritySchema", "returns", "JSON", "Schema", "for", "cert", "authorities" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L912-L914
23,550
gravitational/teleport
lib/services/authority.go
UnmarshalCertAuthority
func (*TeleportCertAuthorityMarshaler) UnmarshalCertAuthority(bytes []byte, opts ...MarshalOption) (CertAuthority, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(bytes, &h) if err != nil { return nil, trace.Wrap(err) } s...
go
func (*TeleportCertAuthorityMarshaler) UnmarshalCertAuthority(bytes []byte, opts ...MarshalOption) (CertAuthority, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(bytes, &h) if err != nil { return nil, trace.Wrap(err) } s...
[ "func", "(", "*", "TeleportCertAuthorityMarshaler", ")", "UnmarshalCertAuthority", "(", "bytes", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "CertAuthority", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ...
// UnmarshalCertAuthority unmarshals cert authority from JSON
[ "UnmarshalCertAuthority", "unmarshals", "cert", "authority", "from", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L926-L965
23,551
gravitational/teleport
lib/services/authority.go
MarshalCertAuthority
func (*TeleportCertAuthorityMarshaler) MarshalCertAuthority(ca CertAuthority, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type cav1 interface { V1() *CertAuthorityV1 } type cav2 interface { V2() *CertAuthorityV2 } version := cfg....
go
func (*TeleportCertAuthorityMarshaler) MarshalCertAuthority(ca CertAuthority, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type cav1 interface { V1() *CertAuthorityV1 } type cav2 interface { V2() *CertAuthorityV2 } version := cfg....
[ "func", "(", "*", "TeleportCertAuthorityMarshaler", ")", "MarshalCertAuthority", "(", "ca", "CertAuthority", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")",...
// MarshalCertAuthority marshalls cert authority into JSON
[ "MarshalCertAuthority", "marshalls", "cert", "authority", "into", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/authority.go#L968-L1005
23,552
gravitational/teleport
lib/events/fields.go
UpdateEventFields
func UpdateEventFields(event Event, fields EventFields, clock clockwork.Clock, uid utils.UID) (err error) { additionalFields := make(map[string]interface{}) if fields.GetType() == "" { additionalFields[EventType] = event.Name } if fields.GetID() == "" { additionalFields[EventID] = uid.New() } if fields.GetTim...
go
func UpdateEventFields(event Event, fields EventFields, clock clockwork.Clock, uid utils.UID) (err error) { additionalFields := make(map[string]interface{}) if fields.GetType() == "" { additionalFields[EventType] = event.Name } if fields.GetID() == "" { additionalFields[EventID] = uid.New() } if fields.GetTim...
[ "func", "UpdateEventFields", "(", "event", "Event", ",", "fields", "EventFields", ",", "clock", "clockwork", ".", "Clock", ",", "uid", "utils", ".", "UID", ")", "(", "err", "error", ")", "{", "additionalFields", ":=", "make", "(", "map", "[", "string", "...
// UpdateEventFields updates passed event fields with additional information // common for all event types such as unique IDs, timestamps, codes, etc. // // This method is a "final stop" for various audit log implementations for // updating event fields before it gets persisted in the backend.
[ "UpdateEventFields", "updates", "passed", "event", "fields", "with", "additional", "information", "common", "for", "all", "event", "types", "such", "as", "unique", "IDs", "timestamps", "codes", "etc", ".", "This", "method", "is", "a", "final", "stop", "for", "...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/fields.go#L32-L50
23,553
gravitational/teleport
lib/reversetunnel/api.go
CheckAndSetDefaults
func (d *DialParams) CheckAndSetDefaults() error { if d.From == nil { return trace.BadParameter("parameter From required") } if d.To == nil { return trace.BadParameter("parameter To required") } return nil }
go
func (d *DialParams) CheckAndSetDefaults() error { if d.From == nil { return trace.BadParameter("parameter From required") } if d.To == nil { return trace.BadParameter("parameter To required") } return nil }
[ "func", "(", "d", "*", "DialParams", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "d", ".", "From", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "d", ".", "To", "==", "nil", "...
// CheckAndSetDefaults makes sure the minimal parameters are set.
[ "CheckAndSetDefaults", "makes", "sure", "the", "minimal", "parameters", "are", "set", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/api.go#L54-L63
23,554
gravitational/teleport
lib/services/trustedcluster.go
NewTrustedCluster
func NewTrustedCluster(name string, spec TrustedClusterSpecV2) (TrustedCluster, error) { return &TrustedClusterV2{ Kind: KindTrustedCluster, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, }, nil }
go
func NewTrustedCluster(name string, spec TrustedClusterSpecV2) (TrustedCluster, error) { return &TrustedClusterV2{ Kind: KindTrustedCluster, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, }, nil }
[ "func", "NewTrustedCluster", "(", "name", "string", ",", "spec", "TrustedClusterSpecV2", ")", "(", "TrustedCluster", ",", "error", ")", "{", "return", "&", "TrustedClusterV2", "{", "Kind", ":", "KindTrustedCluster", ",", "Version", ":", "V2", ",", "Metadata", ...
// NewTrustedCluster is a convenience wa to create a TrustedCluster resource.
[ "NewTrustedCluster", "is", "a", "convenience", "wa", "to", "create", "a", "TrustedCluster", "resource", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L71-L81
23,555
gravitational/teleport
lib/services/trustedcluster.go
Equals
func (r RoleMap) Equals(o RoleMap) bool { if len(r) != len(o) { return false } for i := range r { if !r[i].Equals(o[i]) { return false } } return true }
go
func (r RoleMap) Equals(o RoleMap) bool { if len(r) != len(o) { return false } for i := range r { if !r[i].Equals(o[i]) { return false } } return true }
[ "func", "(", "r", "RoleMap", ")", "Equals", "(", "o", "RoleMap", ")", "bool", "{", "if", "len", "(", "r", ")", "!=", "len", "(", "o", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ":=", "range", "r", "{", "if", "!", "r", "[", "i...
// Equals checks if the two role maps are equal.
[ "Equals", "checks", "if", "the", "two", "role", "maps", "are", "equal", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L131-L141
23,556
gravitational/teleport
lib/services/trustedcluster.go
String
func (r RoleMap) String() string { values, err := r.parse() if err != nil { return fmt.Sprintf("<failed to parse: %v", err) } if len(values) != 0 { return fmt.Sprintf("%v", values) } return "<empty>" }
go
func (r RoleMap) String() string { values, err := r.parse() if err != nil { return fmt.Sprintf("<failed to parse: %v", err) } if len(values) != 0 { return fmt.Sprintf("%v", values) } return "<empty>" }
[ "func", "(", "r", "RoleMap", ")", "String", "(", ")", "string", "{", "values", ",", "err", ":=", "r", ".", "parse", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "...
// String prints user friendly representation of role mapping
[ "String", "prints", "user", "friendly", "representation", "of", "role", "mapping" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L144-L153
23,557
gravitational/teleport
lib/services/trustedcluster.go
Map
func (r RoleMap) Map(remoteRoles []string) ([]string, error) { _, err := r.parse() if err != nil { return nil, trace.Wrap(err) } var outRoles []string // when no remote roles is specified, assume that // there is a single empty remote role (that should match wildcards) if len(remoteRoles) == 0 { remoteRoles ...
go
func (r RoleMap) Map(remoteRoles []string) ([]string, error) { _, err := r.parse() if err != nil { return nil, trace.Wrap(err) } var outRoles []string // when no remote roles is specified, assume that // there is a single empty remote role (that should match wildcards) if len(remoteRoles) == 0 { remoteRoles ...
[ "func", "(", "r", "RoleMap", ")", "Map", "(", "remoteRoles", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "_", ",", "err", ":=", "r", ".", "parse", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "...
// Map maps local roles to remote roles
[ "Map", "maps", "local", "roles", "to", "remote", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L187-L224
23,558
gravitational/teleport
lib/services/trustedcluster.go
Check
func (r RoleMap) Check() error { _, err := r.parse() return trace.Wrap(err) }
go
func (r RoleMap) Check() error { _, err := r.parse() return trace.Wrap(err) }
[ "func", "(", "r", "RoleMap", ")", "Check", "(", ")", "error", "{", "_", ",", "err", ":=", "r", ".", "parse", "(", ")", "\n", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}" ]
// Check checks RoleMap for errors
[ "Check", "checks", "RoleMap", "for", "errors" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L227-L230
23,559
gravitational/teleport
lib/services/trustedcluster.go
Equals
func (r RoleMapping) Equals(o RoleMapping) bool { if r.Remote != o.Remote { return false } if !utils.StringSlicesEqual(r.Local, r.Local) { return false } return true }
go
func (r RoleMapping) Equals(o RoleMapping) bool { if r.Remote != o.Remote { return false } if !utils.StringSlicesEqual(r.Local, r.Local) { return false } return true }
[ "func", "(", "r", "RoleMapping", ")", "Equals", "(", "o", "RoleMapping", ")", "bool", "{", "if", "r", ".", "Remote", "!=", "o", ".", "Remote", "{", "return", "false", "\n", "}", "\n", "if", "!", "utils", ".", "StringSlicesEqual", "(", "r", ".", "Lo...
// Equals checks if the two role mappings are equal.
[ "Equals", "checks", "if", "the", "two", "role", "mappings", "are", "equal", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L233-L241
23,560
gravitational/teleport
lib/services/trustedcluster.go
CanChangeStateTo
func (c *TrustedClusterV2) CanChangeStateTo(t TrustedCluster) error { if c.GetToken() != t.GetToken() { return trace.BadParameter("can not update token for existing trusted cluster") } if c.GetProxyAddress() != t.GetProxyAddress() { return trace.BadParameter("can not update proxy address for existing trusted clu...
go
func (c *TrustedClusterV2) CanChangeStateTo(t TrustedCluster) error { if c.GetToken() != t.GetToken() { return trace.BadParameter("can not update token for existing trusted cluster") } if c.GetProxyAddress() != t.GetProxyAddress() { return trace.BadParameter("can not update proxy address for existing trusted clu...
[ "func", "(", "c", "*", "TrustedClusterV2", ")", "CanChangeStateTo", "(", "t", "TrustedCluster", ")", "error", "{", "if", "c", ".", "GetToken", "(", ")", "!=", "t", ".", "GetToken", "(", ")", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"",...
// CanChangeState checks if the state change is allowed or not. If not, returns // an error explaining the reason.
[ "CanChangeState", "checks", "if", "the", "state", "change", "is", "allowed", "or", "not", ".", "If", "not", "returns", "an", "error", "explaining", "the", "reason", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L408-L433
23,561
gravitational/teleport
lib/services/trustedcluster.go
String
func (c *TrustedClusterV2) String() string { return fmt.Sprintf("TrustedCluster(Enabled=%v,Roles=%v,Token=%v,ProxyAddress=%v,ReverseTunnelAddress=%v)", c.Spec.Enabled, c.Spec.Roles, c.Spec.Token, c.Spec.ProxyAddress, c.Spec.ReverseTunnelAddress) }
go
func (c *TrustedClusterV2) String() string { return fmt.Sprintf("TrustedCluster(Enabled=%v,Roles=%v,Token=%v,ProxyAddress=%v,ReverseTunnelAddress=%v)", c.Spec.Enabled, c.Spec.Roles, c.Spec.Token, c.Spec.ProxyAddress, c.Spec.ReverseTunnelAddress) }
[ "func", "(", "c", "*", "TrustedClusterV2", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Spec", ".", "Enabled", ",", "c", ".", "Spec", ".", "Roles", ",", "c", ".", "Spec", ".", "Token", ...
// String represents a human readable version of trusted cluster settings.
[ "String", "represents", "a", "human", "readable", "version", "of", "trusted", "cluster", "settings", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L436-L439
23,562
gravitational/teleport
lib/services/trustedcluster.go
GetTrustedClusterSchema
func GetTrustedClusterSchema(extensionSchema string) string { var trustedClusterSchema string if extensionSchema == "" { trustedClusterSchema = fmt.Sprintf(TrustedClusterSpecSchemaTemplate, RoleMapSchema, "") } else { trustedClusterSchema = fmt.Sprintf(TrustedClusterSpecSchemaTemplate, RoleMapSchema, ","+extensi...
go
func GetTrustedClusterSchema(extensionSchema string) string { var trustedClusterSchema string if extensionSchema == "" { trustedClusterSchema = fmt.Sprintf(TrustedClusterSpecSchemaTemplate, RoleMapSchema, "") } else { trustedClusterSchema = fmt.Sprintf(TrustedClusterSpecSchemaTemplate, RoleMapSchema, ","+extensi...
[ "func", "GetTrustedClusterSchema", "(", "extensionSchema", "string", ")", "string", "{", "var", "trustedClusterSchema", "string", "\n", "if", "extensionSchema", "==", "\"", "\"", "{", "trustedClusterSchema", "=", "fmt", ".", "Sprintf", "(", "TrustedClusterSpecSchemaTe...
// GetTrustedClusterSchema returns the schema with optionally injected // schema for extensions.
[ "GetTrustedClusterSchema", "returns", "the", "schema", "with", "optionally", "injected", "schema", "for", "extensions", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L480-L488
23,563
gravitational/teleport
lib/services/trustedcluster.go
Less
func (s SortedTrustedCluster) Less(i, j int) bool { return s[i].GetName() < s[j].GetName() }
go
func (s SortedTrustedCluster) Less(i, j int) bool { return s[i].GetName() < s[j].GetName() }
[ "func", "(", "s", "SortedTrustedCluster", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "s", "[", "i", "]", ".", "GetName", "(", ")", "<", "s", "[", "j", "]", ".", "GetName", "(", ")", "\n", "}" ]
// Less compares items by name.
[ "Less", "compares", "items", "by", "name", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L579-L581
23,564
gravitational/teleport
lib/services/trustedcluster.go
Swap
func (s SortedTrustedCluster) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
go
func (s SortedTrustedCluster) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
[ "func", "(", "s", "SortedTrustedCluster", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "s", "[", "i", "]", ",", "s", "[", "j", "]", "=", "s", "[", "j", "]", ",", "s", "[", "i", "]", "\n", "}" ]
// Swap swaps two items in a list.
[ "Swap", "swaps", "two", "items", "in", "a", "list", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/trustedcluster.go#L584-L586
23,565
gravitational/teleport
lib/client/profile.go
Name
func (c *ClientProfile) Name() string { if c.ProxyHost != "" { return c.ProxyHost } addr, _, err := net.SplitHostPort(c.WebProxyAddr) if err != nil { return c.WebProxyAddr } return addr }
go
func (c *ClientProfile) Name() string { if c.ProxyHost != "" { return c.ProxyHost } addr, _, err := net.SplitHostPort(c.WebProxyAddr) if err != nil { return c.WebProxyAddr } return addr }
[ "func", "(", "c", "*", "ClientProfile", ")", "Name", "(", ")", "string", "{", "if", "c", ".", "ProxyHost", "!=", "\"", "\"", "{", "return", "c", ".", "ProxyHost", "\n", "}", "\n\n", "addr", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", ...
// Name returns the name of the profile.
[ "Name", "returns", "the", "name", "of", "the", "profile", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/profile.go#L72-L83
23,566
gravitational/teleport
lib/client/profile.go
UnlinkCurrentProfile
func UnlinkCurrentProfile() error { return trace.Wrap(os.Remove(filepath.Join(FullProfilePath(""), CurrentProfileSymlink))) }
go
func UnlinkCurrentProfile() error { return trace.Wrap(os.Remove(filepath.Join(FullProfilePath(""), CurrentProfileSymlink))) }
[ "func", "UnlinkCurrentProfile", "(", ")", "error", "{", "return", "trace", ".", "Wrap", "(", "os", ".", "Remove", "(", "filepath", ".", "Join", "(", "FullProfilePath", "(", "\"", "\"", ")", ",", "CurrentProfileSymlink", ")", ")", ")", "\n", "}" ]
// If there's a current profile symlink, remove it
[ "If", "there", "s", "a", "current", "profile", "symlink", "remove", "it" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/profile.go#L103-L105
23,567
gravitational/teleport
lib/client/profile.go
ProfileFromFile
func ProfileFromFile(filePath string) (*ClientProfile, error) { bytes, err := ioutil.ReadFile(filePath) if err != nil { return nil, trace.Wrap(err) } var cp *ClientProfile if err = yaml.Unmarshal(bytes, &cp); err != nil { return nil, trace.Wrap(err) } return cp, nil }
go
func ProfileFromFile(filePath string) (*ClientProfile, error) { bytes, err := ioutil.ReadFile(filePath) if err != nil { return nil, trace.Wrap(err) } var cp *ClientProfile if err = yaml.Unmarshal(bytes, &cp); err != nil { return nil, trace.Wrap(err) } return cp, nil }
[ "func", "ProfileFromFile", "(", "filePath", "string", ")", "(", "*", "ClientProfile", ",", "error", ")", "{", "bytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace"...
// ProfileFromFile loads the profile from a YAML file
[ "ProfileFromFile", "loads", "the", "profile", "from", "a", "YAML", "file" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/profile.go#L121-L131
23,568
gravitational/teleport
lib/client/profile.go
SaveTo
func (cp *ClientProfile) SaveTo(loc ProfileLocation) error { bytes, err := yaml.Marshal(&cp) if err != nil { return trace.Wrap(err) } if err = ioutil.WriteFile(loc.Path, bytes, 0660); err != nil { return trace.Wrap(err) } if loc.AliasPath != "" && filepath.Base(loc.AliasPath) != filepath.Base(loc.Path) { if...
go
func (cp *ClientProfile) SaveTo(loc ProfileLocation) error { bytes, err := yaml.Marshal(&cp) if err != nil { return trace.Wrap(err) } if err = ioutil.WriteFile(loc.Path, bytes, 0660); err != nil { return trace.Wrap(err) } if loc.AliasPath != "" && filepath.Base(loc.AliasPath) != filepath.Base(loc.Path) { if...
[ "func", "(", "cp", "*", "ClientProfile", ")", "SaveTo", "(", "loc", "ProfileLocation", ")", "error", "{", "bytes", ",", "err", ":=", "yaml", ".", "Marshal", "(", "&", "cp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "...
// SaveTo saves the profile into a given filename, optionally overwriting it.
[ "SaveTo", "saves", "the", "profile", "into", "a", "given", "filename", "optionally", "overwriting", "it", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/profile.go#L145-L171
23,569
gravitational/teleport
lib/auth/helpers.go
CreateUploaderDir
func CreateUploaderDir(dir string) error { err := os.MkdirAll(filepath.Join(dir, teleport.LogsDir, teleport.ComponentUpload, events.SessionLogsDir, defaults.Namespace), teleport.SharedDirMode) if err != nil { return trace.ConvertSystemError(err) } return nil }
go
func CreateUploaderDir(dir string) error { err := os.MkdirAll(filepath.Join(dir, teleport.LogsDir, teleport.ComponentUpload, events.SessionLogsDir, defaults.Namespace), teleport.SharedDirMode) if err != nil { return trace.ConvertSystemError(err) } return nil }
[ "func", "CreateUploaderDir", "(", "dir", "string", ")", "error", "{", "err", ":=", "os", ".", "MkdirAll", "(", "filepath", ".", "Join", "(", "dir", ",", "teleport", ".", "LogsDir", ",", "teleport", ".", "ComponentUpload", ",", "events", ".", "SessionLogsDi...
// CreateUploaderDir creates directory for file uploader service
[ "CreateUploaderDir", "creates", "directory", "for", "file", "uploader", "service" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L78-L86
23,570
gravitational/teleport
lib/auth/helpers.go
GenerateCertificate
func GenerateCertificate(authServer *AuthServer, identity TestIdentity) ([]byte, []byte, error) { switch id := identity.I.(type) { case LocalUser: user, err := authServer.GetUser(id.Username) if err != nil { return nil, nil, trace.Wrap(err) } roles, err := services.FetchRoles(user.GetRoles(), authServer, u...
go
func GenerateCertificate(authServer *AuthServer, identity TestIdentity) ([]byte, []byte, error) { switch id := identity.I.(type) { case LocalUser: user, err := authServer.GetUser(id.Username) if err != nil { return nil, nil, trace.Wrap(err) } roles, err := services.FetchRoles(user.GetRoles(), authServer, u...
[ "func", "GenerateCertificate", "(", "authServer", "*", "AuthServer", ",", "identity", "TestIdentity", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "switch", "id", ":=", "identity", ".", "I", ".", "(", "type", ")", "{", "...
// GenerateCertificate generates certificate for identity, // returns private public key pair
[ "GenerateCertificate", "generates", "certificate", "for", "identity", "returns", "private", "public", "key", "pair" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L251-L293
23,571
gravitational/teleport
lib/auth/helpers.go
NewCertificate
func (a *TestAuthServer) NewCertificate(identity TestIdentity) (*tls.Certificate, error) { cert, key, err := GenerateCertificate(a.AuthServer, identity) if err != nil { return nil, trace.Wrap(err) } tlsCert, err := tls.X509KeyPair(cert, key) if err != nil { return nil, trace.Wrap(err) } return &tlsCert, nil ...
go
func (a *TestAuthServer) NewCertificate(identity TestIdentity) (*tls.Certificate, error) { cert, key, err := GenerateCertificate(a.AuthServer, identity) if err != nil { return nil, trace.Wrap(err) } tlsCert, err := tls.X509KeyPair(cert, key) if err != nil { return nil, trace.Wrap(err) } return &tlsCert, nil ...
[ "func", "(", "a", "*", "TestAuthServer", ")", "NewCertificate", "(", "identity", "TestIdentity", ")", "(", "*", "tls", ".", "Certificate", ",", "error", ")", "{", "cert", ",", "key", ",", "err", ":=", "GenerateCertificate", "(", "a", ".", "AuthServer", "...
// NewCertificate returns new TLS credentials generated by test auth server
[ "NewCertificate", "returns", "new", "TLS", "credentials", "generated", "by", "test", "auth", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L296-L306
23,572
gravitational/teleport
lib/auth/helpers.go
Trust
func (a *TestAuthServer) Trust(remote *TestAuthServer, roleMap services.RoleMap) error { remoteCA, err := remote.AuthServer.GetCertAuthority(services.CertAuthID{ Type: services.HostCA, DomainName: remote.ClusterName, }, false) if err != nil { return trace.Wrap(err) } err = a.AuthServer.UpsertCertAuthor...
go
func (a *TestAuthServer) Trust(remote *TestAuthServer, roleMap services.RoleMap) error { remoteCA, err := remote.AuthServer.GetCertAuthority(services.CertAuthID{ Type: services.HostCA, DomainName: remote.ClusterName, }, false) if err != nil { return trace.Wrap(err) } err = a.AuthServer.UpsertCertAuthor...
[ "func", "(", "a", "*", "TestAuthServer", ")", "Trust", "(", "remote", "*", "TestAuthServer", ",", "roleMap", "services", ".", "RoleMap", ")", "error", "{", "remoteCA", ",", "err", ":=", "remote", ".", "AuthServer", ".", "GetCertAuthority", "(", "services", ...
// Trust adds other server host certificate authority as trusted
[ "Trust", "adds", "other", "server", "host", "certificate", "authority", "as", "trusted" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L314-L339
23,573
gravitational/teleport
lib/auth/helpers.go
NewRemoteClient
func (a *TestAuthServer) NewRemoteClient(identity TestIdentity, addr net.Addr, pool *x509.CertPool) (*Client, error) { tlsConfig := utils.TLSConfig(a.CipherSuites) cert, err := a.NewCertificate(identity) if err != nil { return nil, trace.Wrap(err) } tlsConfig.Certificates = []tls.Certificate{*cert} tlsConfig.Ro...
go
func (a *TestAuthServer) NewRemoteClient(identity TestIdentity, addr net.Addr, pool *x509.CertPool) (*Client, error) { tlsConfig := utils.TLSConfig(a.CipherSuites) cert, err := a.NewCertificate(identity) if err != nil { return nil, trace.Wrap(err) } tlsConfig.Certificates = []tls.Certificate{*cert} tlsConfig.Ro...
[ "func", "(", "a", "*", "TestAuthServer", ")", "NewRemoteClient", "(", "identity", "TestIdentity", ",", "addr", "net", ".", "Addr", ",", "pool", "*", "x509", ".", "CertPool", ")", "(", "*", "Client", ",", "error", ")", "{", "tlsConfig", ":=", "utils", "...
// NewRemoteClient creates new client to the remote server using identity // generated for this certificate authority
[ "NewRemoteClient", "creates", "new", "client", "to", "the", "remote", "server", "using", "identity", "generated", "for", "this", "certificate", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L362-L374
23,574
gravitational/teleport
lib/auth/helpers.go
CheckAndSetDefaults
func (cfg *TestTLSServerConfig) CheckAndSetDefaults() error { if cfg.APIConfig == nil { return trace.BadParameter("missing parameter APIConfig") } if cfg.AuthServer == nil { return trace.BadParameter("missing parameter AuthServer") } // use very permissive limiter configuration by default if cfg.Limiter == ni...
go
func (cfg *TestTLSServerConfig) CheckAndSetDefaults() error { if cfg.APIConfig == nil { return trace.BadParameter("missing parameter APIConfig") } if cfg.AuthServer == nil { return trace.BadParameter("missing parameter AuthServer") } // use very permissive limiter configuration by default if cfg.Limiter == ni...
[ "func", "(", "cfg", "*", "TestTLSServerConfig", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "cfg", ".", "APIConfig", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "cfg", ".", "AuthS...
// CheckAndSetDefaults checks and sets limiter defaults
[ "CheckAndSetDefaults", "checks", "and", "sets", "limiter", "defaults" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L416-L431
23,575
gravitational/teleport
lib/auth/helpers.go
NewClientFromWebSession
func (t *TestTLSServer) NewClientFromWebSession(sess services.WebSession) (*Client, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } tlsCert, err := tls.X509KeyPair(sess.GetTLSCert(), sess.GetPriv()) if err != nil { return nil, trace.Wrap(...
go
func (t *TestTLSServer) NewClientFromWebSession(sess services.WebSession) (*Client, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } tlsCert, err := tls.X509KeyPair(sess.GetTLSCert(), sess.GetPriv()) if err != nil { return nil, trace.Wrap(...
[ "func", "(", "t", "*", "TestTLSServer", ")", "NewClientFromWebSession", "(", "sess", "services", ".", "WebSession", ")", "(", "*", "Client", ",", "error", ")", "{", "tlsConfig", ",", "err", ":=", "t", ".", "Identity", ".", "TLSConfig", "(", "t", ".", "...
// NewClientFromWebSession returns new authenticated client from web session
[ "NewClientFromWebSession", "returns", "new", "authenticated", "client", "from", "web", "session" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L513-L525
23,576
gravitational/teleport
lib/auth/helpers.go
CertPool
func (t *TestTLSServer) CertPool() (*x509.CertPool, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } return tlsConfig.RootCAs, nil }
go
func (t *TestTLSServer) CertPool() (*x509.CertPool, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } return tlsConfig.RootCAs, nil }
[ "func", "(", "t", "*", "TestTLSServer", ")", "CertPool", "(", ")", "(", "*", "x509", ".", "CertPool", ",", "error", ")", "{", "tlsConfig", ",", "err", ":=", "t", ".", "Identity", ".", "TLSConfig", "(", "t", ".", "AuthServer", ".", "CipherSuites", ")"...
// CertPool returns cert pool that auth server represents
[ "CertPool", "returns", "cert", "pool", "that", "auth", "server", "represents" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L528-L534
23,577
gravitational/teleport
lib/auth/helpers.go
ClientTLSConfig
func (t *TestTLSServer) ClientTLSConfig(identity TestIdentity) (*tls.Config, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } if identity.I != nil { cert, err := t.AuthServer.NewCertificate(identity) if err != nil { return nil, trace.W...
go
func (t *TestTLSServer) ClientTLSConfig(identity TestIdentity) (*tls.Config, error) { tlsConfig, err := t.Identity.TLSConfig(t.AuthServer.CipherSuites) if err != nil { return nil, trace.Wrap(err) } if identity.I != nil { cert, err := t.AuthServer.NewCertificate(identity) if err != nil { return nil, trace.W...
[ "func", "(", "t", "*", "TestTLSServer", ")", "ClientTLSConfig", "(", "identity", "TestIdentity", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "tlsConfig", ",", "err", ":=", "t", ".", "Identity", ".", "TLSConfig", "(", "t", ".", "AuthSer...
// ClientTLSConfig returns client TLS config based on the identity
[ "ClientTLSConfig", "returns", "client", "TLS", "config", "based", "on", "the", "identity" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L537-L554
23,578
gravitational/teleport
lib/auth/helpers.go
CloneClient
func (t *TestTLSServer) CloneClient(clt *Client) *Client { addr := []utils.NetAddr{{Addr: t.Addr().String(), AddrNetwork: t.Addr().Network()}} newClient, err := NewTLSClient(ClientConfig{Addrs: addr, TLS: clt.TLSConfig()}) if err != nil { panic(err) } return newClient }
go
func (t *TestTLSServer) CloneClient(clt *Client) *Client { addr := []utils.NetAddr{{Addr: t.Addr().String(), AddrNetwork: t.Addr().Network()}} newClient, err := NewTLSClient(ClientConfig{Addrs: addr, TLS: clt.TLSConfig()}) if err != nil { panic(err) } return newClient }
[ "func", "(", "t", "*", "TestTLSServer", ")", "CloneClient", "(", "clt", "*", "Client", ")", "*", "Client", "{", "addr", ":=", "[", "]", "utils", ".", "NetAddr", "{", "{", "Addr", ":", "t", ".", "Addr", "(", ")", ".", "String", "(", ")", ",", "A...
// CloneClient uses the same credentials as the passed client // but forces the client to be recreated
[ "CloneClient", "uses", "the", "same", "credentials", "as", "the", "passed", "client", "but", "forces", "the", "client", "to", "be", "recreated" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L558-L565
23,579
gravitational/teleport
lib/auth/helpers.go
NewClient
func (t *TestTLSServer) NewClient(identity TestIdentity) (*Client, error) { tlsConfig, err := t.ClientTLSConfig(identity) if err != nil { return nil, trace.Wrap(err) } addrs := []utils.NetAddr{utils.FromAddr(t.Listener.Addr())} return NewTLSClient(ClientConfig{Addrs: addrs, TLS: tlsConfig}) }
go
func (t *TestTLSServer) NewClient(identity TestIdentity) (*Client, error) { tlsConfig, err := t.ClientTLSConfig(identity) if err != nil { return nil, trace.Wrap(err) } addrs := []utils.NetAddr{utils.FromAddr(t.Listener.Addr())} return NewTLSClient(ClientConfig{Addrs: addrs, TLS: tlsConfig}) }
[ "func", "(", "t", "*", "TestTLSServer", ")", "NewClient", "(", "identity", "TestIdentity", ")", "(", "*", "Client", ",", "error", ")", "{", "tlsConfig", ",", "err", ":=", "t", ".", "ClientTLSConfig", "(", "identity", ")", "\n", "if", "err", "!=", "nil"...
// NewClient returns new client to test server authenticated with identity
[ "NewClient", "returns", "new", "client", "to", "test", "server", "authenticated", "with", "identity" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L568-L575
23,580
gravitational/teleport
lib/auth/helpers.go
Start
func (t *TestTLSServer) Start() error { var err error if t.Listener == nil { t.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { return trace.Wrap(err) } } go t.TLSServer.Serve(t.Listener) return nil }
go
func (t *TestTLSServer) Start() error { var err error if t.Listener == nil { t.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { return trace.Wrap(err) } } go t.TLSServer.Serve(t.Listener) return nil }
[ "func", "(", "t", "*", "TestTLSServer", ")", "Start", "(", ")", "error", "{", "var", "err", "error", "\n", "if", "t", ".", "Listener", "==", "nil", "{", "t", ".", "Listener", ",", "err", "=", "net", ".", "Listen", "(", "\"", "\"", ",", "\"", "\...
// Start starts TLS server on loopback address on the first lisenting socket
[ "Start", "starts", "TLS", "server", "on", "loopback", "address", "on", "the", "first", "lisenting", "socket" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L583-L593
23,581
gravitational/teleport
lib/auth/helpers.go
Close
func (t *TestTLSServer) Close() error { err := t.TLSServer.Close() if t.Listener != nil { t.Listener.Close() } if t.AuthServer.Backend != nil { t.AuthServer.Backend.Close() } return err }
go
func (t *TestTLSServer) Close() error { err := t.TLSServer.Close() if t.Listener != nil { t.Listener.Close() } if t.AuthServer.Backend != nil { t.AuthServer.Backend.Close() } return err }
[ "func", "(", "t", "*", "TestTLSServer", ")", "Close", "(", ")", "error", "{", "err", ":=", "t", ".", "TLSServer", ".", "Close", "(", ")", "\n", "if", "t", ".", "Listener", "!=", "nil", "{", "t", ".", "Listener", ".", "Close", "(", ")", "\n", "}...
// Close closes the listener and HTTP server
[ "Close", "closes", "the", "listener", "and", "HTTP", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L596-L605
23,582
gravitational/teleport
lib/auth/helpers.go
Stop
func (t *TestTLSServer) Stop() error { err := t.TLSServer.Close() if t.Listener != nil { t.Listener.Close() } return err }
go
func (t *TestTLSServer) Stop() error { err := t.TLSServer.Close() if t.Listener != nil { t.Listener.Close() } return err }
[ "func", "(", "t", "*", "TestTLSServer", ")", "Stop", "(", ")", "error", "{", "err", ":=", "t", ".", "TLSServer", ".", "Close", "(", ")", "\n", "if", "t", ".", "Listener", "!=", "nil", "{", "t", ".", "Listener", ".", "Close", "(", ")", "\n", "}"...
// Stop stops listening server, but does not close the auth backend
[ "Stop", "stops", "listening", "server", "but", "does", "not", "close", "the", "auth", "backend" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L608-L614
23,583
gravitational/teleport
lib/auth/helpers.go
NewServerIdentity
func NewServerIdentity(clt *AuthServer, hostID string, role teleport.Role) (*Identity, error) { keys, err := clt.GenerateServerKeys(GenerateServerKeysRequest{ HostID: hostID, NodeName: hostID, Roles: teleport.Roles{teleport.RoleAuth}, }) if err != nil { return nil, trace.Wrap(err) } return ReadIdentit...
go
func NewServerIdentity(clt *AuthServer, hostID string, role teleport.Role) (*Identity, error) { keys, err := clt.GenerateServerKeys(GenerateServerKeysRequest{ HostID: hostID, NodeName: hostID, Roles: teleport.Roles{teleport.RoleAuth}, }) if err != nil { return nil, trace.Wrap(err) } return ReadIdentit...
[ "func", "NewServerIdentity", "(", "clt", "*", "AuthServer", ",", "hostID", "string", ",", "role", "teleport", ".", "Role", ")", "(", "*", "Identity", ",", "error", ")", "{", "keys", ",", "err", ":=", "clt", ".", "GenerateServerKeys", "(", "GenerateServerKe...
// NewServerIdentity generates new server identity, used in tests
[ "NewServerIdentity", "generates", "new", "server", "identity", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L617-L627
23,584
gravitational/teleport
lib/auth/helpers.go
CreateUserAndRole
func CreateUserAndRole(clt clt, username string, allowedLogins []string) (services.User, services.Role, error) { user, err := services.NewUser(username) if err != nil { return nil, nil, trace.Wrap(err) } role := services.RoleForUser(user) role.SetLogins(services.Allow, []string{user.GetName()}) err = clt.Upsert...
go
func CreateUserAndRole(clt clt, username string, allowedLogins []string) (services.User, services.Role, error) { user, err := services.NewUser(username) if err != nil { return nil, nil, trace.Wrap(err) } role := services.RoleForUser(user) role.SetLogins(services.Allow, []string{user.GetName()}) err = clt.Upsert...
[ "func", "CreateUserAndRole", "(", "clt", "clt", ",", "username", "string", ",", "allowedLogins", "[", "]", "string", ")", "(", "services", ".", "User", ",", "services", ".", "Role", ",", "error", ")", "{", "user", ",", "err", ":=", "services", ".", "Ne...
// CreateUserAndRole creates user and role and assignes role to a user, used in tests
[ "CreateUserAndRole", "creates", "user", "and", "role", "and", "assignes", "role", "to", "a", "user", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L637-L654
23,585
gravitational/teleport
lib/auth/helpers.go
CreateUserAndRoleWithoutRoles
func CreateUserAndRoleWithoutRoles(clt clt, username string, allowedLogins []string) (services.User, services.Role, error) { user, err := services.NewUser(username) if err != nil { return nil, nil, trace.Wrap(err) } role := services.RoleForUser(user) set := services.MakeRuleSet(role.GetRules(services.Allow)) d...
go
func CreateUserAndRoleWithoutRoles(clt clt, username string, allowedLogins []string) (services.User, services.Role, error) { user, err := services.NewUser(username) if err != nil { return nil, nil, trace.Wrap(err) } role := services.RoleForUser(user) set := services.MakeRuleSet(role.GetRules(services.Allow)) d...
[ "func", "CreateUserAndRoleWithoutRoles", "(", "clt", "clt", ",", "username", "string", ",", "allowedLogins", "[", "]", "string", ")", "(", "services", ".", "User", ",", "services", ".", "Role", ",", "error", ")", "{", "user", ",", "err", ":=", "services", ...
// CreateUserAndRoleWithoutRoles creates user and role, but does not assign user to a role, used in tests
[ "CreateUserAndRoleWithoutRoles", "creates", "user", "and", "role", "but", "does", "not", "assign", "user", "to", "a", "role", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/helpers.go#L657-L680
23,586
gravitational/teleport
lib/events/uploader.go
CheckAndSetDefaults
func (cfg *UploaderConfig) CheckAndSetDefaults() error { if cfg.ServerID == "" { return trace.BadParameter("missing parameter ServerID") } if cfg.AuditLog == nil { return trace.BadParameter("missing parameter AuditLog") } if cfg.DataDir == "" { return trace.BadParameter("missing parameter DataDir") } if cf...
go
func (cfg *UploaderConfig) CheckAndSetDefaults() error { if cfg.ServerID == "" { return trace.BadParameter("missing parameter ServerID") } if cfg.AuditLog == nil { return trace.BadParameter("missing parameter AuditLog") } if cfg.DataDir == "" { return trace.BadParameter("missing parameter DataDir") } if cf...
[ "func", "(", "cfg", "*", "UploaderConfig", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "cfg", ".", "ServerID", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "cfg", ".", "Audi...
// CheckAndSetDefaults checks and sets default values of UploaderConfig
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "values", "of", "UploaderConfig" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/uploader.go#L80-L106
23,587
gravitational/teleport
lib/events/uploader.go
NewUploader
func NewUploader(cfg UploaderConfig) (*Uploader, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } ctx, cancel := context.WithCancel(cfg.Context) uploader := &Uploader{ UploaderConfig: cfg, Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentAuditLog...
go
func NewUploader(cfg UploaderConfig) (*Uploader, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } ctx, cancel := context.WithCancel(cfg.Context) uploader := &Uploader{ UploaderConfig: cfg, Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentAuditLog...
[ "func", "NewUploader", "(", "cfg", "UploaderConfig", ")", "(", "*", "Uploader", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "er...
// NewUploader creates new disk based session logger
[ "NewUploader", "creates", "new", "disk", "based", "session", "logger" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/uploader.go#L109-L126
23,588
gravitational/teleport
lib/events/uploader.go
Scan
func (u *Uploader) Scan() error { df, err := os.Open(u.scanDir) err = trace.ConvertSystemError(err) if err != nil { return trace.Wrap(err) } defer df.Close() entries, err := df.Readdir(-1) if err != nil { return trace.ConvertSystemError(err) } var count int for i := range entries { fi := entries[i] if...
go
func (u *Uploader) Scan() error { df, err := os.Open(u.scanDir) err = trace.ConvertSystemError(err) if err != nil { return trace.Wrap(err) } defer df.Close() entries, err := df.Readdir(-1) if err != nil { return trace.ConvertSystemError(err) } var count int for i := range entries { fi := entries[i] if...
[ "func", "(", "u", "*", "Uploader", ")", "Scan", "(", ")", "error", "{", "df", ",", "err", ":=", "os", ".", "Open", "(", "u", ".", "scanDir", ")", "\n", "err", "=", "trace", ".", "ConvertSystemError", "(", "err", ")", "\n", "if", "err", "!=", "n...
// Scan scans the directory and uploads recordings
[ "Scan", "scans", "the", "directory", "and", "uploads", "recordings" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/uploader.go#L272-L309
23,589
gravitational/teleport
lib/client/api.go
MakeDefaultConfig
func MakeDefaultConfig() *Config { return &Config{ Stdout: os.Stdout, Stderr: os.Stderr, Stdin: os.Stdin, } }
go
func MakeDefaultConfig() *Config { return &Config{ Stdout: os.Stdout, Stderr: os.Stderr, Stdin: os.Stdin, } }
[ "func", "MakeDefaultConfig", "(", ")", "*", "Config", "{", "return", "&", "Config", "{", "Stdout", ":", "os", ".", "Stdout", ",", "Stderr", ":", "os", ".", "Stderr", ",", "Stdin", ":", "os", ".", "Stdin", ",", "}", "\n", "}" ]
// MakeDefaultConfig returns default client config
[ "MakeDefaultConfig", "returns", "default", "client", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L255-L261
23,590
gravitational/teleport
lib/client/api.go
IsExpired
func (p *ProfileStatus) IsExpired(clock clockwork.Clock) bool { return p.ValidUntil.Sub(clock.Now()) <= 0 }
go
func (p *ProfileStatus) IsExpired(clock clockwork.Clock) bool { return p.ValidUntil.Sub(clock.Now()) <= 0 }
[ "func", "(", "p", "*", "ProfileStatus", ")", "IsExpired", "(", "clock", "clockwork", ".", "Clock", ")", "bool", "{", "return", "p", ".", "ValidUntil", ".", "Sub", "(", "clock", ".", "Now", "(", ")", ")", "<=", "0", "\n", "}" ]
// IsExpired returns true if profile is not expired yet
[ "IsExpired", "returns", "true", "if", "profile", "is", "not", "expired", "yet" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L289-L291
23,591
gravitational/teleport
lib/client/api.go
RetryWithRelogin
func RetryWithRelogin(ctx context.Context, tc *TeleportClient, fn func() error) error { err := fn() if err == nil { return nil } // Assume that failed handshake is a result of expired credentials, // retry the login procedure if !utils.IsHandshakeFailedError(err) && !utils.IsCertExpiredError(err) && !trace.IsBa...
go
func RetryWithRelogin(ctx context.Context, tc *TeleportClient, fn func() error) error { err := fn() if err == nil { return nil } // Assume that failed handshake is a result of expired credentials, // retry the login procedure if !utils.IsHandshakeFailedError(err) && !utils.IsCertExpiredError(err) && !trace.IsBa...
[ "func", "RetryWithRelogin", "(", "ctx", "context", ".", "Context", ",", "tc", "*", "TeleportClient", ",", "fn", "func", "(", ")", "error", ")", "error", "{", "err", ":=", "fn", "(", ")", "\n", "if", "err", "==", "nil", "{", "return", "nil", "\n", "...
// RetryWithRelogin is a helper error handling method, // attempts to relogin and retry the function once
[ "RetryWithRelogin", "is", "a", "helper", "error", "handling", "method", "attempts", "to", "relogin", "and", "retry", "the", "function", "once" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L295-L327
23,592
gravitational/teleport
lib/client/api.go
fullProfileName
func fullProfileName(profileDir string, proxyHost string) (string, error) { var err error var profileName string // If no profile name was passed in, try and extract the active profile from // the ~/.tsh/profile symlink. If one was passed in, append .yaml to name. if proxyHost == "" { profileName, err = os.Read...
go
func fullProfileName(profileDir string, proxyHost string) (string, error) { var err error var profileName string // If no profile name was passed in, try and extract the active profile from // the ~/.tsh/profile symlink. If one was passed in, append .yaml to name. if proxyHost == "" { profileName, err = os.Read...
[ "func", "fullProfileName", "(", "profileDir", "string", ",", "proxyHost", "string", ")", "(", "string", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "profileName", "string", "\n\n", "// If no profile name was passed in, try and extract the active profile ...
// fullProfileName takes a profile directory and the host the user is trying // to connect to and returns the name of the profile file.
[ "fullProfileName", "takes", "a", "profile", "directory", "and", "the", "host", "the", "user", "is", "trying", "to", "connect", "to", "and", "returns", "the", "name", "of", "the", "profile", "file", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L401-L423
23,593
gravitational/teleport
lib/client/api.go
Status
func Status(profileDir string, proxyHost string) (*ProfileStatus, []*ProfileStatus, error) { var err error var profile *ProfileStatus var others []*ProfileStatus // remove ports from proxy host, because profile name is stored // by host name if proxyHost != "" { proxyHost, err = utils.Host(proxyHost) if err ...
go
func Status(profileDir string, proxyHost string) (*ProfileStatus, []*ProfileStatus, error) { var err error var profile *ProfileStatus var others []*ProfileStatus // remove ports from proxy host, because profile name is stored // by host name if proxyHost != "" { proxyHost, err = utils.Host(proxyHost) if err ...
[ "func", "Status", "(", "profileDir", "string", ",", "proxyHost", "string", ")", "(", "*", "ProfileStatus", ",", "[", "]", "*", "ProfileStatus", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "profile", "*", "ProfileStatus", "\n", "var", "oth...
// Status returns the active profile as well as a list of available profiles.
[ "Status", "returns", "the", "active", "profile", "as", "well", "as", "a", "list", "of", "available", "profiles", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L426-L506
23,594
gravitational/teleport
lib/client/api.go
KubeProxyHostPort
func (c *Config) KubeProxyHostPort() (string, int) { if c.KubeProxyAddr != "" { addr, err := utils.ParseAddr(c.KubeProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.KubeProxyListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.KubeProxyListenPort }
go
func (c *Config) KubeProxyHostPort() (string, int) { if c.KubeProxyAddr != "" { addr, err := utils.ParseAddr(c.KubeProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.KubeProxyListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.KubeProxyListenPort }
[ "func", "(", "c", "*", "Config", ")", "KubeProxyHostPort", "(", ")", "(", "string", ",", "int", ")", "{", "if", "c", ".", "KubeProxyAddr", "!=", "\"", "\"", "{", "addr", ",", "err", ":=", "utils", ".", "ParseAddr", "(", "c", ".", "KubeProxyAddr", "...
// KubeProxyHostPort returns the host and port of the Kubernetes proxy.
[ "KubeProxyHostPort", "returns", "the", "host", "and", "port", "of", "the", "Kubernetes", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L656-L666
23,595
gravitational/teleport
lib/client/api.go
WebProxyHostPort
func (c *Config) WebProxyHostPort() (string, int) { if c.WebProxyAddr != "" { addr, err := utils.ParseAddr(c.WebProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.HTTPListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.HTTPListenPort }
go
func (c *Config) WebProxyHostPort() (string, int) { if c.WebProxyAddr != "" { addr, err := utils.ParseAddr(c.WebProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.HTTPListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.HTTPListenPort }
[ "func", "(", "c", "*", "Config", ")", "WebProxyHostPort", "(", ")", "(", "string", ",", "int", ")", "{", "if", "c", ".", "WebProxyAddr", "!=", "\"", "\"", "{", "addr", ",", "err", ":=", "utils", ".", "ParseAddr", "(", "c", ".", "WebProxyAddr", ")",...
// WebProxyHostPort returns the host and port of the web proxy.
[ "WebProxyHostPort", "returns", "the", "host", "and", "port", "of", "the", "web", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L669-L679
23,596
gravitational/teleport
lib/client/api.go
SSHProxyHostPort
func (c *Config) SSHProxyHostPort() (string, int) { if c.SSHProxyAddr != "" { addr, err := utils.ParseAddr(c.SSHProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.SSHProxyListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.SSHProxyListenPort }
go
func (c *Config) SSHProxyHostPort() (string, int) { if c.SSHProxyAddr != "" { addr, err := utils.ParseAddr(c.SSHProxyAddr) if err == nil { return addr.Host(), addr.Port(defaults.SSHProxyListenPort) } } webProxyHost, _ := c.WebProxyHostPort() return webProxyHost, defaults.SSHProxyListenPort }
[ "func", "(", "c", "*", "Config", ")", "SSHProxyHostPort", "(", ")", "(", "string", ",", "int", ")", "{", "if", "c", ".", "SSHProxyAddr", "!=", "\"", "\"", "{", "addr", ",", "err", ":=", "utils", ".", "ParseAddr", "(", "c", ".", "SSHProxyAddr", ")",...
// SSHProxyHostPort returns the host and port of the SSH proxy.
[ "SSHProxyHostPort", "returns", "the", "host", "and", "port", "of", "the", "SSH", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L682-L692
23,597
gravitational/teleport
lib/client/api.go
NewClient
func NewClient(c *Config) (tc *TeleportClient, err error) { // validate configuration if c.Username == "" { c.Username, err = Username() if err != nil { return nil, trace.Wrap(err) } log.Infof("No teleport login given. defaulting to %s", c.Username) } if c.WebProxyAddr == "" { return nil, trace.BadPara...
go
func NewClient(c *Config) (tc *TeleportClient, err error) { // validate configuration if c.Username == "" { c.Username, err = Username() if err != nil { return nil, trace.Wrap(err) } log.Infof("No teleport login given. defaulting to %s", c.Username) } if c.WebProxyAddr == "" { return nil, trace.BadPara...
[ "func", "NewClient", "(", "c", "*", "Config", ")", "(", "tc", "*", "TeleportClient", ",", "err", "error", ")", "{", "// validate configuration", "if", "c", ".", "Username", "==", "\"", "\"", "{", "c", ".", "Username", ",", "err", "=", "Username", "(", ...
// NewClient creates a TeleportClient object and fully configures it
[ "NewClient", "creates", "a", "TeleportClient", "object", "and", "fully", "configures", "it" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L735-L810
23,598
gravitational/teleport
lib/client/api.go
accessPoint
func (tc *TeleportClient) accessPoint(clt auth.AccessPoint, proxyHostPort string, clusterName string) (auth.AccessPoint, error) { // If no caching policy was set or on Windows (where Teleport does not // support file locking at the moment), return direct access to the access // point. if tc.CachePolicy == nil || ru...
go
func (tc *TeleportClient) accessPoint(clt auth.AccessPoint, proxyHostPort string, clusterName string) (auth.AccessPoint, error) { // If no caching policy was set or on Windows (where Teleport does not // support file locking at the moment), return direct access to the access // point. if tc.CachePolicy == nil || ru...
[ "func", "(", "tc", "*", "TeleportClient", ")", "accessPoint", "(", "clt", "auth", ".", "AccessPoint", ",", "proxyHostPort", "string", ",", "clusterName", "string", ")", "(", "auth", ".", "AccessPoint", ",", "error", ")", "{", "// If no caching policy was set or ...
// accessPoint returns access point based on the cache policy
[ "accessPoint", "returns", "access", "point", "based", "on", "the", "cache", "policy" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L813-L822
23,599
gravitational/teleport
lib/client/api.go
getTargetNodes
func (tc *TeleportClient) getTargetNodes(ctx context.Context, proxy *ProxyClient) ([]string, error) { var ( err error nodes []services.Server retval = make([]string, 0) ) if tc.Labels != nil && len(tc.Labels) > 0 { nodes, err = proxy.FindServersByLabels(ctx, tc.Namespace, tc.Labels) if err != nil { ...
go
func (tc *TeleportClient) getTargetNodes(ctx context.Context, proxy *ProxyClient) ([]string, error) { var ( err error nodes []services.Server retval = make([]string, 0) ) if tc.Labels != nil && len(tc.Labels) > 0 { nodes, err = proxy.FindServersByLabels(ctx, tc.Namespace, tc.Labels) if err != nil { ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "getTargetNodes", "(", "ctx", "context", ".", "Context", ",", "proxy", "*", "ProxyClient", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "nodes", "[", "]", "serv...
// getTargetNodes returns a list of node addresses this SSH command needs to // operate on.
[ "getTargetNodes", "returns", "a", "list", "of", "node", "addresses", "this", "SSH", "command", "needs", "to", "operate", "on", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L830-L849