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
30,400
inverse-inc/packetfence
go/caddy/caddy/caddytls/tls.go
Revoke
func Revoke(host string) error { client, err := newACMEClient(new(Config), true) if err != nil { return err } return client.Revoke(host) }
go
func Revoke(host string) error { client, err := newACMEClient(new(Config), true) if err != nil { return err } return client.Revoke(host) }
[ "func", "Revoke", "(", "host", "string", ")", "error", "{", "client", ",", "err", ":=", "newACMEClient", "(", "new", "(", "Config", ")", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "client", "....
// Revoke revokes the certificate for host via ACME protocol. // It assumes the certificate was obtained from the // CA at DefaultCAUrl.
[ "Revoke", "revokes", "the", "certificate", "for", "host", "via", "ACME", "protocol", ".", "It", "assumes", "the", "certificate", "was", "obtained", "from", "the", "CA", "at", "DefaultCAUrl", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/tls.go#L69-L75
30,401
inverse-inc/packetfence
go/caddy/caddy/caddytls/tls.go
Present
func (s tlsSniSolver) Present(domain, token, keyAuth string) error { cert, acmeDomain, err := acme.TLSSNI01ChallengeCert(keyAuth) if err != nil { return err } cacheCertificate(Certificate{ Certificate: cert, Names: []string{acmeDomain}, }) return nil }
go
func (s tlsSniSolver) Present(domain, token, keyAuth string) error { cert, acmeDomain, err := acme.TLSSNI01ChallengeCert(keyAuth) if err != nil { return err } cacheCertificate(Certificate{ Certificate: cert, Names: []string{acmeDomain}, }) return nil }
[ "func", "(", "s", "tlsSniSolver", ")", "Present", "(", "domain", ",", "token", ",", "keyAuth", "string", ")", "error", "{", "cert", ",", "acmeDomain", ",", "err", ":=", "acme", ".", "TLSSNI01ChallengeCert", "(", "keyAuth", ")", "\n", "if", "err", "!=", ...
// Present adds the challenge certificate to the cache.
[ "Present", "adds", "the", "challenge", "certificate", "to", "the", "cache", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/tls.go#L82-L92
30,402
inverse-inc/packetfence
go/caddy/caddy/caddytls/tls.go
CleanUp
func (s tlsSniSolver) CleanUp(domain, token, keyAuth string) error { _, acmeDomain, err := acme.TLSSNI01ChallengeCert(keyAuth) if err != nil { return err } uncacheCertificate(acmeDomain) return nil }
go
func (s tlsSniSolver) CleanUp(domain, token, keyAuth string) error { _, acmeDomain, err := acme.TLSSNI01ChallengeCert(keyAuth) if err != nil { return err } uncacheCertificate(acmeDomain) return nil }
[ "func", "(", "s", "tlsSniSolver", ")", "CleanUp", "(", "domain", ",", "token", ",", "keyAuth", "string", ")", "error", "{", "_", ",", "acmeDomain", ",", "err", ":=", "acme", ".", "TLSSNI01ChallengeCert", "(", "keyAuth", ")", "\n", "if", "err", "!=", "n...
// CleanUp removes the challenge certificate from the cache.
[ "CleanUp", "removes", "the", "challenge", "certificate", "from", "the", "cache", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/tls.go#L95-L102
30,403
inverse-inc/packetfence
go/caddy/caddy/caddytls/tls.go
RegisterStorageProvider
func RegisterStorageProvider(name string, provider StorageConstructor) { storageProviders[name] = provider caddy.RegisterPlugin("tls.storage."+name, caddy.Plugin{}) }
go
func RegisterStorageProvider(name string, provider StorageConstructor) { storageProviders[name] = provider caddy.RegisterPlugin("tls.storage."+name, caddy.Plugin{}) }
[ "func", "RegisterStorageProvider", "(", "name", "string", ",", "provider", "StorageConstructor", ")", "{", "storageProviders", "[", "name", "]", "=", "provider", "\n", "caddy", ".", "RegisterPlugin", "(", "\"", "\"", "+", "name", ",", "caddy", ".", "Plugin", ...
// RegisterStorageProvider registers provider by name for storing tls data
[ "RegisterStorageProvider", "registers", "provider", "by", "name", "for", "storing", "tls", "data" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/tls.go#L175-L178
30,404
inverse-inc/packetfence
go/caddy/caddy/caddytls/httphandler.go
HTTPChallengeHandler
func HTTPChallengeHandler(w http.ResponseWriter, r *http.Request, listenHost, altPort string) bool { if !strings.HasPrefix(r.URL.Path, challengeBasePath) { return false } if !namesObtaining.Has(r.Host) { return false } scheme := "http" if r.TLS != nil { scheme = "https" } if listenHost == "" { listenH...
go
func HTTPChallengeHandler(w http.ResponseWriter, r *http.Request, listenHost, altPort string) bool { if !strings.HasPrefix(r.URL.Path, challengeBasePath) { return false } if !namesObtaining.Has(r.Host) { return false } scheme := "http" if r.TLS != nil { scheme = "https" } if listenHost == "" { listenH...
[ "func", "HTTPChallengeHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "listenHost", ",", "altPort", "string", ")", "bool", "{", "if", "!", "strings", ".", "HasPrefix", "(", "r", ".", "URL", ".", "Path", ",...
// HTTPChallengeHandler proxies challenge requests to ACME client if the // request path starts with challengeBasePath. It returns true if it // handled the request and no more needs to be done; it returns false // if this call was a no-op and the request still needs handling.
[ "HTTPChallengeHandler", "proxies", "challenge", "requests", "to", "ACME", "client", "if", "the", "request", "path", "starts", "with", "challengeBasePath", ".", "It", "returns", "true", "if", "it", "handled", "the", "request", "and", "no", "more", "needs", "to", ...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/httphandler.go#L19-L50
30,405
inverse-inc/packetfence
go/filter_client/filter_client.go
FilterProfile
func (c *Client) FilterProfile(data interface{}) (interface{}, error) { socket, err := net.Dial("unix", c.SocketPath) if err != nil { return nil, err } defer socket.Close() return c.SendRequest("filter_profile", data, socket) }
go
func (c *Client) FilterProfile(data interface{}) (interface{}, error) { socket, err := net.Dial("unix", c.SocketPath) if err != nil { return nil, err } defer socket.Close() return c.SendRequest("filter_profile", data, socket) }
[ "func", "(", "c", "*", "Client", ")", "FilterProfile", "(", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "socket", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"", ",", "c", ".", "SocketPath", ")",...
// Sends a filter_profile message to the pffilter service
[ "Sends", "a", "filter_profile", "message", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L47-L54
30,406
inverse-inc/packetfence
go/filter_client/filter_client.go
AccessFilter
func (c *Client) AccessFilter(filter string, scope string, data interface{}) (interface{}, error) { socket, err := net.Dial("unix", c.SocketPath) if err != nil { return nil, err } defer socket.Close() return c.SendRequest(filter, []interface{}{scope, data}, socket) }
go
func (c *Client) AccessFilter(filter string, scope string, data interface{}) (interface{}, error) { socket, err := net.Dial("unix", c.SocketPath) if err != nil { return nil, err } defer socket.Close() return c.SendRequest(filter, []interface{}{scope, data}, socket) }
[ "func", "(", "c", "*", "Client", ")", "AccessFilter", "(", "filter", "string", ",", "scope", "string", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "socket", ",", "err", ":=", "net", ".", "Dial", "(",...
// A generalize function for sending access filter messages
[ "A", "generalize", "function", "for", "sending", "access", "filter", "messages" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L57-L64
30,407
inverse-inc/packetfence
go/filter_client/filter_client.go
FilterVlan
func (c *Client) FilterVlan(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_vlan", scope, data) }
go
func (c *Client) FilterVlan(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_vlan", scope, data) }
[ "func", "(", "c", "*", "Client", ")", "FilterVlan", "(", "scope", "string", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "c", ".", "AccessFilter", "(", "\"", "\"", ",", "scope", ",", "data",...
// Sends a filter_vlan message to the pffilter service
[ "Sends", "a", "filter_vlan", "message", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L67-L69
30,408
inverse-inc/packetfence
go/filter_client/filter_client.go
FilterDhcp
func (c *Client) FilterDhcp(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_dhcp", scope, data) }
go
func (c *Client) FilterDhcp(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_dhcp", scope, data) }
[ "func", "(", "c", "*", "Client", ")", "FilterDhcp", "(", "scope", "string", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "c", ".", "AccessFilter", "(", "\"", "\"", ",", "scope", ",", "data",...
// Sends a filter_dhcp message to the pffilter service
[ "Sends", "a", "filter_dhcp", "message", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L72-L74
30,409
inverse-inc/packetfence
go/filter_client/filter_client.go
FilterDns
func (c *Client) FilterDns(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_dns", scope, data) }
go
func (c *Client) FilterDns(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_dns", scope, data) }
[ "func", "(", "c", "*", "Client", ")", "FilterDns", "(", "scope", "string", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "c", ".", "AccessFilter", "(", "\"", "\"", ",", "scope", ",", "data", ...
// Sends a filter_dns message to the pffilter service
[ "Sends", "a", "filter_dns", "message", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L77-L79
30,410
inverse-inc/packetfence
go/filter_client/filter_client.go
FilterRadius
func (c *Client) FilterRadius(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_radius", scope, data) }
go
func (c *Client) FilterRadius(scope string, data interface{}) (interface{}, error) { return c.AccessFilter("filter_radius", scope, data) }
[ "func", "(", "c", "*", "Client", ")", "FilterRadius", "(", "scope", "string", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "c", ".", "AccessFilter", "(", "\"", "\"", ",", "scope", ",", "data...
// Sends a filter_radius message to the pffilter service
[ "Sends", "a", "filter_radius", "message", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L82-L84
30,411
inverse-inc/packetfence
go/filter_client/filter_client.go
SendRequest
func (c *Client) SendRequest(method string, params interface{}, conn net.Conn) (interface{}, error) { request := Request{Method: method, Params: params} b, err := json.Marshal(request) if err != nil { return nil, err } b = append(b, '\n') _, err = conn.Write(b) if err != nil { return nil, err } reader := b...
go
func (c *Client) SendRequest(method string, params interface{}, conn net.Conn) (interface{}, error) { request := Request{Method: method, Params: params} b, err := json.Marshal(request) if err != nil { return nil, err } b = append(b, '\n') _, err = conn.Write(b) if err != nil { return nil, err } reader := b...
[ "func", "(", "c", "*", "Client", ")", "SendRequest", "(", "method", "string", ",", "params", "interface", "{", "}", ",", "conn", "net", ".", "Conn", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "request", ":=", "Request", "{", "Method", ...
// Send a request to the pffilter service
[ "Send", "a", "request", "to", "the", "pffilter", "service" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/filter_client/filter_client.go#L87-L117
30,412
inverse-inc/packetfence
go/firewallsso/checkpoint.go
Start
func (fw *Checkpoint) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { p := fw.startRadiusPacket(ctx, info, timeout) client := fw.getRadiusClient(ctx) // Use the background context since we don't want the lib to use our context ctx2, cancel := fw.RadiusContextWithTimeout() defer canc...
go
func (fw *Checkpoint) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { p := fw.startRadiusPacket(ctx, info, timeout) client := fw.getRadiusClient(ctx) // Use the background context since we don't want the lib to use our context ctx2, cancel := fw.RadiusContextWithTimeout() defer canc...
[ "func", "(", "fw", "*", "Checkpoint", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "p", ":=", "fw", ".", "startRadiusPacket", ...
// Send an SSO start to the Checkpoint firewall // Returns an error unless there is a valid reply from the firewall
[ "Send", "an", "SSO", "start", "to", "the", "Checkpoint", "firewall", "Returns", "an", "error", "unless", "there", "is", "a", "valid", "reply", "from", "the", "firewall" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/checkpoint.go#L22-L35
30,413
inverse-inc/packetfence
go/firewallsso/checkpoint.go
startRadiusPacket
func (fw *Checkpoint) startRadiusPacket(ctx context.Context, info map[string]string, timeout int) *radius.Packet { r := radius.New(radius.CodeAccountingRequest, []byte(fw.Password)) rfc2866.AcctStatusType_Add(r, rfc2866.AcctStatusType_Value_Start) rfc2866.AcctSessionID_AddString(r, "acct_pf-"+info["mac"]) rfc2865.U...
go
func (fw *Checkpoint) startRadiusPacket(ctx context.Context, info map[string]string, timeout int) *radius.Packet { r := radius.New(radius.CodeAccountingRequest, []byte(fw.Password)) rfc2866.AcctStatusType_Add(r, rfc2866.AcctStatusType_Value_Start) rfc2866.AcctSessionID_AddString(r, "acct_pf-"+info["mac"]) rfc2865.U...
[ "func", "(", "fw", "*", "Checkpoint", ")", "startRadiusPacket", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "*", "radius", ".", "Packet", "{", "r", ":=", "radius", ".", "New", "...
// Build the RADIUS packet for an SSO start
[ "Build", "the", "RADIUS", "packet", "for", "an", "SSO", "start" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/checkpoint.go#L38-L49
30,414
inverse-inc/packetfence
go/firewallsso/checkpoint.go
Stop
func (fw *Checkpoint) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Warn("SSO Stop is not available for this firewall") return false, nil }
go
func (fw *Checkpoint) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Warn("SSO Stop is not available for this firewall") return false, nil }
[ "func", "(", "fw", "*", "Checkpoint", ")", "Stop", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "LoggerWContext", "(", "ctx", ")", ".", "Warn", "(", ...
// SSO stop handler which does nothing other than printing a warning since the SSO stop is unimplemented for this firewall
[ "SSO", "stop", "handler", "which", "does", "nothing", "other", "than", "printing", "a", "warning", "since", "the", "SSO", "stop", "is", "unimplemented", "for", "this", "firewall" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/checkpoint.go#L52-L55
30,415
inverse-inc/packetfence
go/coredns/coremain/run.go
setVersion
func setVersion() { // A development build is one that's not at a tag or has uncommitted changes devBuild = gitTag == "" || gitShortStat != "" // Only set the appVersion if -ldflags was used if gitNearestTag != "" || gitTag != "" { if devBuild && gitNearestTag != "" { appVersion = fmt.Sprintf("%s (+%s %s)", ...
go
func setVersion() { // A development build is one that's not at a tag or has uncommitted changes devBuild = gitTag == "" || gitShortStat != "" // Only set the appVersion if -ldflags was used if gitNearestTag != "" || gitTag != "" { if devBuild && gitNearestTag != "" { appVersion = fmt.Sprintf("%s (+%s %s)", ...
[ "func", "setVersion", "(", ")", "{", "// A development build is one that's not at a tag or has uncommitted changes", "devBuild", "=", "gitTag", "==", "\"", "\"", "||", "gitShortStat", "!=", "\"", "\"", "\n\n", "// Only set the appVersion if -ldflags was used", "if", "gitNeare...
// setVersion figures out the version information // based on variables set by -ldflags.
[ "setVersion", "figures", "out", "the", "version", "information", "based", "on", "variables", "set", "by", "-", "ldflags", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/coremain/run.go#L188-L201
30,416
inverse-inc/packetfence
go/coredns/plugin/proxy/metrics.go
OnStartupMetrics
func OnStartupMetrics() error { metricsOnce.Do(func() { prometheus.MustRegister(RequestCount) prometheus.MustRegister(RequestDuration) }) return nil }
go
func OnStartupMetrics() error { metricsOnce.Do(func() { prometheus.MustRegister(RequestCount) prometheus.MustRegister(RequestDuration) }) return nil }
[ "func", "OnStartupMetrics", "(", ")", "error", "{", "metricsOnce", ".", "Do", "(", "func", "(", ")", "{", "prometheus", ".", "MustRegister", "(", "RequestCount", ")", "\n", "prometheus", ".", "MustRegister", "(", "RequestDuration", ")", "\n", "}", ")", "\n...
// OnStartupMetrics sets up the metrics on startup. This is done for all proxy protocols.
[ "OnStartupMetrics", "sets", "up", "the", "metrics", "on", "startup", ".", "This", "is", "done", "for", "all", "proxy", "protocols", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/proxy/metrics.go#L29-L35
30,417
inverse-inc/packetfence
go/caddy/caddy/caddytls/crypto.go
stapleOCSP
func stapleOCSP(cert *Certificate, pemBundle []byte) error { if pemBundle == nil { // The function in the acme package that gets OCSP requires a PEM-encoded cert bundle := new(bytes.Buffer) for _, derBytes := range cert.Certificate.Certificate { pem.Encode(bundle, &pem.Block{Type: "CERTIFICATE", Bytes: derByt...
go
func stapleOCSP(cert *Certificate, pemBundle []byte) error { if pemBundle == nil { // The function in the acme package that gets OCSP requires a PEM-encoded cert bundle := new(bytes.Buffer) for _, derBytes := range cert.Certificate.Certificate { pem.Encode(bundle, &pem.Block{Type: "CERTIFICATE", Bytes: derByt...
[ "func", "stapleOCSP", "(", "cert", "*", "Certificate", ",", "pemBundle", "[", "]", "byte", ")", "error", "{", "if", "pemBundle", "==", "nil", "{", "// The function in the acme package that gets OCSP requires a PEM-encoded cert", "bundle", ":=", "new", "(", "bytes", ...
// stapleOCSP staples OCSP information to cert for hostname name. // If you have it handy, you should pass in the PEM-encoded certificate // bundle; otherwise the DER-encoded cert will have to be PEM-encoded. // If you don't have the PEM blocks already, just pass in nil. // // Errors here are not necessarily fatal, it ...
[ "stapleOCSP", "staples", "OCSP", "information", "to", "cert", "for", "hostname", "name", ".", "If", "you", "have", "it", "handy", "you", "should", "pass", "in", "the", "PEM", "-", "encoded", "certificate", "bundle", ";", "otherwise", "the", "DER", "-", "en...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/crypto.go#L74-L154
30,418
inverse-inc/packetfence
go/caddy/caddy/caddytls/crypto.go
makeSelfSignedCert
func makeSelfSignedCert(config *Config) error { // start by generating private key var privKey interface{} var err error switch config.KeyType { case "", acme.EC256: privKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) case acme.EC384: privKey, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) ...
go
func makeSelfSignedCert(config *Config) error { // start by generating private key var privKey interface{} var err error switch config.KeyType { case "", acme.EC256: privKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) case acme.EC384: privKey, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) ...
[ "func", "makeSelfSignedCert", "(", "config", "*", "Config", ")", "error", "{", "// start by generating private key", "var", "privKey", "interface", "{", "}", "\n", "var", "err", "error", "\n", "switch", "config", ".", "KeyType", "{", "case", "\"", "\"", ",", ...
// makeSelfSignedCert makes a self-signed certificate according // to the parameters in config. It then caches the certificate // in our cache.
[ "makeSelfSignedCert", "makes", "a", "self", "-", "signed", "certificate", "according", "to", "the", "parameters", "in", "config", ".", "It", "then", "caches", "the", "certificate", "in", "our", "cache", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/crypto.go#L159-L230
30,419
inverse-inc/packetfence
go/caddy/caddy/caddytls/crypto.go
fastHash
func fastHash(input []byte) string { h := fnv.New32a() h.Write([]byte(input)) return fmt.Sprintf("%x", h.Sum32()) }
go
func fastHash(input []byte) string { h := fnv.New32a() h.Write([]byte(input)) return fmt.Sprintf("%x", h.Sum32()) }
[ "func", "fastHash", "(", "input", "[", "]", "byte", ")", "string", "{", "h", ":=", "fnv", ".", "New32a", "(", ")", "\n", "h", ".", "Write", "(", "[", "]", "byte", "(", "input", ")", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ...
// fastHash hashes input using a hashing algorithm that // is fast, and returns the hash as a hex-encoded string. // Do not use this for cryptographic purposes.
[ "fastHash", "hashes", "input", "using", "a", "hashing", "algorithm", "that", "is", "fast", "and", "returns", "the", "hash", "as", "a", "hex", "-", "encoded", "string", ".", "Do", "not", "use", "this", "for", "cryptographic", "purposes", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/crypto.go#L310-L314
30,420
inverse-inc/packetfence
go/coredns/request/request.go
ErrorMessage
func (r *Request) ErrorMessage(rcode int) *dns.Msg { m := new(dns.Msg) m.SetRcode(r.Req, rcode) return m }
go
func (r *Request) ErrorMessage(rcode int) *dns.Msg { m := new(dns.Msg) m.SetRcode(r.Req, rcode) return m }
[ "func", "(", "r", "*", "Request", ")", "ErrorMessage", "(", "rcode", "int", ")", "*", "dns", ".", "Msg", "{", "m", ":=", "new", "(", "dns", ".", "Msg", ")", "\n", "m", ".", "SetRcode", "(", "r", ".", "Req", ",", "rcode", ")", "\n", "return", ...
// ErrorMessage returns an error message suitable for sending // back to the client.
[ "ErrorMessage", "returns", "an", "error", "message", "suitable", "for", "sending", "back", "to", "the", "client", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/request/request.go#L298-L302
30,421
inverse-inc/packetfence
go/firewallsso/factory.go
NewFactory
func NewFactory(ctx context.Context) Factory { f := Factory{} f.typeRegistry = make(map[string]reflect.Type) f.typeRegistry["BarracudaNG"] = reflect.TypeOf(&BarracudaNG{}).Elem() f.typeRegistry["Iboss"] = reflect.TypeOf(&Iboss{}).Elem() f.typeRegistry["PaloAlto"] = reflect.TypeOf(&PaloAlto{}).Elem() f.typeRegistr...
go
func NewFactory(ctx context.Context) Factory { f := Factory{} f.typeRegistry = make(map[string]reflect.Type) f.typeRegistry["BarracudaNG"] = reflect.TypeOf(&BarracudaNG{}).Elem() f.typeRegistry["Iboss"] = reflect.TypeOf(&Iboss{}).Elem() f.typeRegistry["PaloAlto"] = reflect.TypeOf(&PaloAlto{}).Elem() f.typeRegistr...
[ "func", "NewFactory", "(", "ctx", "context", ".", "Context", ")", "Factory", "{", "f", ":=", "Factory", "{", "}", "\n", "f", ".", "typeRegistry", "=", "make", "(", "map", "[", "string", "]", "reflect", ".", "Type", ")", "\n", "f", ".", "typeRegistry"...
// Create a new FirewallSSO factory containing all the valid types
[ "Create", "a", "new", "FirewallSSO", "factory", "containing", "all", "the", "valid", "types" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/factory.go#L16-L28
30,422
inverse-inc/packetfence
go/firewallsso/factory.go
Instantiate
func (f *Factory) Instantiate(ctx context.Context, id string) (FirewallSSOInt, error) { firewall := FirewallSSO{} firewall.PfconfigHashNS = id _, err := pfconfigdriver.FetchDecodeSocketCache(ctx, &firewall) if err != nil { return nil, err } if oType, ok := f.typeRegistry[firewall.Type]; ok { or := reflect.New...
go
func (f *Factory) Instantiate(ctx context.Context, id string) (FirewallSSOInt, error) { firewall := FirewallSSO{} firewall.PfconfigHashNS = id _, err := pfconfigdriver.FetchDecodeSocketCache(ctx, &firewall) if err != nil { return nil, err } if oType, ok := f.typeRegistry[firewall.Type]; ok { or := reflect.New...
[ "func", "(", "f", "*", "Factory", ")", "Instantiate", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "FirewallSSOInt", ",", "error", ")", "{", "firewall", ":=", "FirewallSSO", "{", "}", "\n", "firewall", ".", "PfconfigHashNS", "=",...
// Instantiate a new FirewallSSO given its configuration ID in PacketFence
[ "Instantiate", "a", "new", "FirewallSSO", "given", "its", "configuration", "ID", "in", "PacketFence" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/factory.go#L31-L63
30,423
inverse-inc/packetfence
go/caddy/caddy/caddytls/client.go
Renew
func (c *ACMEClient) Renew(name string) error { // Get access to ACME storage storage, err := c.config.StorageFor(c.config.CAUrl) if err != nil { return err } waiter, err := storage.TryLock(name) if err != nil { return err } if waiter != nil { log.Printf("[INFO] Certificate for %s is already being renewe...
go
func (c *ACMEClient) Renew(name string) error { // Get access to ACME storage storage, err := c.config.StorageFor(c.config.CAUrl) if err != nil { return err } waiter, err := storage.TryLock(name) if err != nil { return err } if waiter != nil { log.Printf("[INFO] Certificate for %s is already being renewe...
[ "func", "(", "c", "*", "ACMEClient", ")", "Renew", "(", "name", "string", ")", "error", "{", "// Get access to ACME storage", "storage", ",", "err", ":=", "c", ".", "config", ".", "StorageFor", "(", "c", ".", "config", ".", "CAUrl", ")", "\n", "if", "e...
// Renew renews the managed certificate for name. This function is // safe for concurrent use. // // Callers who have access to a Config value should use the RenewCert // method on that instead of this lower-level method.
[ "Renew", "renews", "the", "managed", "certificate", "for", "name", ".", "This", "function", "is", "safe", "for", "concurrent", "use", ".", "Callers", "who", "have", "access", "to", "a", "Config", "value", "should", "use", "the", "RenewCert", "method", "on", ...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/client.go#L250-L317
30,424
inverse-inc/packetfence
go/caddy/caddy/caddytls/client.go
Revoke
func (c *ACMEClient) Revoke(name string) error { storage, err := c.config.StorageFor(c.config.CAUrl) if err != nil { return err } siteExists, err := storage.SiteExists(name) if err != nil { return err } if !siteExists { return errors.New("no certificate and key for " + name) } siteData, err := storage...
go
func (c *ACMEClient) Revoke(name string) error { storage, err := c.config.StorageFor(c.config.CAUrl) if err != nil { return err } siteExists, err := storage.SiteExists(name) if err != nil { return err } if !siteExists { return errors.New("no certificate and key for " + name) } siteData, err := storage...
[ "func", "(", "c", "*", "ACMEClient", ")", "Revoke", "(", "name", "string", ")", "error", "{", "storage", ",", "err", ":=", "c", ".", "config", ".", "StorageFor", "(", "c", ".", "config", ".", "CAUrl", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// Revoke revokes the certificate for name and deltes // it from storage.
[ "Revoke", "revokes", "the", "certificate", "for", "name", "and", "deltes", "it", "from", "storage", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/client.go#L321-L352
30,425
inverse-inc/packetfence
go/caddy/caddy/caddytls/client.go
Add
func (c *nameCoordinator) Add(names []string) { c.mu.Lock() for _, name := range names { c.names[strings.ToLower(name)] = struct{}{} } c.mu.Unlock() }
go
func (c *nameCoordinator) Add(names []string) { c.mu.Lock() for _, name := range names { c.names[strings.ToLower(name)] = struct{}{} } c.mu.Unlock() }
[ "func", "(", "c", "*", "nameCoordinator", ")", "Add", "(", "names", "[", "]", "string", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "c", ".", "names", "[", "strings", ".", "ToLowe...
// Add adds names to c. It is safe for concurrent use.
[ "Add", "adds", "names", "to", "c", ".", "It", "is", "safe", "for", "concurrent", "use", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/client.go#L369-L375
30,426
inverse-inc/packetfence
go/caddy/caddy/caddytls/client.go
Remove
func (c *nameCoordinator) Remove(names []string) { c.mu.Lock() for _, name := range names { delete(c.names, strings.ToLower(name)) } c.mu.Unlock() }
go
func (c *nameCoordinator) Remove(names []string) { c.mu.Lock() for _, name := range names { delete(c.names, strings.ToLower(name)) } c.mu.Unlock() }
[ "func", "(", "c", "*", "nameCoordinator", ")", "Remove", "(", "names", "[", "]", "string", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "delete", "(", "c", ".", "names", ",", "stri...
// Remove removes names from c. It is safe for concurrent use.
[ "Remove", "removes", "names", "from", "c", ".", "It", "is", "safe", "for", "concurrent", "use", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/client.go#L378-L384
30,427
inverse-inc/packetfence
go/caddy/caddy/caddytls/client.go
Has
func (c *nameCoordinator) Has(name string) bool { hostname, _, err := net.SplitHostPort(name) if err != nil { hostname = name } c.mu.RLock() _, ok := c.names[strings.ToLower(hostname)] c.mu.RUnlock() return ok }
go
func (c *nameCoordinator) Has(name string) bool { hostname, _, err := net.SplitHostPort(name) if err != nil { hostname = name } c.mu.RLock() _, ok := c.names[strings.ToLower(hostname)] c.mu.RUnlock() return ok }
[ "func", "(", "c", "*", "nameCoordinator", ")", "Has", "(", "name", "string", ")", "bool", "{", "hostname", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "hostname", "=", "name", "\n"...
// Has returns true if c has name. It is safe for concurrent use.
[ "Has", "returns", "true", "if", "c", "has", "name", ".", "It", "is", "safe", "for", "concurrent", "use", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/client.go#L387-L396
30,428
inverse-inc/packetfence
go/coredns/plugin/metrics/metrics.go
OnShutdown
func (m *Metrics) OnShutdown() error { if m.ln != nil { return m.ln.Close() } return nil }
go
func (m *Metrics) OnShutdown() error { if m.ln != nil { return m.ln.Close() } return nil }
[ "func", "(", "m", "*", "Metrics", ")", "OnShutdown", "(", ")", "error", "{", "if", "m", ".", "ln", "!=", "nil", "{", "return", "m", ".", "ln", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// OnShutdown tears down the metrics on shutdown and restart.
[ "OnShutdown", "tears", "down", "the", "metrics", "on", "shutdown", "and", "restart", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/metrics/metrics.go#L84-L89
30,429
inverse-inc/packetfence
go/sharedutils/util.go
Inc
func Inc(ip net.IP) { for j := len(ip) - 1; j >= 0; j-- { ip[j]++ if ip[j] > 0 { break } } }
go
func Inc(ip net.IP) { for j := len(ip) - 1; j >= 0; j-- { ip[j]++ if ip[j] > 0 { break } } }
[ "func", "Inc", "(", "ip", "net", ".", "IP", ")", "{", "for", "j", ":=", "len", "(", "ip", ")", "-", "1", ";", "j", ">=", "0", ";", "j", "--", "{", "ip", "[", "j", "]", "++", "\n", "if", "ip", "[", "j", "]", ">", "0", "{", "break", "\n...
// Inc function use to increment an ip
[ "Inc", "function", "use", "to", "increment", "an", "ip" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/sharedutils/util.go#L172-L179
30,430
inverse-inc/packetfence
go/sharedutils/util.go
Dec
func Dec(ip net.IP) { for j := len(ip) - 1; j >= 0; j-- { ip[j]-- if ip[j] == 255 { continue } if ip[j] > 0 { break } } }
go
func Dec(ip net.IP) { for j := len(ip) - 1; j >= 0; j-- { ip[j]-- if ip[j] == 255 { continue } if ip[j] > 0 { break } } }
[ "func", "Dec", "(", "ip", "net", ".", "IP", ")", "{", "for", "j", ":=", "len", "(", "ip", ")", "-", "1", ";", "j", ">=", "0", ";", "j", "--", "{", "ip", "[", "j", "]", "--", "\n", "if", "ip", "[", "j", "]", "==", "255", "{", "continue",...
// Dec function use to decrement an ip
[ "Dec", "function", "use", "to", "decrement", "an", "ip" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/sharedutils/util.go#L182-L192
30,431
inverse-inc/packetfence
go/sharedutils/util.go
ConvertToString
func ConvertToString(b []byte) string { s := make([]string, len(b)) for i := range b { s[i] = strconv.Itoa(int(b[i])) } return strings.Join(s, ",") }
go
func ConvertToString(b []byte) string { s := make([]string, len(b)) for i := range b { s[i] = strconv.Itoa(int(b[i])) } return strings.Join(s, ",") }
[ "func", "ConvertToString", "(", "b", "[", "]", "byte", ")", "string", "{", "s", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "b", ")", ")", "\n", "for", "i", ":=", "range", "b", "{", "s", "[", "i", "]", "=", "strconv", ".", "Itoa",...
// ConvertToSting convert byte to string
[ "ConvertToSting", "convert", "byte", "to", "string" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/sharedutils/util.go#L195-L201
30,432
inverse-inc/packetfence
go/sharedutils/util.go
ConvertToByte
func ConvertToByte(b string) []byte { s := strings.Split(b, ",") var result []byte for i := range s { value, _ := strconv.Atoi(s[i]) result = append(result, byte(value)) } return result }
go
func ConvertToByte(b string) []byte { s := strings.Split(b, ",") var result []byte for i := range s { value, _ := strconv.Atoi(s[i]) result = append(result, byte(value)) } return result }
[ "func", "ConvertToByte", "(", "b", "string", ")", "[", "]", "byte", "{", "s", ":=", "strings", ".", "Split", "(", "b", ",", "\"", "\"", ")", "\n", "var", "result", "[", "]", "byte", "\n", "for", "i", ":=", "range", "s", "{", "value", ",", "_", ...
// ConvertToByte convert string to byte
[ "ConvertToByte", "convert", "string", "to", "byte" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/sharedutils/util.go#L204-L213
30,433
inverse-inc/packetfence
go/sharedutils/util.go
ByteToString
func ByteToString(a []byte) string { const hexDigit = "0123456789abcdef" if len(a) == 0 { return "" } buf := make([]byte, 0, len(a)*3-1) for i, b := range a { if i > 0 { buf = append(buf, ':') } buf = append(buf, hexDigit[b>>4]) buf = append(buf, hexDigit[b&0xF]) } return string(buf) }
go
func ByteToString(a []byte) string { const hexDigit = "0123456789abcdef" if len(a) == 0 { return "" } buf := make([]byte, 0, len(a)*3-1) for i, b := range a { if i > 0 { buf = append(buf, ':') } buf = append(buf, hexDigit[b>>4]) buf = append(buf, hexDigit[b&0xF]) } return string(buf) }
[ "func", "ByteToString", "(", "a", "[", "]", "byte", ")", "string", "{", "const", "hexDigit", "=", "\"", "\"", "\n", "if", "len", "(", "a", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ...
// ByteToString return a human readeable string of the byte
[ "ByteToString", "return", "a", "human", "readeable", "string", "of", "the", "byte" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/sharedutils/util.go#L216-L230
30,434
inverse-inc/packetfence
go/caddy/caddy/caddytls/config.go
RenewCert
func (c *Config) RenewCert(name string, allowPrompts bool) error { client, err := newACMEClient(c, allowPrompts) if err != nil { return err } return client.Renew(name) }
go
func (c *Config) RenewCert(name string, allowPrompts bool) error { client, err := newACMEClient(c, allowPrompts) if err != nil { return err } return client.Renew(name) }
[ "func", "(", "c", "*", "Config", ")", "RenewCert", "(", "name", "string", ",", "allowPrompts", "bool", ")", "error", "{", "client", ",", "err", ":=", "newACMEClient", "(", "c", ",", "allowPrompts", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// RenewCert renews the certificate for name using c. It stows the // renewed certificate and its assets in storage if successful.
[ "RenewCert", "renews", "the", "certificate", "for", "name", "using", "c", ".", "It", "stows", "the", "renewed", "certificate", "and", "its", "assets", "in", "storage", "if", "successful", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/config.go#L164-L170
30,435
inverse-inc/packetfence
go/caddy/caddy/caddytls/config.go
StorageFor
func (c *Config) StorageFor(caURL string) (Storage, error) { // Validate CA URL if caURL == "" { caURL = DefaultCAUrl } if caURL == "" { return nil, fmt.Errorf("cannot create storage without CA URL") } caURL = strings.ToLower(caURL) // scheme required or host will be parsed as path (as of Go 1.6) if !strin...
go
func (c *Config) StorageFor(caURL string) (Storage, error) { // Validate CA URL if caURL == "" { caURL = DefaultCAUrl } if caURL == "" { return nil, fmt.Errorf("cannot create storage without CA URL") } caURL = strings.ToLower(caURL) // scheme required or host will be parsed as path (as of Go 1.6) if !strin...
[ "func", "(", "c", "*", "Config", ")", "StorageFor", "(", "caURL", "string", ")", "(", "Storage", ",", "error", ")", "{", "// Validate CA URL", "if", "caURL", "==", "\"", "\"", "{", "caURL", "=", "DefaultCAUrl", "\n", "}", "\n", "if", "caURL", "==", "...
// StorageFor obtains a TLS Storage instance for the given CA URL which should // be unique for every different ACME CA. If a StorageCreator is set on this // Config, it will be used. Otherwise the default file storage implementation // is used. When the error is nil, this is guaranteed to return a non-nil // Storage i...
[ "StorageFor", "obtains", "a", "TLS", "Storage", "instance", "for", "the", "given", "CA", "URL", "which", "should", "be", "unique", "for", "every", "different", "ACME", "CA", ".", "If", "a", "StorageCreator", "is", "set", "on", "this", "Config", "it", "will...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/config.go#L177-L218
30,436
inverse-inc/packetfence
go/coredns/plugin/auto/zone.go
Remove
func (z *Zones) Remove(name string) { z.Lock() if zo, ok := z.Z[name]; ok && !zo.NoReload { zo.ReloadShutdown <- true } delete(z.Z, name) // TODO(miek): just regenerate Names (might be bad if you have a lot of zones...) z.names = []string{} for n := range z.Z { z.names = append(z.names, n) } z.Unlock()...
go
func (z *Zones) Remove(name string) { z.Lock() if zo, ok := z.Z[name]; ok && !zo.NoReload { zo.ReloadShutdown <- true } delete(z.Z, name) // TODO(miek): just regenerate Names (might be bad if you have a lot of zones...) z.names = []string{} for n := range z.Z { z.names = append(z.names, n) } z.Unlock()...
[ "func", "(", "z", "*", "Zones", ")", "Remove", "(", "name", "string", ")", "{", "z", ".", "Lock", "(", ")", "\n\n", "if", "zo", ",", "ok", ":=", "z", ".", "Z", "[", "name", "]", ";", "ok", "&&", "!", "zo", ".", "NoReload", "{", "zo", ".", ...
// Remove removes the zone named name from z. It also stop the the zone's reload goroutine.
[ "Remove", "removes", "the", "zone", "named", "name", "from", "z", ".", "It", "also", "stop", "the", "the", "zone", "s", "reload", "goroutine", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/auto/zone.go#L60-L76
30,437
inverse-inc/packetfence
go/firewallsso/base.go
init
func (fw *FirewallSSO) init(ctx context.Context) error { for _, net := range fw.Networks { err := net.init(ctx) if err != nil { return err } } return nil }
go
func (fw *FirewallSSO) init(ctx context.Context) error { for _, net := range fw.Networks { err := net.init(ctx) if err != nil { return err } } return nil }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "init", "(", "ctx", "context", ".", "Context", ")", "error", "{", "for", "_", ",", "net", ":=", "range", "fw", ".", "Networks", "{", "err", ":=", "net", ".", "init", "(", "ctx", ")", "\n", "if", "err", ...
// Builds all networks, meant to be called after the data is loaded into the struct attributes
[ "Builds", "all", "networks", "meant", "to", "be", "called", "after", "the", "data", "is", "loaded", "into", "the", "struct", "attributes" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L61-L69
30,438
inverse-inc/packetfence
go/firewallsso/base.go
init
func (fwn *FirewallSSONetwork) init(ctx context.Context) error { var err error fwn.Ip, fwn.IpNet, err = net.ParseCIDR(fwn.Cidr) return err }
go
func (fwn *FirewallSSONetwork) init(ctx context.Context) error { var err error fwn.Ip, fwn.IpNet, err = net.ParseCIDR(fwn.Cidr) return err }
[ "func", "(", "fwn", "*", "FirewallSSONetwork", ")", "init", "(", "ctx", "context", ".", "Context", ")", "error", "{", "var", "err", "error", "\n", "fwn", ".", "Ip", ",", "fwn", ".", "IpNet", ",", "err", "=", "net", ".", "ParseCIDR", "(", "fwn", "."...
// Builds Ip and IpNet based on the Cidr in the struct
[ "Builds", "Ip", "and", "IpNet", "based", "on", "the", "Cidr", "in", "the", "struct" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L84-L88
30,439
inverse-inc/packetfence
go/firewallsso/base.go
GetCacheTimeout
func (fw *FirewallSSO) GetCacheTimeout(ctx context.Context) int { timeout, err := strconv.ParseInt(fw.CacheTimeout, 10, 32) if err != nil { log.LoggerWContext(ctx).Debug(fmt.Sprintf("Can't parse timeout '%s' into an int (%s).", fw.CacheTimeout, err)) return 0 } else { return int(timeout) } }
go
func (fw *FirewallSSO) GetCacheTimeout(ctx context.Context) int { timeout, err := strconv.ParseInt(fw.CacheTimeout, 10, 32) if err != nil { log.LoggerWContext(ctx).Debug(fmt.Sprintf("Can't parse timeout '%s' into an int (%s).", fw.CacheTimeout, err)) return 0 } else { return int(timeout) } }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "GetCacheTimeout", "(", "ctx", "context", ".", "Context", ")", "int", "{", "timeout", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "fw", ".", "CacheTimeout", ",", "10", ",", "32", ")", "\n", "if", "er...
// Get the cache_timeout configured in the firewall as an int // Will return 0 if its not there or not a valid int
[ "Get", "the", "cache_timeout", "configured", "in", "the", "firewall", "as", "an", "int", "Will", "return", "0", "if", "its", "not", "there", "or", "not", "a", "valid", "int" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L103-L111
30,440
inverse-inc/packetfence
go/firewallsso/base.go
Start
func (fw *FirewallSSO) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { log.LoggerWContext(ctx).Debug("Sending SSO start") return true, nil }
go
func (fw *FirewallSSO) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { log.LoggerWContext(ctx).Debug("Sending SSO start") return true, nil }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "LoggerWContext", "(", "ctx", ...
// Start method that will be called on every SSO called via ExecuteStart
[ "Start", "method", "that", "will", "be", "called", "on", "every", "SSO", "called", "via", "ExecuteStart" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L153-L156
30,441
inverse-inc/packetfence
go/firewallsso/base.go
Stop
func (fw *FirewallSSO) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Debug("Sending SSO stop") return true, nil }
go
func (fw *FirewallSSO) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Debug("Sending SSO stop") return true, nil }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "Stop", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "LoggerWContext", "(", "ctx", ")", ".", "Debug", "(",...
// Stop method that will be called on every SSO called via ExecuteStop
[ "Stop", "method", "that", "will", "be", "called", "on", "every", "SSO", "called", "via", "ExecuteStop" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L159-L162
30,442
inverse-inc/packetfence
go/firewallsso/base.go
getSourceIp
func (fw *FirewallSSO) getSourceIp(ctx context.Context) net.IP { managementNetwork := pfconfigdriver.Config.Interfaces.ManagementNetwork if managementNetwork.Vip != "" { return net.ParseIP(managementNetwork.Vip) } else { return net.ParseIP(managementNetwork.Ip) } }
go
func (fw *FirewallSSO) getSourceIp(ctx context.Context) net.IP { managementNetwork := pfconfigdriver.Config.Interfaces.ManagementNetwork if managementNetwork.Vip != "" { return net.ParseIP(managementNetwork.Vip) } else { return net.ParseIP(managementNetwork.Ip) } }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "getSourceIp", "(", "ctx", "context", ".", "Context", ")", "net", ".", "IP", "{", "managementNetwork", ":=", "pfconfigdriver", ".", "Config", ".", "Interfaces", ".", "ManagementNetwork", "\n\n", "if", "managementNetw...
// Get the source IP address for the SSO packets // Will return either the management VIP if there is one of the IP of the management network
[ "Get", "the", "source", "IP", "address", "for", "the", "SSO", "packets", "Will", "return", "either", "the", "management", "VIP", "if", "there", "is", "one", "of", "the", "IP", "of", "the", "management", "network" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L170-L178
30,443
inverse-inc/packetfence
go/firewallsso/base.go
getHttpClient
func (fw *FirewallSSO) getHttpClient(ctx context.Context) *http.Client { // We don't check the TLS certificate if applicable transport := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } return &http.Client{Transport: transport} }
go
func (fw *FirewallSSO) getHttpClient(ctx context.Context) *http.Client { // We don't check the TLS certificate if applicable transport := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } return &http.Client{Transport: transport} }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "getHttpClient", "(", "ctx", "context", ".", "Context", ")", "*", "http", ".", "Client", "{", "// We don't check the TLS certificate if applicable", "transport", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig...
// Get the default SSO HTTP client that doesn't check for valid certificates
[ "Get", "the", "default", "SSO", "HTTP", "client", "that", "doesn", "t", "check", "for", "valid", "certificates" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L181-L187
30,444
inverse-inc/packetfence
go/firewallsso/base.go
getRadiusClient
func (fw *FirewallSSO) getRadiusClient(ctx context.Context) *radius.Client { return &radius.Client{} }
go
func (fw *FirewallSSO) getRadiusClient(ctx context.Context) *radius.Client { return &radius.Client{} }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "getRadiusClient", "(", "ctx", "context", ".", "Context", ")", "*", "radius", ".", "Client", "{", "return", "&", "radius", ".", "Client", "{", "}", "\n", "}" ]
// Get the default RADIUS client
[ "Get", "the", "default", "RADIUS", "client" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L190-L192
30,445
inverse-inc/packetfence
go/firewallsso/base.go
logger
func (fw *FirewallSSO) logger(ctx context.Context) log15.Logger { ctx = log.AddToLogContext(ctx, "firewall-id", fw.PfconfigHashNS) return log.LoggerWContext(ctx) }
go
func (fw *FirewallSSO) logger(ctx context.Context) log15.Logger { ctx = log.AddToLogContext(ctx, "firewall-id", fw.PfconfigHashNS) return log.LoggerWContext(ctx) }
[ "func", "(", "fw", "*", "FirewallSSO", ")", "logger", "(", "ctx", "context", ".", "Context", ")", "log15", ".", "Logger", "{", "ctx", "=", "log", ".", "AddToLogContext", "(", "ctx", ",", "\"", "\"", ",", "fw", ".", "PfconfigHashNS", ")", "\n", "retur...
// Get the logger for a firewall
[ "Get", "the", "logger", "for", "a", "firewall" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L237-L240
30,446
inverse-inc/packetfence
go/firewallsso/base.go
ExecuteStart
func ExecuteStart(ctx context.Context, fw FirewallSSOInt, info map[string]string, timeout int) (bool, error) { ctx = log.AddToLogContext(ctx, "firewall-id", fw.GetFirewallSSO(ctx).PfconfigHashNS) if !fw.CheckStatus(ctx, info) { return false, nil } log.LoggerWContext(ctx).Info("Processing SSO Start") if !fw.Matc...
go
func ExecuteStart(ctx context.Context, fw FirewallSSOInt, info map[string]string, timeout int) (bool, error) { ctx = log.AddToLogContext(ctx, "firewall-id", fw.GetFirewallSSO(ctx).PfconfigHashNS) if !fw.CheckStatus(ctx, info) { return false, nil } log.LoggerWContext(ctx).Info("Processing SSO Start") if !fw.Matc...
[ "func", "ExecuteStart", "(", "ctx", "context", ".", "Context", ",", "fw", "FirewallSSOInt", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "ctx", "=", "log", ".", "AddToLogContext", "(...
// Execute an SSO Start request on the specified firewall // Makes sure to call FirewallSSO.Start and to validate the network and role if necessary
[ "Execute", "an", "SSO", "Start", "request", "on", "the", "specified", "firewall", "Makes", "sure", "to", "call", "FirewallSSO", ".", "Start", "and", "to", "validate", "the", "network", "and", "role", "if", "necessary" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L244-L272
30,447
inverse-inc/packetfence
go/firewallsso/base.go
ExecuteStop
func ExecuteStop(ctx context.Context, fw FirewallSSOInt, info map[string]string) (bool, error) { ctx = log.AddToLogContext(ctx, "firewall-id", fw.GetFirewallSSO(ctx).PfconfigHashNS) log.LoggerWContext(ctx).Info("Processing SSO Stop") if !fw.MatchesNetwork(ctx, info) { log.LoggerWContext(ctx).Debug(fmt.Sprintf("No...
go
func ExecuteStop(ctx context.Context, fw FirewallSSOInt, info map[string]string) (bool, error) { ctx = log.AddToLogContext(ctx, "firewall-id", fw.GetFirewallSSO(ctx).PfconfigHashNS) log.LoggerWContext(ctx).Info("Processing SSO Stop") if !fw.MatchesNetwork(ctx, info) { log.LoggerWContext(ctx).Debug(fmt.Sprintf("No...
[ "func", "ExecuteStop", "(", "ctx", "context", ".", "Context", ",", "fw", "FirewallSSOInt", ",", "info", "map", "[", "string", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "ctx", "=", "log", ".", "AddToLogContext", "(", "ctx", ",", "\"", "...
// Execute an SSO Stop request on the specified firewall // Makes sure to call FirewallSSO.Start and to validate the network if necessary
[ "Execute", "an", "SSO", "Stop", "request", "on", "the", "specified", "firewall", "Makes", "sure", "to", "call", "FirewallSSO", ".", "Start", "and", "to", "validate", "the", "network", "if", "necessary" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/base.go#L276-L297
30,448
inverse-inc/packetfence
go/coredns/plugin/pkg/cache/cache.go
New
func New(size int) *Cache { ssize := size / shardSize if ssize < 512 { ssize = 512 } c := &Cache{} // Initialize all the shards for i := 0; i < shardSize; i++ { c.shards[i] = newShard(ssize) } return c }
go
func New(size int) *Cache { ssize := size / shardSize if ssize < 512 { ssize = 512 } c := &Cache{} // Initialize all the shards for i := 0; i < shardSize; i++ { c.shards[i] = newShard(ssize) } return c }
[ "func", "New", "(", "size", "int", ")", "*", "Cache", "{", "ssize", ":=", "size", "/", "shardSize", "\n", "if", "ssize", "<", "512", "{", "ssize", "=", "512", "\n", "}", "\n\n", "c", ":=", "&", "Cache", "{", "}", "\n\n", "// Initialize all the shards...
// New returns a new cache.
[ "New", "returns", "a", "new", "cache", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/cache/cache.go#L32-L45
30,449
inverse-inc/packetfence
go/coredns/plugin/pkg/cache/cache.go
Get
func (c *Cache) Get(key uint32) (interface{}, bool) { shard := key & (shardSize - 1) return c.shards[shard].Get(key) }
go
func (c *Cache) Get(key uint32) (interface{}, bool) { shard := key & (shardSize - 1) return c.shards[shard].Get(key) }
[ "func", "(", "c", "*", "Cache", ")", "Get", "(", "key", "uint32", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "shard", ":=", "key", "&", "(", "shardSize", "-", "1", ")", "\n", "return", "c", ".", "shards", "[", "shard", "]", ".", ...
// Get looks up element index under key.
[ "Get", "looks", "up", "element", "index", "under", "key", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/cache/cache.go#L54-L57
30,450
inverse-inc/packetfence
go/coredns/plugin/pkg/cache/cache.go
Add
func (s *shard) Add(key uint32, el interface{}) { l := s.Len() if l+1 > s.size { s.Evict() } s.Lock() s.items[key] = el s.Unlock() }
go
func (s *shard) Add(key uint32, el interface{}) { l := s.Len() if l+1 > s.size { s.Evict() } s.Lock() s.items[key] = el s.Unlock() }
[ "func", "(", "s", "*", "shard", ")", "Add", "(", "key", "uint32", ",", "el", "interface", "{", "}", ")", "{", "l", ":=", "s", ".", "Len", "(", ")", "\n", "if", "l", "+", "1", ">", "s", ".", "size", "{", "s", ".", "Evict", "(", ")", "\n", ...
// Add adds element indexed by key into the cache. Any existing element is overwritten
[ "Add", "adds", "element", "indexed", "by", "key", "into", "the", "cache", ".", "Any", "existing", "element", "is", "overwritten" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/cache/cache.go#L78-L87
30,451
inverse-inc/packetfence
go/coredns/plugin/pkg/cache/cache.go
Remove
func (s *shard) Remove(key uint32) { s.Lock() delete(s.items, key) s.Unlock() }
go
func (s *shard) Remove(key uint32) { s.Lock() delete(s.items, key) s.Unlock() }
[ "func", "(", "s", "*", "shard", ")", "Remove", "(", "key", "uint32", ")", "{", "s", ".", "Lock", "(", ")", "\n", "delete", "(", "s", ".", "items", ",", "key", ")", "\n", "s", ".", "Unlock", "(", ")", "\n", "}" ]
// Remove removes the element indexed by key from the cache.
[ "Remove", "removes", "the", "element", "indexed", "by", "key", "from", "the", "cache", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/cache/cache.go#L90-L94
30,452
inverse-inc/packetfence
go/coredns/plugin/pkg/cache/cache.go
Get
func (s *shard) Get(key uint32) (interface{}, bool) { s.RLock() el, found := s.items[key] s.RUnlock() return el, found }
go
func (s *shard) Get(key uint32) (interface{}, bool) { s.RLock() el, found := s.items[key] s.RUnlock() return el, found }
[ "func", "(", "s", "*", "shard", ")", "Get", "(", "key", "uint32", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "s", ".", "RLock", "(", ")", "\n", "el", ",", "found", ":=", "s", ".", "items", "[", "key", "]", "\n", "s", ".", "RUnl...
// Get looks up the element indexed under key.
[ "Get", "looks", "up", "the", "element", "indexed", "under", "key", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/cache/cache.go#L117-L122
30,453
inverse-inc/packetfence
go/caddy/caddy/caddyhttp/httpserver/server.go
ServePacket
func (s *Server) ServePacket(pc net.PacketConn) error { if QUIC { err := s.quicServer.Serve(pc.(*net.UDPConn)) return fmt.Errorf("serving QUIC connections: %v", err) } return nil }
go
func (s *Server) ServePacket(pc net.PacketConn) error { if QUIC { err := s.quicServer.Serve(pc.(*net.UDPConn)) return fmt.Errorf("serving QUIC connections: %v", err) } return nil }
[ "func", "(", "s", "*", "Server", ")", "ServePacket", "(", "pc", "net", ".", "PacketConn", ")", "error", "{", "if", "QUIC", "{", "err", ":=", "s", ".", "quicServer", ".", "Serve", "(", "pc", ".", "(", "*", "net", ".", "UDPConn", ")", ")", "\n", ...
// ServePacket serves QUIC requests on pc until it is closed.
[ "ServePacket", "serves", "QUIC", "requests", "on", "pc", "until", "it", "is", "closed", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddyhttp/httpserver/server.go#L193-L199
30,454
inverse-inc/packetfence
go/firewallsso/junipersrx.go
Start
func (fw *JuniperSRX) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { log.LoggerWContext(ctx).Info("Sending SSO to JuniperSRX using HTTP") return fw.startHttp(ctx, info, timeout) }
go
func (fw *JuniperSRX) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { log.LoggerWContext(ctx).Info("Sending SSO to JuniperSRX using HTTP") return fw.startHttp(ctx, info, timeout) }
[ "func", "(", "fw", "*", "JuniperSRX", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "LoggerWContext", "(", "ctx", ...
// Send an SSO start to the JuniperSRX using HTTP // This will return any value from startSyslog or startHttp depending on the type of the transport
[ "Send", "an", "SSO", "start", "to", "the", "JuniperSRX", "using", "HTTP", "This", "will", "return", "any", "value", "from", "startSyslog", "or", "startHttp", "depending", "on", "the", "type", "of", "the", "transport" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/junipersrx.go#L23-L27
30,455
inverse-inc/packetfence
go/firewallsso/junipersrx.go
startHttp
func (fw *JuniperSRX) startHttp(ctx context.Context, info map[string]string, timeout int) (bool, error) { req, err := http.NewRequest("POST", "https://"+fw.PfconfigHashNS+":"+fw.Port+"/api/userfw/v1/post-entry", bytes.NewBuffer([]byte(fw.startHttpPayload(ctx, info)))) req.SetBasicAuth(fw.Username, fw.Password) clie...
go
func (fw *JuniperSRX) startHttp(ctx context.Context, info map[string]string, timeout int) (bool, error) { req, err := http.NewRequest("POST", "https://"+fw.PfconfigHashNS+":"+fw.Port+"/api/userfw/v1/post-entry", bytes.NewBuffer([]byte(fw.startHttpPayload(ctx, info)))) req.SetBasicAuth(fw.Username, fw.Password) clie...
[ "func", "(", "fw", "*", "JuniperSRX", ")", "startHttp", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "req", ",", "err", ":=", "http", ".", ...
// Send a start to the JuniperSRX using the HTTP transport // Will return an error if it fails to get a valid reply from it
[ "Send", "a", "start", "to", "the", "JuniperSRX", "using", "the", "HTTP", "transport", "Will", "return", "an", "error", "if", "it", "fails", "to", "get", "a", "valid", "reply", "from", "it" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/junipersrx.go#L31-L48
30,456
inverse-inc/packetfence
go/firewallsso/junipersrx.go
Stop
func (fw *JuniperSRX) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Info("Sending SSO to JuniperSRX using HTTP") return fw.stopHttp(ctx, info) }
go
func (fw *JuniperSRX) Stop(ctx context.Context, info map[string]string) (bool, error) { log.LoggerWContext(ctx).Info("Sending SSO to JuniperSRX using HTTP") return fw.stopHttp(ctx, info) }
[ "func", "(", "fw", "*", "JuniperSRX", ")", "Stop", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "LoggerWContext", "(", "ctx", ")", ".", "Info", "(", ...
// Send an SSO stop to the firewall by using HTTP transport.
[ "Send", "an", "SSO", "stop", "to", "the", "firewall", "by", "using", "HTTP", "transport", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/junipersrx.go#L103-L107
30,457
inverse-inc/packetfence
go/firewallsso/barracudang.go
getSshSession
func (fw *BarracudaNG) getSshSession(ctx context.Context) (*ssh.Session, error) { sshConfig := &ssh.ClientConfig{ User: fw.Username, Auth: []ssh.AuthMethod{ ssh.Password(fw.Password), }, } connection, err := ssh.Dial("tcp", fw.PfconfigHashNS+":"+fw.Port, sshConfig) if err != nil { return nil, err } s...
go
func (fw *BarracudaNG) getSshSession(ctx context.Context) (*ssh.Session, error) { sshConfig := &ssh.ClientConfig{ User: fw.Username, Auth: []ssh.AuthMethod{ ssh.Password(fw.Password), }, } connection, err := ssh.Dial("tcp", fw.PfconfigHashNS+":"+fw.Port, sshConfig) if err != nil { return nil, err } s...
[ "func", "(", "fw", "*", "BarracudaNG", ")", "getSshSession", "(", "ctx", "context", ".", "Context", ")", "(", "*", "ssh", ".", "Session", ",", "error", ")", "{", "sshConfig", ":=", "&", "ssh", ".", "ClientConfig", "{", "User", ":", "fw", ".", "Userna...
// Get an SSH session to the firewall
[ "Get", "an", "SSH", "session", "to", "the", "firewall" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/barracudang.go#L18-L34
30,458
inverse-inc/packetfence
go/firewallsso/barracudang.go
Start
func (fw *BarracudaNG) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { session, err := fw.getSshSession(ctx) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Cannot connect to BarracudaNG: %s", err)) return false, err } cmd := "phibstest 127.0.0.1 l peer=" + info["ip"...
go
func (fw *BarracudaNG) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { session, err := fw.getSshSession(ctx) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Cannot connect to BarracudaNG: %s", err)) return false, err } cmd := "phibstest 127.0.0.1 l peer=" + info["ip"...
[ "func", "(", "fw", "*", "BarracudaNG", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "session", ",", "err", ":=", "fw", ".", ...
// Send an SSO start to the BarracudaNG Firewall // Will return an error if it can't connect
[ "Send", "an", "SSO", "start", "to", "the", "BarracudaNG", "Firewall", "Will", "return", "an", "error", "if", "it", "can", "t", "connect" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/barracudang.go#L38-L50
30,459
inverse-inc/packetfence
go/stats/main.go
detectVIP
func detectVIP(management pfconfigdriver.ManagementNetwork) { if pfconfigdriver.GetClusterSummary(ctx).ClusterEnabled == 1 { var keyConfCluster pfconfigdriver.NetInterface keyConfCluster.PfconfigNS = "config::Pf(CLUSTER," + pfconfigdriver.FindClusterName(ctx) + ")" keyConfCluster.PfconfigHashNS = "interface " +...
go
func detectVIP(management pfconfigdriver.ManagementNetwork) { if pfconfigdriver.GetClusterSummary(ctx).ClusterEnabled == 1 { var keyConfCluster pfconfigdriver.NetInterface keyConfCluster.PfconfigNS = "config::Pf(CLUSTER," + pfconfigdriver.FindClusterName(ctx) + ")" keyConfCluster.PfconfigHashNS = "interface " +...
[ "func", "detectVIP", "(", "management", "pfconfigdriver", ".", "ManagementNetwork", ")", "{", "if", "pfconfigdriver", ".", "GetClusterSummary", "(", "ctx", ")", ".", "ClusterEnabled", "==", "1", "{", "var", "keyConfCluster", "pfconfigdriver", ".", "NetInterface", ...
// Detect the vip on management
[ "Detect", "the", "vip", "on", "management" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/stats/main.go#L1791-L1820
30,460
inverse-inc/packetfence
go/coredns/plugin/proxy/upstream.go
NewStaticUpstreams
func NewStaticUpstreams(c *caddyfile.Dispenser) ([]Upstream, error) { var upstreams []Upstream for c.Next() { upstream := &staticUpstream{ from: ".", HealthCheck: healthcheck.HealthCheck{ FailTimeout: 5 * time.Second, MaxFails: 3, }, ex: newDNSEx(), } if !c.Args(&upstream.netsource) { ...
go
func NewStaticUpstreams(c *caddyfile.Dispenser) ([]Upstream, error) { var upstreams []Upstream for c.Next() { upstream := &staticUpstream{ from: ".", HealthCheck: healthcheck.HealthCheck{ FailTimeout: 5 * time.Second, MaxFails: 3, }, ex: newDNSEx(), } if !c.Args(&upstream.netsource) { ...
[ "func", "NewStaticUpstreams", "(", "c", "*", "caddyfile", ".", "Dispenser", ")", "(", "[", "]", "Upstream", ",", "error", ")", "{", "var", "upstreams", "[", "]", "Upstream", "\n", "for", "c", ".", "Next", "(", ")", "{", "upstream", ":=", "&", "static...
// NewStaticUpstreams parses the configuration input and sets up // static upstreams for the proxy plugin.
[ "NewStaticUpstreams", "parses", "the", "configuration", "input", "and", "sets", "up", "static", "upstreams", "for", "the", "proxy", "plugin", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/proxy/upstream.go#L29-L86
30,461
inverse-inc/packetfence
go/coredns/plugin/proxy/fuzz.go
Fuzz
func Fuzz(data []byte) int { c := caddy.NewTestController("dns", "proxy . 8.8.8.8:53") up, err := NewStaticUpstreams(&c.Dispenser) if err != nil { return 0 } p := &Proxy{Upstreams: &up} return fuzz.Do(p, data) }
go
func Fuzz(data []byte) int { c := caddy.NewTestController("dns", "proxy . 8.8.8.8:53") up, err := NewStaticUpstreams(&c.Dispenser) if err != nil { return 0 } p := &Proxy{Upstreams: &up} return fuzz.Do(p, data) }
[ "func", "Fuzz", "(", "data", "[", "]", "byte", ")", "int", "{", "c", ":=", "caddy", ".", "NewTestController", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "up", ",", "err", ":=", "NewStaticUpstreams", "(", "&", "c", ".", "Dispenser", ")", "\n", "...
// Fuzz fuzzes proxy.
[ "Fuzz", "fuzzes", "proxy", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/proxy/fuzz.go#L10-L19
30,462
inverse-inc/packetfence
go/unifiedapiclient/client.go
ensureRequestComplete
func (c *Client) ensureRequestComplete(ctx context.Context, resp *http.Response) { if resp == nil { return } defer resp.Body.Close() io.Copy(ioutil.Discard, resp.Body) }
go
func (c *Client) ensureRequestComplete(ctx context.Context, resp *http.Response) { if resp == nil { return } defer resp.Body.Close() io.Copy(ioutil.Discard, resp.Body) }
[ "func", "(", "c", "*", "Client", ")", "ensureRequestComplete", "(", "ctx", "context", ".", "Context", ",", "resp", "*", "http", ".", "Response", ")", "{", "if", "resp", "==", "nil", "{", "return", "\n", "}", "\n\n", "defer", "resp", ".", "Body", ".",...
// Ensures that the full body is read and closes the reader so that the connection can be reused
[ "Ensures", "that", "the", "full", "body", "is", "read", "and", "closes", "the", "reader", "so", "that", "the", "connection", "can", "be", "reused" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/unifiedapiclient/client.go#L128-L135
30,463
inverse-inc/packetfence
go/coredns/plugin/proxy/google_rr.go
toMsg
func toMsg(g *googleMsg) (*dns.Msg, error) { m := new(dns.Msg) m.Response = true m.Rcode = g.Status m.Truncated = g.TC m.RecursionDesired = g.RD m.RecursionAvailable = g.RA m.AuthenticatedData = g.AD m.CheckingDisabled = g.CD m.Question = make([]dns.Question, 1) m.Answer = make([]dns.RR, len(g.Answer)) m.Ns...
go
func toMsg(g *googleMsg) (*dns.Msg, error) { m := new(dns.Msg) m.Response = true m.Rcode = g.Status m.Truncated = g.TC m.RecursionDesired = g.RD m.RecursionAvailable = g.RA m.AuthenticatedData = g.AD m.CheckingDisabled = g.CD m.Question = make([]dns.Question, 1) m.Answer = make([]dns.RR, len(g.Answer)) m.Ns...
[ "func", "toMsg", "(", "g", "*", "googleMsg", ")", "(", "*", "dns", ".", "Msg", ",", "error", ")", "{", "m", ":=", "new", "(", "dns", ".", "Msg", ")", "\n", "m", ".", "Response", "=", "true", "\n", "m", ".", "Rcode", "=", "g", ".", "Status", ...
// toMsg converts a googleMsg into the dns message.
[ "toMsg", "converts", "a", "googleMsg", "into", "the", "dns", "message", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/proxy/google_rr.go#L10-L48
30,464
inverse-inc/packetfence
go/coredns/plugin/proxy/google_rr.go
toRR
func toRR(g googleRR) (dns.RR, error) { typ, ok := dns.TypeToString[g.Type] if !ok { return nil, fmt.Errorf("failed to convert type %q", g.Type) } str := fmt.Sprintf("%s %d %s %s", g.Name, g.TTL, typ, g.Data) rr, err := dns.NewRR(str) if err != nil { return nil, fmt.Errorf("failed to parse %q: %s", str, err)...
go
func toRR(g googleRR) (dns.RR, error) { typ, ok := dns.TypeToString[g.Type] if !ok { return nil, fmt.Errorf("failed to convert type %q", g.Type) } str := fmt.Sprintf("%s %d %s %s", g.Name, g.TTL, typ, g.Data) rr, err := dns.NewRR(str) if err != nil { return nil, fmt.Errorf("failed to parse %q: %s", str, err)...
[ "func", "toRR", "(", "g", "googleRR", ")", "(", "dns", ".", "RR", ",", "error", ")", "{", "typ", ",", "ok", ":=", "dns", ".", "TypeToString", "[", "g", ".", "Type", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", ...
// toRR transforms a "google" RR to a dns.RR.
[ "toRR", "transforms", "a", "google", "RR", "to", "a", "dns", ".", "RR", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/proxy/google_rr.go#L51-L63
30,465
inverse-inc/packetfence
go/coredns/plugin/dnstap/taprw/writer.go
WriteMsg
func (w *ResponseWriter) WriteMsg(resp *dns.Msg) (writeErr error) { writeErr = w.ResponseWriter.WriteMsg(resp) writeEpoch := uint64(time.Now().Unix()) b := w.TapBuilder() b.TimeSec = w.queryEpoch if w.Send == nil || w.Send.Cq { if err := func() (err error) { err = b.AddrMsg(w.ResponseWriter.RemoteAddr(), w....
go
func (w *ResponseWriter) WriteMsg(resp *dns.Msg) (writeErr error) { writeErr = w.ResponseWriter.WriteMsg(resp) writeEpoch := uint64(time.Now().Unix()) b := w.TapBuilder() b.TimeSec = w.queryEpoch if w.Send == nil || w.Send.Cq { if err := func() (err error) { err = b.AddrMsg(w.ResponseWriter.RemoteAddr(), w....
[ "func", "(", "w", "*", "ResponseWriter", ")", "WriteMsg", "(", "resp", "*", "dns", ".", "Msg", ")", "(", "writeErr", "error", ")", "{", "writeErr", "=", "w", ".", "ResponseWriter", ".", "WriteMsg", "(", "resp", ")", "\n", "writeEpoch", ":=", "uint64", ...
// WriteMsg writes back the response to the client and THEN works on logging the request // and response to dnstap. // Dnstap errors are to be checked by DnstapError.
[ "WriteMsg", "writes", "back", "the", "response", "to", "the", "client", "and", "THEN", "works", "on", "logging", "the", "request", "and", "response", "to", "dnstap", ".", "Dnstap", "errors", "are", "to", "be", "checked", "by", "DnstapError", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/dnstap/taprw/writer.go#L53-L87
30,466
inverse-inc/packetfence
go/firewallsso/iboss.go
Start
func (fw *Iboss) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { req, err := fw.getRequest(ctx, "login", info) if err != nil { return false, err } resp, err := fw.getHttpClient(ctx).Do(req) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error contacting Iboss: %s"...
go
func (fw *Iboss) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { req, err := fw.getRequest(ctx, "login", info) if err != nil { return false, err } resp, err := fw.getHttpClient(ctx).Do(req) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error contacting Iboss: %s"...
[ "func", "(", "fw", "*", "Iboss", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "req", ",", "err", ":=", "fw", ".", "getReque...
// Send an SSO start to the Iboss firewall // Returns an error unless there is a valid reply from the firewall or if the HTTP request fails to be built
[ "Send", "an", "SSO", "start", "to", "the", "Iboss", "firewall", "Returns", "an", "error", "unless", "there", "is", "a", "valid", "reply", "from", "the", "firewall", "or", "if", "the", "HTTP", "request", "fails", "to", "be", "built" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/iboss.go#L20-L39
30,467
inverse-inc/packetfence
go/firewallsso/iboss.go
getRequest
func (fw *Iboss) getRequest(ctx context.Context, action string, info map[string]string) (*http.Request, error) { req, err := http.NewRequest( "GET", fmt.Sprintf( "http://%s:%s/nacAgent?action=%s&user=%s&dc=%s&key=%s&ip=%s&cn=%s&g=%s", fw.PfconfigHashNS, fw.Port, action, info["username"], fw.NacNa...
go
func (fw *Iboss) getRequest(ctx context.Context, action string, info map[string]string) (*http.Request, error) { req, err := http.NewRequest( "GET", fmt.Sprintf( "http://%s:%s/nacAgent?action=%s&user=%s&dc=%s&key=%s&ip=%s&cn=%s&g=%s", fw.PfconfigHashNS, fw.Port, action, info["username"], fw.NacNa...
[ "func", "(", "fw", "*", "Iboss", ")", "getRequest", "(", "ctx", "context", ".", "Context", ",", "action", "string", ",", "info", "map", "[", "string", "]", "string", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "req", ",", "err", ...
// Build an HTTP request to send to the Iboss firewall // This builds the request for start+stop and is controlled by the action parameter // This will return an error if the request cannot be built
[ "Build", "an", "HTTP", "request", "to", "send", "to", "the", "Iboss", "firewall", "This", "builds", "the", "request", "for", "start", "+", "stop", "and", "is", "controlled", "by", "the", "action", "parameter", "This", "will", "return", "an", "error", "if",...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/iboss.go#L67-L90
30,468
inverse-inc/packetfence
go/caddy/caddy/caddytls/maintain.go
RenewManagedCertificates
func RenewManagedCertificates(allowPrompts bool) (err error) { var renewQueue, deleteQueue []Certificate visitedNames := make(map[string]struct{}) certCacheMu.RLock() for name, cert := range certCache { if !cert.Config.Managed || cert.Config.SelfSigned { continue } // the list of names on this cert shoul...
go
func RenewManagedCertificates(allowPrompts bool) (err error) { var renewQueue, deleteQueue []Certificate visitedNames := make(map[string]struct{}) certCacheMu.RLock() for name, cert := range certCache { if !cert.Config.Managed || cert.Config.SelfSigned { continue } // the list of names on this cert shoul...
[ "func", "RenewManagedCertificates", "(", "allowPrompts", "bool", ")", "(", "err", "error", ")", "{", "var", "renewQueue", ",", "deleteQueue", "[", "]", "Certificate", "\n", "visitedNames", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", "...
// RenewManagedCertificates renews managed certificates.
[ "RenewManagedCertificates", "renews", "managed", "certificates", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/maintain.go#L67-L175
30,469
inverse-inc/packetfence
go/caddy/caddy/caddytls/maintain.go
freshOCSP
func freshOCSP(resp *ocsp.Response) bool { // start checking OCSP staple about halfway through validity period for good measure refreshTime := resp.ThisUpdate.Add(resp.NextUpdate.Sub(resp.ThisUpdate) / 2) return time.Now().Before(refreshTime) }
go
func freshOCSP(resp *ocsp.Response) bool { // start checking OCSP staple about halfway through validity period for good measure refreshTime := resp.ThisUpdate.Add(resp.NextUpdate.Sub(resp.ThisUpdate) / 2) return time.Now().Before(refreshTime) }
[ "func", "freshOCSP", "(", "resp", "*", "ocsp", ".", "Response", ")", "bool", "{", "// start checking OCSP staple about halfway through validity period for good measure", "refreshTime", ":=", "resp", ".", "ThisUpdate", ".", "Add", "(", "resp", ".", "NextUpdate", ".", "...
// freshOCSP returns true if resp is still fresh, // meaning that it is not expedient to get an // updated response from the OCSP server.
[ "freshOCSP", "returns", "true", "if", "resp", "is", "still", "fresh", "meaning", "that", "it", "is", "not", "expedient", "to", "get", "an", "updated", "response", "from", "the", "OCSP", "server", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/maintain.go#L295-L299
30,470
inverse-inc/packetfence
go/caddy/pfipset/utils.go
initIPSet
func (IPSET *pfIPSET) initIPSet(ctx context.Context, db *sql.DB) { logger := log.LoggerWContext(ctx) IPSET.ListALL, _ = ipset.ListAll() rows, err := db.Query("select distinct n.mac, i.ip, n.category_id as node_id from node as n left join locationlog as l on n.mac=l.mac left join ip4log as i on n.mac=i.mac where l.c...
go
func (IPSET *pfIPSET) initIPSet(ctx context.Context, db *sql.DB) { logger := log.LoggerWContext(ctx) IPSET.ListALL, _ = ipset.ListAll() rows, err := db.Query("select distinct n.mac, i.ip, n.category_id as node_id from node as n left join locationlog as l on n.mac=l.mac left join ip4log as i on n.mac=i.mac where l.c...
[ "func", "(", "IPSET", "*", "pfIPSET", ")", "initIPSet", "(", "ctx", "context", ".", "Context", ",", "db", "*", "sql", ".", "DB", ")", "{", "logger", ":=", "log", ".", "LoggerWContext", "(", "ctx", ")", "\n\n", "IPSET", ".", "ListALL", ",", "_", "="...
// initIPSet fetch the database to remove already assigned ip addresses
[ "initIPSet", "fetch", "the", "database", "to", "remove", "already", "assigned", "ip", "addresses" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/pfipset/utils.go#L124-L161
30,471
inverse-inc/packetfence
go/caddy/pfipset/utils.go
detectType
func (IPSET *pfIPSET) detectType(ctx context.Context) error { IPSET.ListALL, _ = ipset.ListAll() var NetIndex net.IPNet IPSET.Network = make(map[*net.IPNet]string) var interfaces pfconfigdriver.ListenInts pfconfigdriver.FetchDecodeSocket(ctx, &interfaces) var keyConfNet pfconfigdriver.PfconfigKeys keyConfNet.P...
go
func (IPSET *pfIPSET) detectType(ctx context.Context) error { IPSET.ListALL, _ = ipset.ListAll() var NetIndex net.IPNet IPSET.Network = make(map[*net.IPNet]string) var interfaces pfconfigdriver.ListenInts pfconfigdriver.FetchDecodeSocket(ctx, &interfaces) var keyConfNet pfconfigdriver.PfconfigKeys keyConfNet.P...
[ "func", "(", "IPSET", "*", "pfIPSET", ")", "detectType", "(", "ctx", "context", ".", "Context", ")", "error", "{", "IPSET", ".", "ListALL", ",", "_", "=", "ipset", ".", "ListAll", "(", ")", "\n", "var", "NetIndex", "net", ".", "IPNet", "\n", "IPSET",...
// detectType of each network
[ "detectType", "of", "each", "network" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/pfipset/utils.go#L164-L215
30,472
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
cacheUnmanagedCertificatePEMFile
func cacheUnmanagedCertificatePEMFile(certFile, keyFile string) error { cert, err := makeCertificateFromDisk(certFile, keyFile) if err != nil { return err } cacheCertificate(cert) return nil }
go
func cacheUnmanagedCertificatePEMFile(certFile, keyFile string) error { cert, err := makeCertificateFromDisk(certFile, keyFile) if err != nil { return err } cacheCertificate(cert) return nil }
[ "func", "cacheUnmanagedCertificatePEMFile", "(", "certFile", ",", "keyFile", "string", ")", "error", "{", "cert", ",", "err", ":=", "makeCertificateFromDisk", "(", "certFile", ",", "keyFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "...
// cacheUnmanagedCertificatePEMFile loads a certificate for host using certFile // and keyFile, which must be in PEM format. It stores the certificate in // memory. The Managed and OnDemand flags of the certificate will be set to // false. // // This function is safe for concurrent use.
[ "cacheUnmanagedCertificatePEMFile", "loads", "a", "certificate", "for", "host", "using", "certFile", "and", "keyFile", "which", "must", "be", "in", "PEM", "format", ".", "It", "stores", "the", "certificate", "in", "memory", ".", "The", "Managed", "and", "OnDeman...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L117-L124
30,473
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
cacheUnmanagedCertificatePEMBytes
func cacheUnmanagedCertificatePEMBytes(certBytes, keyBytes []byte) error { cert, err := makeCertificate(certBytes, keyBytes) if err != nil { return err } cacheCertificate(cert) return nil }
go
func cacheUnmanagedCertificatePEMBytes(certBytes, keyBytes []byte) error { cert, err := makeCertificate(certBytes, keyBytes) if err != nil { return err } cacheCertificate(cert) return nil }
[ "func", "cacheUnmanagedCertificatePEMBytes", "(", "certBytes", ",", "keyBytes", "[", "]", "byte", ")", "error", "{", "cert", ",", "err", ":=", "makeCertificate", "(", "certBytes", ",", "keyBytes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ...
// cacheUnmanagedCertificatePEMBytes makes a certificate out of the PEM bytes // of the certificate and key, then caches it in memory. // // This function is safe for concurrent use.
[ "cacheUnmanagedCertificatePEMBytes", "makes", "a", "certificate", "out", "of", "the", "PEM", "bytes", "of", "the", "certificate", "and", "key", "then", "caches", "it", "in", "memory", ".", "This", "function", "is", "safe", "for", "concurrent", "use", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L130-L137
30,474
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
makeCertificate
func makeCertificate(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { var cert Certificate // Convert to a tls.Certificate tlsCert, err := tls.X509KeyPair(certPEMBlock, keyPEMBlock) if err != nil { return cert, err } if len(tlsCert.Certificate) == 0 { return cert, errors.New("certificate is empty") ...
go
func makeCertificate(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { var cert Certificate // Convert to a tls.Certificate tlsCert, err := tls.X509KeyPair(certPEMBlock, keyPEMBlock) if err != nil { return cert, err } if len(tlsCert.Certificate) == 0 { return cert, errors.New("certificate is empty") ...
[ "func", "makeCertificate", "(", "certPEMBlock", ",", "keyPEMBlock", "[", "]", "byte", ")", "(", "Certificate", ",", "error", ")", "{", "var", "cert", "Certificate", "\n\n", "// Convert to a tls.Certificate", "tlsCert", ",", "err", ":=", "tls", ".", "X509KeyPair"...
// makeCertificate turns a certificate PEM bundle and a key PEM block into // a Certificate, with OCSP and other relevant metadata tagged with it, // except for the OnDemand and Managed flags. It is up to the caller to // set those properties.
[ "makeCertificate", "turns", "a", "certificate", "PEM", "bundle", "and", "a", "key", "PEM", "block", "into", "a", "Certificate", "with", "OCSP", "and", "other", "relevant", "metadata", "tagged", "with", "it", "except", "for", "the", "OnDemand", "and", "Managed"...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L159-L187
30,475
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
fillCertFromLeaf
func fillCertFromLeaf(cert *Certificate, leaf *x509.Certificate) error { if leaf.Subject.CommonName != "" { cert.Names = []string{strings.ToLower(leaf.Subject.CommonName)} } for _, name := range leaf.DNSNames { if name != leaf.Subject.CommonName { cert.Names = append(cert.Names, strings.ToLower(name)) } } ...
go
func fillCertFromLeaf(cert *Certificate, leaf *x509.Certificate) error { if leaf.Subject.CommonName != "" { cert.Names = []string{strings.ToLower(leaf.Subject.CommonName)} } for _, name := range leaf.DNSNames { if name != leaf.Subject.CommonName { cert.Names = append(cert.Names, strings.ToLower(name)) } } ...
[ "func", "fillCertFromLeaf", "(", "cert", "*", "Certificate", ",", "leaf", "*", "x509", ".", "Certificate", ")", "error", "{", "if", "leaf", ".", "Subject", ".", "CommonName", "!=", "\"", "\"", "{", "cert", ".", "Names", "=", "[", "]", "string", "{", ...
// fillCertFromLeaf populates cert.Names and cert.NotAfter // using data in leaf.
[ "fillCertFromLeaf", "populates", "cert", ".", "Names", "and", "cert", ".", "NotAfter", "using", "data", "in", "leaf", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L191-L215
30,476
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
cacheCertificate
func cacheCertificate(cert Certificate) { if cert.Config == nil { cert.Config = new(Config) } certCacheMu.Lock() if _, ok := certCache[""]; !ok { // use as default - must be *appended* to end of list, or bad things happen! cert.Names = append(cert.Names, "") certCache[""] = cert } for len(certCache)+len(c...
go
func cacheCertificate(cert Certificate) { if cert.Config == nil { cert.Config = new(Config) } certCacheMu.Lock() if _, ok := certCache[""]; !ok { // use as default - must be *appended* to end of list, or bad things happen! cert.Names = append(cert.Names, "") certCache[""] = cert } for len(certCache)+len(c...
[ "func", "cacheCertificate", "(", "cert", "Certificate", ")", "{", "if", "cert", ".", "Config", "==", "nil", "{", "cert", ".", "Config", "=", "new", "(", "Config", ")", "\n", "}", "\n", "certCacheMu", ".", "Lock", "(", ")", "\n", "if", "_", ",", "ok...
// cacheCertificate adds cert to the in-memory cache. If the cache is // empty, cert will be used as the default certificate. If the cache is // full, random entries are deleted until there is room to map all the // names on the certificate. // // This certificate will be keyed to the names in cert.Names. Any name // t...
[ "cacheCertificate", "adds", "cert", "to", "the", "in", "-", "memory", "cache", ".", "If", "the", "cache", "is", "empty", "cert", "will", "be", "used", "as", "the", "default", "certificate", ".", "If", "the", "cache", "is", "full", "random", "entries", "a...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L226-L250
30,477
inverse-inc/packetfence
go/caddy/caddy/caddytls/certificates.go
uncacheCertificate
func uncacheCertificate(name string) { certCacheMu.Lock() delete(certCache, name) certCacheMu.Unlock() }
go
func uncacheCertificate(name string) { certCacheMu.Lock() delete(certCache, name) certCacheMu.Unlock() }
[ "func", "uncacheCertificate", "(", "name", "string", ")", "{", "certCacheMu", ".", "Lock", "(", ")", "\n", "delete", "(", "certCache", ",", "name", ")", "\n", "certCacheMu", ".", "Unlock", "(", ")", "\n", "}" ]
// uncacheCertificate deletes name's certificate from the // cache. If name is not a key in the certificate cache, // this function does nothing.
[ "uncacheCertificate", "deletes", "name", "s", "certificate", "from", "the", "cache", ".", "If", "name", "is", "not", "a", "key", "in", "the", "certificate", "cache", "this", "function", "does", "nothing", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/caddy/caddytls/certificates.go#L255-L259
30,478
inverse-inc/packetfence
go/caddy/pfconfig/pool.go
setup
func setup(c *caddy.Controller) error { httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return PoolHandler{Next: next, refreshLauncher: &sync.Once{}} }) return nil }
go
func setup(c *caddy.Controller) error { httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return PoolHandler{Next: next, refreshLauncher: &sync.Once{}} }) return nil }
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "httpserver", ".", "GetConfig", "(", "c", ")", ".", "AddMiddleware", "(", "func", "(", "next", "httpserver", ".", "Handler", ")", "httpserver", ".", "Handler", "{", "return", ...
// Setup an async goroutine that refreshes the pfconfig pool every second
[ "Setup", "an", "async", "goroutine", "that", "refreshes", "the", "pfconfig", "pool", "every", "second" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/pfconfig/pool.go#L22-L28
30,479
inverse-inc/packetfence
go/caddy/pfconfig/pool.go
ServeHTTP
func (h PoolHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { id, err := pfconfigdriver.PfconfigPool.ReadLock(r.Context()) if err == nil { defer pfconfigdriver.PfconfigPool.ReadUnlock(r.Context(), id) // We launch the refresh job once, the first time a request comes in // This ensures t...
go
func (h PoolHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { id, err := pfconfigdriver.PfconfigPool.ReadLock(r.Context()) if err == nil { defer pfconfigdriver.PfconfigPool.ReadUnlock(r.Context(), id) // We launch the refresh job once, the first time a request comes in // This ensures t...
[ "func", "(", "h", "PoolHandler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "(", "int", ",", "error", ")", "{", "id", ",", "err", ":=", "pfconfigdriver", ".", "PfconfigPool", ".", "ReadLock", ...
// Middleware that ensures there is a read-lock on the pool during every request and released when the request is done
[ "Middleware", "that", "ensures", "there", "is", "a", "read", "-", "lock", "on", "the", "pool", "during", "every", "request", "and", "released", "when", "the", "request", "is", "done" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/pfconfig/pool.go#L36-L57
30,480
inverse-inc/packetfence
go/coredns/plugin/pkg/healthcheck/healthcheck.go
Down
func (uh *UpstreamHost) Down() bool { if uh.CheckDown == nil { fails := atomic.LoadInt32(&uh.Fails) return fails > 0 } return uh.CheckDown(uh) }
go
func (uh *UpstreamHost) Down() bool { if uh.CheckDown == nil { fails := atomic.LoadInt32(&uh.Fails) return fails > 0 } return uh.CheckDown(uh) }
[ "func", "(", "uh", "*", "UpstreamHost", ")", "Down", "(", ")", "bool", "{", "if", "uh", ".", "CheckDown", "==", "nil", "{", "fails", ":=", "atomic", ".", "LoadInt32", "(", "&", "uh", ".", "Fails", ")", "\n", "return", "fails", ">", "0", "\n", "}"...
// Down checks whether the upstream host is down or not. // Down will try to use uh.CheckDown first, and will fall // back to some default criteria if necessary.
[ "Down", "checks", "whether", "the", "upstream", "host", "is", "down", "or", "not", ".", "Down", "will", "try", "to", "use", "uh", ".", "CheckDown", "first", "and", "will", "fall", "back", "to", "some", "default", "criteria", "if", "necessary", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/healthcheck/healthcheck.go#L33-L39
30,481
inverse-inc/packetfence
go/coredns/plugin/pkg/healthcheck/healthcheck.go
Start
func (u *HealthCheck) Start() { for i, h := range u.Hosts { u.Hosts[i].CheckURL = u.normalizeCheckURL(h.Name) } u.stop = make(chan struct{}) if u.Path != "" { u.wg.Add(1) go func() { defer u.wg.Done() u.healthCheckWorker(u.stop) }() } }
go
func (u *HealthCheck) Start() { for i, h := range u.Hosts { u.Hosts[i].CheckURL = u.normalizeCheckURL(h.Name) } u.stop = make(chan struct{}) if u.Path != "" { u.wg.Add(1) go func() { defer u.wg.Done() u.healthCheckWorker(u.stop) }() } }
[ "func", "(", "u", "*", "HealthCheck", ")", "Start", "(", ")", "{", "for", "i", ",", "h", ":=", "range", "u", ".", "Hosts", "{", "u", ".", "Hosts", "[", "i", "]", ".", "CheckURL", "=", "u", ".", "normalizeCheckURL", "(", "h", ".", "Name", ")", ...
// Start starts the healthcheck
[ "Start", "starts", "the", "healthcheck" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/healthcheck/healthcheck.go#L61-L74
30,482
inverse-inc/packetfence
go/coredns/plugin/pkg/healthcheck/healthcheck.go
HealthCheckURL
func (uh *UpstreamHost) HealthCheckURL() { // Lock for our bool check. We don't just defer the unlock because // we don't want the lock held while http.Get runs. uh.Lock() // We call HealthCheckURL from proxy.go and lookup.go, bail out when nothing // is configured to healthcheck. Or we mid check? Don't run ano...
go
func (uh *UpstreamHost) HealthCheckURL() { // Lock for our bool check. We don't just defer the unlock because // we don't want the lock held while http.Get runs. uh.Lock() // We call HealthCheckURL from proxy.go and lookup.go, bail out when nothing // is configured to healthcheck. Or we mid check? Don't run ano...
[ "func", "(", "uh", "*", "UpstreamHost", ")", "HealthCheckURL", "(", ")", "{", "// Lock for our bool check. We don't just defer the unlock because", "// we don't want the lock held while http.Get runs.", "uh", ".", "Lock", "(", ")", "\n\n", "// We call HealthCheckURL from proxy.g...
// This was moved into a thread so that each host could throw a health // check at the same time. The reason for this is that if we are checking // 3 hosts, and the first one is gone, and we spend minutes timing out to // fail it, we would not have been doing any other health checks in that // time. So we now have a ...
[ "This", "was", "moved", "into", "a", "thread", "so", "that", "each", "host", "could", "throw", "a", "health", "check", "at", "the", "same", "time", ".", "The", "reason", "for", "this", "is", "that", "if", "we", "are", "checking", "3", "hosts", "and", ...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/healthcheck/healthcheck.go#L100-L142
30,483
inverse-inc/packetfence
go/coredns/plugin/pkg/healthcheck/healthcheck.go
Select
func (u *HealthCheck) Select() *UpstreamHost { pool := u.Hosts if len(pool) == 1 { if pool[0].Down() && u.Spray == nil { return nil } return pool[0] } allDown := true for _, host := range pool { if !host.Down() { allDown = false break } } if allDown { if u.Spray == nil { return nil } ...
go
func (u *HealthCheck) Select() *UpstreamHost { pool := u.Hosts if len(pool) == 1 { if pool[0].Down() && u.Spray == nil { return nil } return pool[0] } allDown := true for _, host := range pool { if !host.Down() { allDown = false break } } if allDown { if u.Spray == nil { return nil } ...
[ "func", "(", "u", "*", "HealthCheck", ")", "Select", "(", ")", "*", "UpstreamHost", "{", "pool", ":=", "u", ".", "Hosts", "\n", "if", "len", "(", "pool", ")", "==", "1", "{", "if", "pool", "[", "0", "]", ".", "Down", "(", ")", "&&", "u", ".",...
// Select selects an upstream host based on the policy // and the healthcheck result.
[ "Select", "selects", "an", "upstream", "host", "based", "on", "the", "policy", "and", "the", "healthcheck", "result", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/healthcheck/healthcheck.go#L167-L209
30,484
inverse-inc/packetfence
go/coredns/plugin/pkg/healthcheck/healthcheck.go
normalizeCheckURL
func (u *HealthCheck) normalizeCheckURL(name string) string { // The DNS server might be an HTTP server. If so, extract its name. hostName := name ret, err := url.Parse(name) if err == nil && len(ret.Host) > 0 { hostName = ret.Host } // Extract the port number from the parsed server name. checkHostName, chec...
go
func (u *HealthCheck) normalizeCheckURL(name string) string { // The DNS server might be an HTTP server. If so, extract its name. hostName := name ret, err := url.Parse(name) if err == nil && len(ret.Host) > 0 { hostName = ret.Host } // Extract the port number from the parsed server name. checkHostName, chec...
[ "func", "(", "u", "*", "HealthCheck", ")", "normalizeCheckURL", "(", "name", "string", ")", "string", "{", "// The DNS server might be an HTTP server. If so, extract its name.", "hostName", ":=", "name", "\n", "ret", ",", "err", ":=", "url", ".", "Parse", "(", "n...
// normalizeCheckURL creates a proper URL for the health check.
[ "normalizeCheckURL", "creates", "a", "proper", "URL", "for", "the", "health", "check", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/healthcheck/healthcheck.go#L212-L232
30,485
inverse-inc/packetfence
go/caddy/job-status/job-status.go
buildJobStatusHandler
func buildJobStatusHandler(ctx context.Context) (JobStatusHandler, error) { jobStatus := JobStatusHandler{} pfconfigdriver.PfconfigPool.AddStruct(ctx, &redisclient.Config) var network string if redisclient.Config.RedisArgs.Server[0] == '/' { network = "unix" } else { network = "tcp" } jobStatus.redis = re...
go
func buildJobStatusHandler(ctx context.Context) (JobStatusHandler, error) { jobStatus := JobStatusHandler{} pfconfigdriver.PfconfigPool.AddStruct(ctx, &redisclient.Config) var network string if redisclient.Config.RedisArgs.Server[0] == '/' { network = "unix" } else { network = "tcp" } jobStatus.redis = re...
[ "func", "buildJobStatusHandler", "(", "ctx", "context", ".", "Context", ")", "(", "JobStatusHandler", ",", "error", ")", "{", "jobStatus", ":=", "JobStatusHandler", "{", "}", "\n\n", "pfconfigdriver", ".", "PfconfigPool", ".", "AddStruct", "(", "ctx", ",", "&"...
// Build the JobStatusHandler which will initialize the cache and instantiate the router along with its routes
[ "Build", "the", "JobStatusHandler", "which", "will", "initialize", "the", "cache", "and", "instantiate", "the", "router", "along", "with", "its", "routes" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/caddy/job-status/job-status.go#L66-L90
30,486
inverse-inc/packetfence
go/panichandler/panichandler.go
Http
func Http(ctx context.Context, w http.ResponseWriter) { if r := recover(); r != nil { outputPanic(ctx, r) http.Error(w, httpErrorMsg, http.StatusInternalServerError) } }
go
func Http(ctx context.Context, w http.ResponseWriter) { if r := recover(); r != nil { outputPanic(ctx, r) http.Error(w, httpErrorMsg, http.StatusInternalServerError) } }
[ "func", "Http", "(", "ctx", "context", ".", "Context", ",", "w", "http", ".", "ResponseWriter", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "outputPanic", "(", "ctx", ",", "r", ")", "\n", "http", ".", "Error", "(",...
// Defered panic handler that will write an error into the HTTP body and call outputPanic
[ "Defered", "panic", "handler", "that", "will", "write", "an", "error", "into", "the", "HTTP", "body", "and", "call", "outputPanic" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/panichandler/panichandler.go#L16-L21
30,487
inverse-inc/packetfence
go/panichandler/panichandler.go
Standard
func Standard(ctx context.Context) { if r := recover(); r != nil { outputPanic(ctx, r) } }
go
func Standard(ctx context.Context) { if r := recover(); r != nil { outputPanic(ctx, r) } }
[ "func", "Standard", "(", "ctx", "context", ".", "Context", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "outputPanic", "(", "ctx", ",", "r", ")", "\n", "}", "\n", "}" ]
// Defered panic handler that calls outputPanic
[ "Defered", "panic", "handler", "that", "calls", "outputPanic" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/panichandler/panichandler.go#L24-L28
30,488
inverse-inc/packetfence
go/panichandler/panichandler.go
outputPanic
func outputPanic(ctx context.Context, recovered interface{}) { msg := fmt.Sprintf("Recovered panic: %s.", recovered) log.LoggerWContext(ctx).Error(msg) fmt.Fprintln(os.Stderr, msg) debug.PrintStack() }
go
func outputPanic(ctx context.Context, recovered interface{}) { msg := fmt.Sprintf("Recovered panic: %s.", recovered) log.LoggerWContext(ctx).Error(msg) fmt.Fprintln(os.Stderr, msg) debug.PrintStack() }
[ "func", "outputPanic", "(", "ctx", "context", ".", "Context", ",", "recovered", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "recovered", ")", "\n", "log", ".", "LoggerWContext", "(", "ctx", ")", ".", "Er...
// Output a panic error message along with its stacktrace // The stacktrace will start from this function up to where the panic was initially called // The stack and message are outputted in STDERR and a log line is added in Error
[ "Output", "a", "panic", "error", "message", "along", "with", "its", "stacktrace", "The", "stacktrace", "will", "start", "from", "this", "function", "up", "to", "where", "the", "panic", "was", "initially", "called", "The", "stack", "and", "message", "are", "o...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/panichandler/panichandler.go#L33-L38
30,489
inverse-inc/packetfence
go/coredns/plugin/etcd/stub_handler.go
hasStubEdns0
func hasStubEdns0(m *dns.Msg) bool { option := m.IsEdns0() if option == nil { return false } for _, o := range option.Option { if o.Option() == ednsStubCode && len(o.(*dns.EDNS0_LOCAL).Data) == 1 && o.(*dns.EDNS0_LOCAL).Data[0] == 1 { return true } } return false }
go
func hasStubEdns0(m *dns.Msg) bool { option := m.IsEdns0() if option == nil { return false } for _, o := range option.Option { if o.Option() == ednsStubCode && len(o.(*dns.EDNS0_LOCAL).Data) == 1 && o.(*dns.EDNS0_LOCAL).Data[0] == 1 { return true } } return false }
[ "func", "hasStubEdns0", "(", "m", "*", "dns", ".", "Msg", ")", "bool", "{", "option", ":=", "m", ".", "IsEdns0", "(", ")", "\n", "if", "option", "==", "nil", "{", "return", "false", "\n", "}", "\n", "for", "_", ",", "o", ":=", "range", "option", ...
// hasStubEdns0 checks if the message is carrying our special edns0 zero option.
[ "hasStubEdns0", "checks", "if", "the", "message", "is", "carrying", "our", "special", "edns0", "zero", "option", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/etcd/stub_handler.go#L43-L55
30,490
inverse-inc/packetfence
go/coredns/plugin/etcd/stub_handler.go
addStubEdns0
func addStubEdns0(m *dns.Msg) *dns.Msg { option := m.IsEdns0() // Add a custom EDNS0 option to the packet, so we can detect loops when 2 stubs are forwarding to each other. if option != nil { option.Option = append(option.Option, &dns.EDNS0_LOCAL{Code: ednsStubCode, Data: []byte{1}}) return m } m.Extra = appe...
go
func addStubEdns0(m *dns.Msg) *dns.Msg { option := m.IsEdns0() // Add a custom EDNS0 option to the packet, so we can detect loops when 2 stubs are forwarding to each other. if option != nil { option.Option = append(option.Option, &dns.EDNS0_LOCAL{Code: ednsStubCode, Data: []byte{1}}) return m } m.Extra = appe...
[ "func", "addStubEdns0", "(", "m", "*", "dns", ".", "Msg", ")", "*", "dns", ".", "Msg", "{", "option", ":=", "m", ".", "IsEdns0", "(", ")", "\n", "// Add a custom EDNS0 option to the packet, so we can detect loops when 2 stubs are forwarding to each other.", "if", "opt...
// addStubEdns0 adds our special option to the message's OPT record.
[ "addStubEdns0", "adds", "our", "special", "option", "to", "the", "message", "s", "OPT", "record", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/etcd/stub_handler.go#L58-L68
30,491
inverse-inc/packetfence
go/coredns/plugin/dnstap/msg/wrapper.go
Wrap
func Wrap(m *lib.Message) lib.Dnstap { t := lib.Dnstap_MESSAGE return lib.Dnstap{ Type: &t, Message: m, } }
go
func Wrap(m *lib.Message) lib.Dnstap { t := lib.Dnstap_MESSAGE return lib.Dnstap{ Type: &t, Message: m, } }
[ "func", "Wrap", "(", "m", "*", "lib", ".", "Message", ")", "lib", ".", "Dnstap", "{", "t", ":=", "lib", ".", "Dnstap_MESSAGE", "\n", "return", "lib", ".", "Dnstap", "{", "Type", ":", "&", "t", ",", "Message", ":", "m", ",", "}", "\n", "}" ]
// Wrap a dnstap message in the top-level dnstap type.
[ "Wrap", "a", "dnstap", "message", "in", "the", "top", "-", "level", "dnstap", "type", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/dnstap/msg/wrapper.go#L11-L17
30,492
inverse-inc/packetfence
go/coredns/plugin/dnstap/msg/wrapper.go
Marshal
func Marshal(m *lib.Message) (data []byte, err error) { payload := Wrap(m) data, err = proto.Marshal(&payload) if err != nil { err = fmt.Errorf("proto: %s", err) return } return }
go
func Marshal(m *lib.Message) (data []byte, err error) { payload := Wrap(m) data, err = proto.Marshal(&payload) if err != nil { err = fmt.Errorf("proto: %s", err) return } return }
[ "func", "Marshal", "(", "m", "*", "lib", ".", "Message", ")", "(", "data", "[", "]", "byte", ",", "err", "error", ")", "{", "payload", ":=", "Wrap", "(", "m", ")", "\n", "data", ",", "err", "=", "proto", ".", "Marshal", "(", "&", "payload", ")"...
// Marshal encodes the message to a binary dnstap payload.
[ "Marshal", "encodes", "the", "message", "to", "a", "binary", "dnstap", "payload", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/dnstap/msg/wrapper.go#L20-L28
30,493
inverse-inc/packetfence
go/coredns/plugin/pkg/dnsutil/dedup.go
Dedup
func Dedup(m *dns.Msg) *dns.Msg { // TODO(miek): expensive! m.Answer = dns.Dedup(m.Answer, nil) m.Ns = dns.Dedup(m.Ns, nil) m.Extra = dns.Dedup(m.Extra, nil) return m }
go
func Dedup(m *dns.Msg) *dns.Msg { // TODO(miek): expensive! m.Answer = dns.Dedup(m.Answer, nil) m.Ns = dns.Dedup(m.Ns, nil) m.Extra = dns.Dedup(m.Extra, nil) return m }
[ "func", "Dedup", "(", "m", "*", "dns", ".", "Msg", ")", "*", "dns", ".", "Msg", "{", "// TODO(miek): expensive!", "m", ".", "Answer", "=", "dns", ".", "Dedup", "(", "m", ".", "Answer", ",", "nil", ")", "\n", "m", ".", "Ns", "=", "dns", ".", "De...
// Dedup de-duplicates a message.
[ "Dedup", "de", "-", "duplicates", "a", "message", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/plugin/pkg/dnsutil/dedup.go#L6-L12
30,494
inverse-inc/packetfence
go/coredns/core/dnsserver/register.go
init
func init() { flag.StringVar(&Port, serverType+".port", DefaultPort, "Default port") caddy.RegisterServerType(serverType, caddy.ServerType{ Directives: func() []string { return directives }, DefaultInput: func() caddy.Input { return caddy.CaddyfileInput{ Filepath: "Corefile", Contents: []b...
go
func init() { flag.StringVar(&Port, serverType+".port", DefaultPort, "Default port") caddy.RegisterServerType(serverType, caddy.ServerType{ Directives: func() []string { return directives }, DefaultInput: func() caddy.Input { return caddy.CaddyfileInput{ Filepath: "Corefile", Contents: []b...
[ "func", "init", "(", ")", "{", "flag", ".", "StringVar", "(", "&", "Port", ",", "serverType", "+", "\"", "\"", ",", "DefaultPort", ",", "\"", "\"", ")", "\n\n", "caddy", ".", "RegisterServerType", "(", "serverType", ",", "caddy", ".", "ServerType", "{"...
// Any flags defined here, need to be namespaced to the serverType other // wise they potentially clash with other server types.
[ "Any", "flags", "defined", "here", "need", "to", "be", "namespaced", "to", "the", "serverType", "other", "wise", "they", "potentially", "clash", "with", "other", "server", "types", "." ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/coredns/core/dnsserver/register.go#L21-L35
30,495
inverse-inc/packetfence
go/firewallsso/paloalto.go
initChild
func (fw *PaloAlto) initChild(ctx context.Context) error { // Set a default value for vsys if there is none if fw.Vsys == "" { log.LoggerWContext(ctx).Debug("Setting default value for vsys as it isn't defined") fw.Vsys = "1" } return nil }
go
func (fw *PaloAlto) initChild(ctx context.Context) error { // Set a default value for vsys if there is none if fw.Vsys == "" { log.LoggerWContext(ctx).Debug("Setting default value for vsys as it isn't defined") fw.Vsys = "1" } return nil }
[ "func", "(", "fw", "*", "PaloAlto", ")", "initChild", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// Set a default value for vsys if there is none", "if", "fw", ".", "Vsys", "==", "\"", "\"", "{", "log", ".", "LoggerWContext", "(", "ctx", ")",...
// Firewall specific init
[ "Firewall", "specific", "init" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/paloalto.go#L22-L29
30,496
inverse-inc/packetfence
go/firewallsso/paloalto.go
Start
func (fw *PaloAlto) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { if fw.Transport == "syslog" { log.LoggerWContext(ctx).Info("Sending SSO to PaloAlto using syslog") return fw.startSyslog(ctx, info, timeout) } else { log.LoggerWContext(ctx).Info("Sending SSO to PaloAlto using HT...
go
func (fw *PaloAlto) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) { if fw.Transport == "syslog" { log.LoggerWContext(ctx).Info("Sending SSO to PaloAlto using syslog") return fw.startSyslog(ctx, info, timeout) } else { log.LoggerWContext(ctx).Info("Sending SSO to PaloAlto using HT...
[ "func", "(", "fw", "*", "PaloAlto", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "if", "fw", ".", "Transport", "==", "\"", ...
// Send an SSO start to the PaloAlto using either syslog or HTTP depending on the Transport value of the struct // This will return any value from startSyslog or startHttp depending on the type of the transport
[ "Send", "an", "SSO", "start", "to", "the", "PaloAlto", "using", "either", "syslog", "or", "HTTP", "depending", "on", "the", "Transport", "value", "of", "the", "struct", "This", "will", "return", "any", "value", "from", "startSyslog", "or", "startHttp", "depe...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/paloalto.go#L33-L41
30,497
inverse-inc/packetfence
go/firewallsso/paloalto.go
getSyslog
func (fw *PaloAlto) getSyslog(ctx context.Context) (*syslog.Writer, error) { writer, err := syslog.Dial("udp", fw.PfconfigHashNS+":514", syslog.LOG_ERR|syslog.LOG_LOCAL5, "pfsso") if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error connecting to PaloAlto: %s", err)) return nil, err } return write...
go
func (fw *PaloAlto) getSyslog(ctx context.Context) (*syslog.Writer, error) { writer, err := syslog.Dial("udp", fw.PfconfigHashNS+":514", syslog.LOG_ERR|syslog.LOG_LOCAL5, "pfsso") if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error connecting to PaloAlto: %s", err)) return nil, err } return write...
[ "func", "(", "fw", "*", "PaloAlto", ")", "getSyslog", "(", "ctx", "context", ".", "Context", ")", "(", "*", "syslog", ".", "Writer", ",", "error", ")", "{", "writer", ",", "err", ":=", "syslog", ".", "Dial", "(", "\"", "\"", ",", "fw", ".", "Pfco...
// Get a syslog writter connection to the PaloAlto // This will always connect to port 514 and ignore the Port parameter // Returns an error if it can't connect but given its UDP, this should never fail
[ "Get", "a", "syslog", "writter", "connection", "to", "the", "PaloAlto", "This", "will", "always", "connect", "to", "port", "514", "and", "ignore", "the", "Port", "parameter", "Returns", "an", "error", "if", "it", "can", "t", "connect", "but", "given", "its...
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/paloalto.go#L46-L55
30,498
inverse-inc/packetfence
go/firewallsso/paloalto.go
sendSyslog
func (fw *PaloAlto) sendSyslog(ctx context.Context, line string) error { writer, err := fw.getSyslog(ctx) if err != nil { return err } err = writer.Err(line) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error sending message to PaloAlto: %s", err)) return err } return nil }
go
func (fw *PaloAlto) sendSyslog(ctx context.Context, line string) error { writer, err := fw.getSyslog(ctx) if err != nil { return err } err = writer.Err(line) if err != nil { log.LoggerWContext(ctx).Error(fmt.Sprintf("Error sending message to PaloAlto: %s", err)) return err } return nil }
[ "func", "(", "fw", "*", "PaloAlto", ")", "sendSyslog", "(", "ctx", "context", ".", "Context", ",", "line", "string", ")", "error", "{", "writer", ",", "err", ":=", "fw", ".", "getSyslog", "(", "ctx", ")", "\n\n", "if", "err", "!=", "nil", "{", "ret...
// Send a syslog line to the PaloAlto // Will return an error if it fails to send the message
[ "Send", "a", "syslog", "line", "to", "the", "PaloAlto", "Will", "return", "an", "error", "if", "it", "fails", "to", "send", "the", "message" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/paloalto.go#L59-L74
30,499
inverse-inc/packetfence
go/firewallsso/paloalto.go
startSyslog
func (fw *PaloAlto) startSyslog(ctx context.Context, info map[string]string, timeout int) (bool, error) { if err := fw.sendSyslog(ctx, fmt.Sprintf("Group <packetfence> User <%s> Address <%s> assigned to session", info["username"], info["ip"])); err != nil { return false, err } else { return true, nil } }
go
func (fw *PaloAlto) startSyslog(ctx context.Context, info map[string]string, timeout int) (bool, error) { if err := fw.sendSyslog(ctx, fmt.Sprintf("Group <packetfence> User <%s> Address <%s> assigned to session", info["username"], info["ip"])); err != nil { return false, err } else { return true, nil } }
[ "func", "(", "fw", "*", "PaloAlto", ")", "startSyslog", "(", "ctx", "context", ".", "Context", ",", "info", "map", "[", "string", "]", "string", ",", "timeout", "int", ")", "(", "bool", ",", "error", ")", "{", "if", "err", ":=", "fw", ".", "sendSys...
// Send a start to the PaloAlto using the syslog transport // Will return an error if it fails to send the message
[ "Send", "a", "start", "to", "the", "PaloAlto", "using", "the", "syslog", "transport", "Will", "return", "an", "error", "if", "it", "fails", "to", "send", "the", "message" ]
f29912bde7974931d699aba60aa8fde1c5d9a826
https://github.com/inverse-inc/packetfence/blob/f29912bde7974931d699aba60aa8fde1c5d9a826/go/firewallsso/paloalto.go#L78-L84