MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / StartServer

Function StartServer

pkg/api/server_windows.go:32–60  ·  view source on GitHub ↗

StartServer starts the HTTP server with the specified configuration.

(c *config.Config)

Source from the content-addressed store, hash-verified

30
31// StartServer starts the HTTP server with the specified configuration.
32func StartServer(c *config.Config) error {
33 var err error
34 apiConfig := c.API
35 if strings.HasPrefix(apiConfig.Transport, `npipe:///`) {
36 usr, err := user.Current()
37 if err != nil {
38 return fmt.Errorf("failed to retrieve the current user: %v", err)
39 }
40 // Named pipe security and access rights.
41 // We create the pipe and the specific users should only be able to write to it.
42 // See docs: https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-security-and-access-rights
43 // String definition: https://docs.microsoft.com/en-us/windows/win32/secauthz/ace-strings
44 // Give generic read/write access to the specified user.
45 descriptor := "D:P(A;;GA;;;" + usr.Uid + ")"
46 listener, err = MakePipeListener(apiConfig.Transport, descriptor)
47 if err != nil {
48 return err
49 }
50 } else {
51 listener, err = makeTCPListener(apiConfig.Transport)
52 }
53 if err != nil {
54 return err
55 }
56
57 setupServer(listener, c)
58
59 return nil
60}
61
62// CloseServer shutdowns the server by stopping the listener.
63func CloseServer() error {

Callers 3

RunMethod · 0.92
WriteCaptureMethod · 0.92
ReadCaptureMethod · 0.92

Calls 3

MakePipeListenerFunction · 0.85
makeTCPListenerFunction · 0.85
setupServerFunction · 0.85

Tested by

no test coverage detected