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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
17,400
chewxy/lingo
corpus/corpus.go
Word
func (c *Corpus) Word(id int) (string, bool) { size := atomic.LoadInt64(&c.maxid) maxid := int(size) if id >= maxid { return "", false } return c.words[id], true }
go
func (c *Corpus) Word(id int) (string, bool) { size := atomic.LoadInt64(&c.maxid) maxid := int(size) if id >= maxid { return "", false } return c.words[id], true }
[ "func", "(", "c", "*", "Corpus", ")", "Word", "(", "id", "int", ")", "(", "string", ",", "bool", ")", "{", "size", ":=", "atomic", ".", "LoadInt64", "(", "&", "c", ".", "maxid", ")", "\n", "maxid", ":=", "int", "(", "size", ")", "\n\n", "if", ...
// Word returns the word given the ID, and whether or not it was found in the corpus
[ "Word", "returns", "the", "word", "given", "the", "ID", "and", "whether", "or", "not", "it", "was", "found", "in", "the", "corpus" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L70-L78
17,401
chewxy/lingo
corpus/corpus.go
Add
func (c *Corpus) Add(word string) int { if id, ok := c.ids[word]; ok { c.frequencies[id]++ c.totalFreq++ return id } id := atomic.AddInt64(&c.maxid, 1) c.ids[word] = int(id - 1) c.words = append(c.words, word) c.frequencies = append(c.frequencies, 1) c.totalFreq++ runeCount := utf8.RuneCountInString(word) if runeCount > c.maxWordLength { c.maxWordLength = runeCount } return int(id - 1) }
go
func (c *Corpus) Add(word string) int { if id, ok := c.ids[word]; ok { c.frequencies[id]++ c.totalFreq++ return id } id := atomic.AddInt64(&c.maxid, 1) c.ids[word] = int(id - 1) c.words = append(c.words, word) c.frequencies = append(c.frequencies, 1) c.totalFreq++ runeCount := utf8.RuneCountInString(word) if runeCount > c.maxWordLength { c.maxWordLength = runeCount } return int(id - 1) }
[ "func", "(", "c", "*", "Corpus", ")", "Add", "(", "word", "string", ")", "int", "{", "if", "id", ",", "ok", ":=", "c", ".", "ids", "[", "word", "]", ";", "ok", "{", "c", ".", "frequencies", "[", "id", "]", "++", "\n", "c", ".", "totalFreq", ...
// Add adds a word to the corpus and returns its ID. If a word was previously in the corpus, it merely updates the frequency count and returns the ID
[ "Add", "adds", "a", "word", "to", "the", "corpus", "and", "returns", "its", "ID", ".", "If", "a", "word", "was", "previously", "in", "the", "corpus", "it", "merely", "updates", "the", "frequency", "count", "and", "returns", "the", "ID" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L81-L100
17,402
chewxy/lingo
corpus/corpus.go
Size
func (c *Corpus) Size() int { size := atomic.LoadInt64(&c.maxid) return int(size) }
go
func (c *Corpus) Size() int { size := atomic.LoadInt64(&c.maxid) return int(size) }
[ "func", "(", "c", "*", "Corpus", ")", "Size", "(", ")", "int", "{", "size", ":=", "atomic", ".", "LoadInt64", "(", "&", "c", ".", "maxid", ")", "\n", "return", "int", "(", "size", ")", "\n", "}" ]
// Size returns the size of the corpus.
[ "Size", "returns", "the", "size", "of", "the", "corpus", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L103-L106
17,403
chewxy/lingo
corpus/corpus.go
WordFreq
func (c *Corpus) WordFreq(word string) int { id, ok := c.ids[word] if !ok { return 0 } return c.frequencies[id] }
go
func (c *Corpus) WordFreq(word string) int { id, ok := c.ids[word] if !ok { return 0 } return c.frequencies[id] }
[ "func", "(", "c", "*", "Corpus", ")", "WordFreq", "(", "word", "string", ")", "int", "{", "id", ",", "ok", ":=", "c", ".", "ids", "[", "word", "]", "\n", "if", "!", "ok", "{", "return", "0", "\n", "}", "\n\n", "return", "c", ".", "frequencies",...
// WordFreq returns the frequency of the word. If the word wasn't in the corpus, it returns 0.
[ "WordFreq", "returns", "the", "frequency", "of", "the", "word", ".", "If", "the", "word", "wasn", "t", "in", "the", "corpus", "it", "returns", "0", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L109-L116
17,404
chewxy/lingo
corpus/corpus.go
IDFreq
func (c *Corpus) IDFreq(id int) int { size := atomic.LoadInt64(&c.maxid) maxid := int(size) if id >= maxid { return 0 } return c.frequencies[id] }
go
func (c *Corpus) IDFreq(id int) int { size := atomic.LoadInt64(&c.maxid) maxid := int(size) if id >= maxid { return 0 } return c.frequencies[id] }
[ "func", "(", "c", "*", "Corpus", ")", "IDFreq", "(", "id", "int", ")", "int", "{", "size", ":=", "atomic", ".", "LoadInt64", "(", "&", "c", ".", "maxid", ")", "\n", "maxid", ":=", "int", "(", "size", ")", "\n\n", "if", "id", ">=", "maxid", "{",...
// IDFreq returns the frequency of a word given an ID. If the word isn't in the corpus it returns 0.
[ "IDFreq", "returns", "the", "frequency", "of", "a", "word", "given", "an", "ID", ".", "If", "the", "word", "isn", "t", "in", "the", "corpus", "it", "returns", "0", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L119-L127
17,405
chewxy/lingo
corpus/corpus.go
WordProb
func (c *Corpus) WordProb(word string) (float64, bool) { id, ok := c.Id(word) if !ok { return 0, false } count := c.frequencies[id] return float64(count) / float64(c.totalFreq), true }
go
func (c *Corpus) WordProb(word string) (float64, bool) { id, ok := c.Id(word) if !ok { return 0, false } count := c.frequencies[id] return float64(count) / float64(c.totalFreq), true }
[ "func", "(", "c", "*", "Corpus", ")", "WordProb", "(", "word", "string", ")", "(", "float64", ",", "bool", ")", "{", "id", ",", "ok", ":=", "c", ".", "Id", "(", "word", ")", "\n", "if", "!", "ok", "{", "return", "0", ",", "false", "\n", "}", ...
// WordProb returns the probability of a word appearing in the corpus.
[ "WordProb", "returns", "the", "probability", "of", "a", "word", "appearing", "in", "the", "corpus", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L140-L149
17,406
chewxy/lingo
corpus/corpus.go
Merge
func (c *Corpus) Merge(other *Corpus) { for i, word := range other.words { freq := other.frequencies[i] if id, ok := c.ids[word]; ok { c.frequencies[id] += freq c.totalFreq += freq } else { id := c.Add(word) c.frequencies[id] += freq - 1 c.totalFreq += freq - 1 } } }
go
func (c *Corpus) Merge(other *Corpus) { for i, word := range other.words { freq := other.frequencies[i] if id, ok := c.ids[word]; ok { c.frequencies[id] += freq c.totalFreq += freq } else { id := c.Add(word) c.frequencies[id] += freq - 1 c.totalFreq += freq - 1 } } }
[ "func", "(", "c", "*", "Corpus", ")", "Merge", "(", "other", "*", "Corpus", ")", "{", "for", "i", ",", "word", ":=", "range", "other", ".", "words", "{", "freq", ":=", "other", ".", "frequencies", "[", "i", "]", "\n", "if", "id", ",", "ok", ":=...
// Merge combines two corpuses. The receiver is the one that is mutated.
[ "Merge", "combines", "two", "corpuses", ".", "The", "receiver", "is", "the", "one", "that", "is", "mutated", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/corpus.go#L152-L164
17,407
chewxy/lingo
dep/evaluation.go
Evaluate
func Evaluate(predictedTrees, goldTrees []*lingo.Dependency) Performance { if len(predictedTrees) != len(goldTrees) { panic(fmt.Sprintf("%d predicted trees; %d gold trees. Unable to compare", len(predictedTrees), len(goldTrees))) } var correctLabels, correctHeads, correctTrees, correctRoot, sumArcs float64 var check int for i, tr := range predictedTrees { gTr := goldTrees[i] if len(tr.AnnotatedSentence) != len(gTr.AnnotatedSentence) { sumArcs += float64(gTr.N()) // log.Printf("WARNING: %q and %q do not have the same length", tr, gTr) continue } var nCorrectHead int for j, a := range tr.AnnotatedSentence[1:] { b := gTr.AnnotatedSentence[j+1] if a.HeadID() == b.HeadID() { correctHeads++ nCorrectHead++ } if a.DependencyType == b.DependencyType { correctLabels++ } sumArcs++ } if nCorrectHead == gTr.N() { correctTrees++ } if tr.Root() == gTr.Root() { correctRoot++ } // check 5 per iteration if check < 5 { logf("predictedHeads: \n%v\n%v\n", tr.Heads(), gTr.Heads()) logf("Ns: %v | %v || Correct: %v", tr.N(), gTr.N(), nCorrectHead) check++ } } uas := correctHeads / sumArcs las := correctLabels / sumArcs uem := correctTrees / float64(len(predictedTrees)) roo := correctRoot / float64(len(predictedTrees)) return Performance{UAS: uas, LAS: las, UEM: uem, Root: roo} }
go
func Evaluate(predictedTrees, goldTrees []*lingo.Dependency) Performance { if len(predictedTrees) != len(goldTrees) { panic(fmt.Sprintf("%d predicted trees; %d gold trees. Unable to compare", len(predictedTrees), len(goldTrees))) } var correctLabels, correctHeads, correctTrees, correctRoot, sumArcs float64 var check int for i, tr := range predictedTrees { gTr := goldTrees[i] if len(tr.AnnotatedSentence) != len(gTr.AnnotatedSentence) { sumArcs += float64(gTr.N()) // log.Printf("WARNING: %q and %q do not have the same length", tr, gTr) continue } var nCorrectHead int for j, a := range tr.AnnotatedSentence[1:] { b := gTr.AnnotatedSentence[j+1] if a.HeadID() == b.HeadID() { correctHeads++ nCorrectHead++ } if a.DependencyType == b.DependencyType { correctLabels++ } sumArcs++ } if nCorrectHead == gTr.N() { correctTrees++ } if tr.Root() == gTr.Root() { correctRoot++ } // check 5 per iteration if check < 5 { logf("predictedHeads: \n%v\n%v\n", tr.Heads(), gTr.Heads()) logf("Ns: %v | %v || Correct: %v", tr.N(), gTr.N(), nCorrectHead) check++ } } uas := correctHeads / sumArcs las := correctLabels / sumArcs uem := correctTrees / float64(len(predictedTrees)) roo := correctRoot / float64(len(predictedTrees)) return Performance{UAS: uas, LAS: las, UEM: uem, Root: roo} }
[ "func", "Evaluate", "(", "predictedTrees", ",", "goldTrees", "[", "]", "*", "lingo", ".", "Dependency", ")", "Performance", "{", "if", "len", "(", "predictedTrees", ")", "!=", "len", "(", "goldTrees", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", ...
// performance evaluation related code goes here // Evaluate compares predicted trees with the gold standard trees and returns a Performance. It panics if the number of predicted trees and the number of gold trees aren't the same
[ "performance", "evaluation", "related", "code", "goes", "here", "Evaluate", "compares", "predicted", "trees", "with", "the", "gold", "standard", "trees", "and", "returns", "a", "Performance", ".", "It", "panics", "if", "the", "number", "of", "predicted", "trees"...
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/evaluation.go#L33-L85
17,408
chewxy/lingo
dep/arcStandard.go
apply
func (c *configuration) apply(t transition) { logf("Applying %v", t) w1 := int(c.stackValue(1)) w2 := int(c.stackValue(0)) if t.Move == Left { c.AddArc(w2, w1, t.DependencyType) c.removeSecondTopStack() } else if t.Move == Right { c.AddArc(w1, w2, t.DependencyType) c.removeTopStack() } else { c.shift() } }
go
func (c *configuration) apply(t transition) { logf("Applying %v", t) w1 := int(c.stackValue(1)) w2 := int(c.stackValue(0)) if t.Move == Left { c.AddArc(w2, w1, t.DependencyType) c.removeSecondTopStack() } else if t.Move == Right { c.AddArc(w1, w2, t.DependencyType) c.removeTopStack() } else { c.shift() } }
[ "func", "(", "c", "*", "configuration", ")", "apply", "(", "t", "transition", ")", "{", "logf", "(", "\"", "\"", ",", "t", ")", "\n", "w1", ":=", "int", "(", "c", ".", "stackValue", "(", "1", ")", ")", "\n", "w2", ":=", "int", "(", "c", ".", ...
// apply applies the transition
[ "apply", "applies", "the", "transition" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/arcStandard.go#L45-L59
17,409
chewxy/lingo
dep/arcStandard.go
oracle
func (c *configuration) oracle(goldParse *lingo.Dependency) (t transition) { w1 := int(c.stackValue(1)) w2 := int(c.stackValue(0)) if w1 > 0 && goldParse.Head(w1) == w2 { t.Move = Left t.DependencyType = goldParse.Label(w1) return } else if w1 >= 0 && goldParse.Head(w2) == w1 && !c.hasOtherChildren(w2, goldParse) { t.Move = Right t.DependencyType = goldParse.Label(w2) return } return // default transition is Shift }
go
func (c *configuration) oracle(goldParse *lingo.Dependency) (t transition) { w1 := int(c.stackValue(1)) w2 := int(c.stackValue(0)) if w1 > 0 && goldParse.Head(w1) == w2 { t.Move = Left t.DependencyType = goldParse.Label(w1) return } else if w1 >= 0 && goldParse.Head(w2) == w1 && !c.hasOtherChildren(w2, goldParse) { t.Move = Right t.DependencyType = goldParse.Label(w2) return } return // default transition is Shift }
[ "func", "(", "c", "*", "configuration", ")", "oracle", "(", "goldParse", "*", "lingo", ".", "Dependency", ")", "(", "t", "transition", ")", "{", "w1", ":=", "int", "(", "c", ".", "stackValue", "(", "1", ")", ")", "\n", "w2", ":=", "int", "(", "c"...
// oracle gets the gold transition given the state
[ "oracle", "gets", "the", "gold", "transition", "given", "the", "state" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/dep/arcStandard.go#L62-L77
17,410
chewxy/lingo
annotation.go
AnnotationFromLexTag
func AnnotationFromLexTag(l Lexeme, t POSTag, f AnnotationFixer) *Annotation { a := &Annotation{ Lexeme: l, POSTag: t, DependencyType: NoDepType, Lemma: "", Lowered: strings.ToLower(l.Value), } // it's ok to panic - it will cause the tests to fail if err := a.Process(f); err != nil { panic(err) } return a }
go
func AnnotationFromLexTag(l Lexeme, t POSTag, f AnnotationFixer) *Annotation { a := &Annotation{ Lexeme: l, POSTag: t, DependencyType: NoDepType, Lemma: "", Lowered: strings.ToLower(l.Value), } // it's ok to panic - it will cause the tests to fail if err := a.Process(f); err != nil { panic(err) } return a }
[ "func", "AnnotationFromLexTag", "(", "l", "Lexeme", ",", "t", "POSTag", ",", "f", "AnnotationFixer", ")", "*", "Annotation", "{", "a", ":=", "&", "Annotation", "{", "Lexeme", ":", "l", ",", "POSTag", ":", "t", ",", "DependencyType", ":", "NoDepType", ","...
// AnnotationFromLexTag is only ever used in tests. Fixer is optional
[ "AnnotationFromLexTag", "is", "only", "ever", "used", "in", "tests", ".", "Fixer", "is", "optional" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/annotation.go#L46-L61
17,411
chewxy/lingo
browncluster.go
ReadCluster
func ReadCluster(r io.Reader) map[string]Cluster { scanner := bufio.NewScanner(r) clusters := make(map[string]Cluster) for scanner.Scan() { line := scanner.Text() splits := strings.Split(line, "\t") var word string var cluster, freq int word = splits[1] var i64 int64 var err error if i64, err = strconv.ParseInt(splits[0], 2, 64); err != nil { panic(err) } cluster = int(i64) if freq, err = strconv.Atoi(splits[2]); err != nil { panic(err) } // if clusterer has only seen a word a few times, then the cluster is not reliable if freq >= 3 { clusters[word] = Cluster(cluster) } else { clusters[word] = Cluster(0) } } // expand clusters with recasing for word, clust := range clusters { lowered := strings.ToLower(word) if _, ok := clusters[lowered]; !ok { clusters[lowered] = clust } titled := strings.ToTitle(word) if _, ok := clusters[titled]; !ok { clusters[titled] = clust } uppered := strings.ToUpper(word) if _, ok := clusters[uppered]; !ok { clusters[uppered] = clust } } return clusters }
go
func ReadCluster(r io.Reader) map[string]Cluster { scanner := bufio.NewScanner(r) clusters := make(map[string]Cluster) for scanner.Scan() { line := scanner.Text() splits := strings.Split(line, "\t") var word string var cluster, freq int word = splits[1] var i64 int64 var err error if i64, err = strconv.ParseInt(splits[0], 2, 64); err != nil { panic(err) } cluster = int(i64) if freq, err = strconv.Atoi(splits[2]); err != nil { panic(err) } // if clusterer has only seen a word a few times, then the cluster is not reliable if freq >= 3 { clusters[word] = Cluster(cluster) } else { clusters[word] = Cluster(0) } } // expand clusters with recasing for word, clust := range clusters { lowered := strings.ToLower(word) if _, ok := clusters[lowered]; !ok { clusters[lowered] = clust } titled := strings.ToTitle(word) if _, ok := clusters[titled]; !ok { clusters[titled] = clust } uppered := strings.ToUpper(word) if _, ok := clusters[uppered]; !ok { clusters[uppered] = clust } } return clusters }
[ "func", "ReadCluster", "(", "r", "io", ".", "Reader", ")", "map", "[", "string", "]", "Cluster", "{", "scanner", ":=", "bufio", ".", "NewScanner", "(", "r", ")", "\n", "clusters", ":=", "make", "(", "map", "[", "string", "]", "Cluster", ")", "\n\n", ...
// ReadCluster reads PercyLiang's cluster file format and returns a map of strings to Cluster
[ "ReadCluster", "reads", "PercyLiang", "s", "cluster", "file", "format", "and", "returns", "a", "map", "of", "strings", "to", "Cluster" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/browncluster.go#L18-L69
17,412
chewxy/lingo
sentence.go
IDs
func (as AnnotatedSentence) IDs() []int { retVal := make([]int, len(as)) for i, a := range as { retVal[i] = a.ID } return retVal }
go
func (as AnnotatedSentence) IDs() []int { retVal := make([]int, len(as)) for i, a := range as { retVal[i] = a.ID } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "IDs", "(", ")", "[", "]", "int", "{", "retVal", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "retVal", "[", "i", "]", ...
// IDs returns the list of IDs in the sentence. The return value has exactly the same length as the sentence.
[ "IDs", "returns", "the", "list", "of", "IDs", "in", "the", "sentence", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L107-L113
17,413
chewxy/lingo
sentence.go
Tags
func (as AnnotatedSentence) Tags() []POSTag { retVal := make([]POSTag, len(as)) for i, a := range as { retVal[i] = a.POSTag } return retVal }
go
func (as AnnotatedSentence) Tags() []POSTag { retVal := make([]POSTag, len(as)) for i, a := range as { retVal[i] = a.POSTag } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "Tags", "(", ")", "[", "]", "POSTag", "{", "retVal", ":=", "make", "(", "[", "]", "POSTag", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "retVal", "[", "i", ...
// Tags returns the POSTags of the sentence. The return value has exactly the same length as the sentence.
[ "Tags", "returns", "the", "POSTags", "of", "the", "sentence", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L116-L122
17,414
chewxy/lingo
sentence.go
Heads
func (as AnnotatedSentence) Heads() []int { retVal := make([]int, len(as)) for i, a := range as { retVal[i] = a.HeadID() } return retVal }
go
func (as AnnotatedSentence) Heads() []int { retVal := make([]int, len(as)) for i, a := range as { retVal[i] = a.HeadID() } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "Heads", "(", ")", "[", "]", "int", "{", "retVal", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "retVal", "[", "i", "]"...
// Heads returns the head IDs of the sentence. The return value has exactly the same length as the sentence.
[ "Heads", "returns", "the", "head", "IDs", "of", "the", "sentence", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L125-L131
17,415
chewxy/lingo
sentence.go
Labels
func (as AnnotatedSentence) Labels() []DependencyType { retVal := make([]DependencyType, len(as)) for i, a := range as { retVal[i] = a.DependencyType } return retVal }
go
func (as AnnotatedSentence) Labels() []DependencyType { retVal := make([]DependencyType, len(as)) for i, a := range as { retVal[i] = a.DependencyType } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "Labels", "(", ")", "[", "]", "DependencyType", "{", "retVal", ":=", "make", "(", "[", "]", "DependencyType", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "retVa...
// Labels returns the DependencyTypes of the sentence. The return value has exactly the same length as the sentence.
[ "Labels", "returns", "the", "DependencyTypes", "of", "the", "sentence", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L144-L150
17,416
chewxy/lingo
sentence.go
StringSlice
func (as AnnotatedSentence) StringSlice() []string { retVal := make([]string, len(as), len(as)) for i, a := range as { retVal[i] = a.Value } return retVal }
go
func (as AnnotatedSentence) StringSlice() []string { retVal := make([]string, len(as), len(as)) for i, a := range as { retVal[i] = a.Value } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "StringSlice", "(", ")", "[", "]", "string", "{", "retVal", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "as", ")", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "rang...
// StringSlice returns the original words as a slice of string. The return value has exactly the same length as the sentence.
[ "StringSlice", "returns", "the", "original", "words", "as", "a", "slice", "of", "string", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L153-L159
17,417
chewxy/lingo
sentence.go
LoweredStringSlice
func (as AnnotatedSentence) LoweredStringSlice() []string { retVal := make([]string, len(as), len(as)) for i, a := range as { retVal[i] = a.Lowered } return retVal }
go
func (as AnnotatedSentence) LoweredStringSlice() []string { retVal := make([]string, len(as), len(as)) for i, a := range as { retVal[i] = a.Lowered } return retVal }
[ "func", "(", "as", "AnnotatedSentence", ")", "LoweredStringSlice", "(", ")", "[", "]", "string", "{", "retVal", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "as", ")", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", ...
// LoweredStringSlice returns the lowercased version of the words in the sentence as a slice of string. The return value has exactly the same length as the sentence.
[ "LoweredStringSlice", "returns", "the", "lowercased", "version", "of", "the", "words", "in", "the", "sentence", "as", "a", "slice", "of", "string", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L162-L168
17,418
chewxy/lingo
sentence.go
Lemmas
func (as AnnotatedSentence) Lemmas() []string { lemmas := make([]string, len(as)) for i, a := range as { lemmas[i] = a.Lemma } return lemmas }
go
func (as AnnotatedSentence) Lemmas() []string { lemmas := make([]string, len(as)) for i, a := range as { lemmas[i] = a.Lemma } return lemmas }
[ "func", "(", "as", "AnnotatedSentence", ")", "Lemmas", "(", ")", "[", "]", "string", "{", "lemmas", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "lemmas", "[", "i"...
// Lemmas returns the lemmas as as slice of string. The return value has exactly the same length as the sentence.
[ "Lemmas", "returns", "the", "lemmas", "as", "as", "slice", "of", "string", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L171-L177
17,419
chewxy/lingo
sentence.go
Stems
func (as AnnotatedSentence) Stems() []string { stems := make([]string, len(as)) for i, a := range as { stems[i] = a.Stem } return stems }
go
func (as AnnotatedSentence) Stems() []string { stems := make([]string, len(as)) for i, a := range as { stems[i] = a.Stem } return stems }
[ "func", "(", "as", "AnnotatedSentence", ")", "Stems", "(", ")", "[", "]", "string", "{", "stems", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "as", ")", ")", "\n", "for", "i", ",", "a", ":=", "range", "as", "{", "stems", "[", "i", ...
// Stems returns the stems as a slice of string. The return value has exactly the same length as the sentence.
[ "Stems", "returns", "the", "stems", "as", "a", "slice", "of", "string", ".", "The", "return", "value", "has", "exactly", "the", "same", "length", "as", "the", "sentence", "." ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/sentence.go#L180-L186
17,420
chewxy/lingo
corpus/consopt.go
WithWords
func WithWords(a []string) ConsOpt { f := func(c *Corpus) error { s := set.Strings(a) c.words = s c.frequencies = make([]int, len(s)) for i := range c.frequencies { c.frequencies[i] = 1 } ids := make(map[string]int) maxID := len(s) totalFreq := len(s) var maxWL int for i, w := range a { if len(w) > maxWL { maxWL = len(w) } ids[w] = i } c.ids = ids atomic.AddInt64(&c.maxid, int64(maxID)) c.totalFreq = totalFreq c.maxWordLength = maxWL return nil } return f }
go
func WithWords(a []string) ConsOpt { f := func(c *Corpus) error { s := set.Strings(a) c.words = s c.frequencies = make([]int, len(s)) for i := range c.frequencies { c.frequencies[i] = 1 } ids := make(map[string]int) maxID := len(s) totalFreq := len(s) var maxWL int for i, w := range a { if len(w) > maxWL { maxWL = len(w) } ids[w] = i } c.ids = ids atomic.AddInt64(&c.maxid, int64(maxID)) c.totalFreq = totalFreq c.maxWordLength = maxWL return nil } return f }
[ "func", "WithWords", "(", "a", "[", "]", "string", ")", "ConsOpt", "{", "f", ":=", "func", "(", "c", "*", "Corpus", ")", "error", "{", "s", ":=", "set", ".", "Strings", "(", "a", ")", "\n", "c", ".", "words", "=", "s", "\n", "c", ".", "freque...
// WithWords creates a corpus from a
[ "WithWords", "creates", "a", "corpus", "from", "a" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/consopt.go#L13-L40
17,421
chewxy/lingo
corpus/consopt.go
WithSize
func WithSize(size int) ConsOpt { return func(c *Corpus) error { c.words = make([]string, 0, size) c.frequencies = make([]int, 0, size) return nil } }
go
func WithSize(size int) ConsOpt { return func(c *Corpus) error { c.words = make([]string, 0, size) c.frequencies = make([]int, 0, size) return nil } }
[ "func", "WithSize", "(", "size", "int", ")", "ConsOpt", "{", "return", "func", "(", "c", "*", "Corpus", ")", "error", "{", "c", ".", "words", "=", "make", "(", "[", "]", "string", ",", "0", ",", "size", ")", "\n", "c", ".", "frequencies", "=", ...
// WithSize preallocates all the things in Corpus
[ "WithSize", "preallocates", "all", "the", "things", "in", "Corpus" ]
238c8836f032c232f721977047cece06842fcdf2
https://github.com/chewxy/lingo/blob/238c8836f032c232f721977047cece06842fcdf2/corpus/consopt.go#L43-L49
17,422
desertbit/glue
socket.go
newSocket
func newSocket(server *Server, bs backend.BackendSocket) *Socket { // Create a new socket value. s := &Socket{ server: server, bs: bs, id: utils.RandomString(socketIDLength), channels: newChannels(), writeChan: bs.WriteChan(), readChan: bs.ReadChan(), isClosedChan: bs.ClosedChan(), pingTimer: time.NewTimer(pingPeriod), pingTimeout: time.NewTimer(pingResponseTimeout), } // Create the main channel. s.mainChannel = s.Channel(mainChannelName) // Call the on close method as soon as the socket closes. go func() { <-s.isClosedChan s.onClose() }() // Stop the timeout again. It will be started by the ping timer. s.pingTimeout.Stop() // Add the new socket to the active sockets map. // If the ID is already present, then generate a new one. func() { // Lock the mutex. s.server.socketsMutex.Lock() defer s.server.socketsMutex.Unlock() // Be sure that the ID is unique. for { if _, ok := s.server.sockets[s.id]; !ok { break } s.id = utils.RandomString(socketIDLength) } // Add the socket to the map. s.server.sockets[s.id] = s }() // Start the loops and handlers in new goroutines. go s.pingTimeoutHandler() go s.readLoop() go s.pingLoop() return s }
go
func newSocket(server *Server, bs backend.BackendSocket) *Socket { // Create a new socket value. s := &Socket{ server: server, bs: bs, id: utils.RandomString(socketIDLength), channels: newChannels(), writeChan: bs.WriteChan(), readChan: bs.ReadChan(), isClosedChan: bs.ClosedChan(), pingTimer: time.NewTimer(pingPeriod), pingTimeout: time.NewTimer(pingResponseTimeout), } // Create the main channel. s.mainChannel = s.Channel(mainChannelName) // Call the on close method as soon as the socket closes. go func() { <-s.isClosedChan s.onClose() }() // Stop the timeout again. It will be started by the ping timer. s.pingTimeout.Stop() // Add the new socket to the active sockets map. // If the ID is already present, then generate a new one. func() { // Lock the mutex. s.server.socketsMutex.Lock() defer s.server.socketsMutex.Unlock() // Be sure that the ID is unique. for { if _, ok := s.server.sockets[s.id]; !ok { break } s.id = utils.RandomString(socketIDLength) } // Add the socket to the map. s.server.sockets[s.id] = s }() // Start the loops and handlers in new goroutines. go s.pingTimeoutHandler() go s.readLoop() go s.pingLoop() return s }
[ "func", "newSocket", "(", "server", "*", "Server", ",", "bs", "backend", ".", "BackendSocket", ")", "*", "Socket", "{", "// Create a new socket value.", "s", ":=", "&", "Socket", "{", "server", ":", "server", ",", "bs", ":", "bs", ",", "id", ":", "utils"...
// newSocket creates a new socket and initializes it.
[ "newSocket", "creates", "a", "new", "socket", "and", "initializes", "it", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L147-L202
17,423
desertbit/glue
socket.go
OnClose
func (s *Socket) OnClose(f OnCloseFunc) { go func() { // Recover panics and log the error. defer func() { if e := recover(); e != nil { log.L.Errorf("glue: panic while calling onClose function: %v\n%s", e, debug.Stack()) } }() <-s.isClosedChan f() }() }
go
func (s *Socket) OnClose(f OnCloseFunc) { go func() { // Recover panics and log the error. defer func() { if e := recover(); e != nil { log.L.Errorf("glue: panic while calling onClose function: %v\n%s", e, debug.Stack()) } }() <-s.isClosedChan f() }() }
[ "func", "(", "s", "*", "Socket", ")", "OnClose", "(", "f", "OnCloseFunc", ")", "{", "go", "func", "(", ")", "{", "// Recover panics and log the error.", "defer", "func", "(", ")", "{", "if", "e", ":=", "recover", "(", ")", ";", "e", "!=", "nil", "{",...
// OnClose sets the functions which is triggered if the socket connection is closed. // This method can be called multiple times to bind multiple functions.
[ "OnClose", "sets", "the", "functions", "which", "is", "triggered", "if", "the", "socket", "connection", "is", "closed", ".", "This", "method", "can", "be", "called", "multiple", "times", "to", "bind", "multiple", "functions", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L239-L251
17,424
desertbit/glue
socket.go
Read
func (s *Socket) Read(timeout ...time.Duration) (string, error) { return s.mainChannel.Read(timeout...) }
go
func (s *Socket) Read(timeout ...time.Duration) (string, error) { return s.mainChannel.Read(timeout...) }
[ "func", "(", "s", "*", "Socket", ")", "Read", "(", "timeout", "...", "time", ".", "Duration", ")", "(", "string", ",", "error", ")", "{", "return", "s", ".", "mainChannel", ".", "Read", "(", "timeout", "...", ")", "\n", "}" ]
// Read the next message from the socket. This method is blocking. // One variadic argument sets a timeout duration. // If no timeout is specified, this method will block forever. // ErrSocketClosed is returned, if the socket connection is closed. // ErrReadTimeout is returned, if the timeout is reached.
[ "Read", "the", "next", "message", "from", "the", "socket", ".", "This", "method", "is", "blocking", ".", "One", "variadic", "argument", "sets", "a", "timeout", "duration", ".", "If", "no", "timeout", "is", "specified", "this", "method", "will", "block", "f...
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L270-L272
17,425
desertbit/glue
socket.go
sendPing
func (s *Socket) sendPing() { // Lock the mutex. s.sendPingMutex.Lock() // Check if a ping request is already active. if s.pingRequestActive { // Unlock the mutex again. s.sendPingMutex.Unlock() return } // Update the flag and unlock the mutex again. s.pingRequestActive = true s.sendPingMutex.Unlock() // Start the timeout timer. This will close // the socket if no pong response is received // within the timeout. // Do this before the write. The write channel might block // if the buffers are full. s.pingTimeout.Reset(pingResponseTimeout) // Send a ping request by writing to the stream. s.writeChan <- cmdPing }
go
func (s *Socket) sendPing() { // Lock the mutex. s.sendPingMutex.Lock() // Check if a ping request is already active. if s.pingRequestActive { // Unlock the mutex again. s.sendPingMutex.Unlock() return } // Update the flag and unlock the mutex again. s.pingRequestActive = true s.sendPingMutex.Unlock() // Start the timeout timer. This will close // the socket if no pong response is received // within the timeout. // Do this before the write. The write channel might block // if the buffers are full. s.pingTimeout.Reset(pingResponseTimeout) // Send a ping request by writing to the stream. s.writeChan <- cmdPing }
[ "func", "(", "s", "*", "Socket", ")", "sendPing", "(", ")", "{", "// Lock the mutex.", "s", ".", "sendPingMutex", ".", "Lock", "(", ")", "\n\n", "// Check if a ping request is already active.", "if", "s", ".", "pingRequestActive", "{", "// Unlock the mutex again.", ...
// SendPing sends a ping to the client. If no pong response is // received within the timeout, the socket will be closed. // Multiple calls to this method won't send multiple ping requests, // if a ping request is already active.
[ "SendPing", "sends", "a", "ping", "to", "the", "client", ".", "If", "no", "pong", "response", "is", "received", "within", "the", "timeout", "the", "socket", "will", "be", "closed", ".", "Multiple", "calls", "to", "this", "method", "won", "t", "send", "mu...
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L355-L379
17,426
desertbit/glue
socket.go
pingTimeoutHandler
func (s *Socket) pingTimeoutHandler() { defer func() { s.pingTimeout.Stop() }() select { case <-s.pingTimeout.C: // Close the socket due to the timeout. s.bs.Close() case <-s.isClosedChan: // Just release this goroutine. } }
go
func (s *Socket) pingTimeoutHandler() { defer func() { s.pingTimeout.Stop() }() select { case <-s.pingTimeout.C: // Close the socket due to the timeout. s.bs.Close() case <-s.isClosedChan: // Just release this goroutine. } }
[ "func", "(", "s", "*", "Socket", ")", "pingTimeoutHandler", "(", ")", "{", "defer", "func", "(", ")", "{", "s", ".", "pingTimeout", ".", "Stop", "(", ")", "\n", "}", "(", ")", "\n\n", "select", "{", "case", "<-", "s", ".", "pingTimeout", ".", "C"...
// Close the socket during a ping response timeout.
[ "Close", "the", "socket", "during", "a", "ping", "response", "timeout", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/socket.go#L382-L394
17,427
desertbit/glue
server.go
NewServer
func NewServer(o ...Options) *Server { // Get or create the options. var options *Options if len(o) > 0 { options = &o[0] } else { options = &Options{} } // Set the default option values for unset values. options.SetDefaults() // Create a new backend server. bs := backend.NewServer(len(options.HTTPHandleURL), options.EnableCORS, options.CheckOrigin) // Create a new server value. s := &Server{ bs: bs, options: options, onNewSocket: func(*Socket) {}, // Initialize with dummy function to remove nil check. sockets: make(map[string]*Socket), } // Set the backend server event function. bs.OnNewSocketConnection(s.handleOnNewSocketConnection) return s }
go
func NewServer(o ...Options) *Server { // Get or create the options. var options *Options if len(o) > 0 { options = &o[0] } else { options = &Options{} } // Set the default option values for unset values. options.SetDefaults() // Create a new backend server. bs := backend.NewServer(len(options.HTTPHandleURL), options.EnableCORS, options.CheckOrigin) // Create a new server value. s := &Server{ bs: bs, options: options, onNewSocket: func(*Socket) {}, // Initialize with dummy function to remove nil check. sockets: make(map[string]*Socket), } // Set the backend server event function. bs.OnNewSocketConnection(s.handleOnNewSocketConnection) return s }
[ "func", "NewServer", "(", "o", "...", "Options", ")", "*", "Server", "{", "// Get or create the options.", "var", "options", "*", "Options", "\n", "if", "len", "(", "o", ")", ">", "0", "{", "options", "=", "&", "o", "[", "0", "]", "\n", "}", "else", ...
// NewServer creates a new glue server instance. // One variadic arguments specifies the server options.
[ "NewServer", "creates", "a", "new", "glue", "server", "instance", ".", "One", "variadic", "arguments", "specifies", "the", "server", "options", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L59-L86
17,428
desertbit/glue
server.go
Block
func (s *Server) Block(b bool) { s.blockMutex.Lock() defer s.blockMutex.Unlock() s.block = b }
go
func (s *Server) Block(b bool) { s.blockMutex.Lock() defer s.blockMutex.Unlock() s.block = b }
[ "func", "(", "s", "*", "Server", ")", "Block", "(", "b", "bool", ")", "{", "s", ".", "blockMutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "blockMutex", ".", "Unlock", "(", ")", "\n\n", "s", ".", "block", "=", "b", "\n", "}" ]
// Block new incomming connections.
[ "Block", "new", "incomming", "connections", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L89-L94
17,429
desertbit/glue
server.go
IsBlocked
func (s *Server) IsBlocked() bool { s.blockMutex.Lock() defer s.blockMutex.Unlock() return s.block }
go
func (s *Server) IsBlocked() bool { s.blockMutex.Lock() defer s.blockMutex.Unlock() return s.block }
[ "func", "(", "s", "*", "Server", ")", "IsBlocked", "(", ")", "bool", "{", "s", ".", "blockMutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "blockMutex", ".", "Unlock", "(", ")", "\n\n", "return", "s", ".", "block", "\n", "}" ]
// IsBlocked returns a boolean whenever new incoming connections should be blocked.
[ "IsBlocked", "returns", "a", "boolean", "whenever", "new", "incoming", "connections", "should", "be", "blocked", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L97-L102
17,430
desertbit/glue
server.go
GetSocket
func (s *Server) GetSocket(id string) *Socket { // Lock the mutex. s.socketsMutex.Lock() defer s.socketsMutex.Unlock() // Obtain the socket. socket, ok := s.sockets[id] if !ok { return nil } return socket }
go
func (s *Server) GetSocket(id string) *Socket { // Lock the mutex. s.socketsMutex.Lock() defer s.socketsMutex.Unlock() // Obtain the socket. socket, ok := s.sockets[id] if !ok { return nil } return socket }
[ "func", "(", "s", "*", "Server", ")", "GetSocket", "(", "id", "string", ")", "*", "Socket", "{", "// Lock the mutex.", "s", ".", "socketsMutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "socketsMutex", ".", "Unlock", "(", ")", "\n\n", "// Obtain...
// GetSocket obtains a socket by its ID. // Returns nil if not found.
[ "GetSocket", "obtains", "a", "socket", "by", "its", "ID", ".", "Returns", "nil", "if", "not", "found", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L114-L126
17,431
desertbit/glue
server.go
Release
func (s *Server) Release() { // Block all new incomming socket connections. s.Block(true) // Wait for a little moment, so new incomming sockets are added // to the sockets active list. time.Sleep(200 * time.Millisecond) // Close all current connected sockets. sockets := s.Sockets() for _, s := range sockets { s.Close() } }
go
func (s *Server) Release() { // Block all new incomming socket connections. s.Block(true) // Wait for a little moment, so new incomming sockets are added // to the sockets active list. time.Sleep(200 * time.Millisecond) // Close all current connected sockets. sockets := s.Sockets() for _, s := range sockets { s.Close() } }
[ "func", "(", "s", "*", "Server", ")", "Release", "(", ")", "{", "// Block all new incomming socket connections.", "s", ".", "Block", "(", "true", ")", "\n\n", "// Wait for a little moment, so new incomming sockets are added", "// to the sockets active list.", "time", ".", ...
// Release this package. This will block all new incomming socket connections // and close all current connected sockets.
[ "Release", "this", "package", ".", "This", "will", "block", "all", "new", "incomming", "socket", "connections", "and", "close", "all", "current", "connected", "sockets", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L152-L165
17,432
desertbit/glue
server.go
Run
func (s *Server) Run() error { // Skip if set to none. if s.options.HTTPSocketType != HTTPSocketTypeNone { // Set the base glue HTTP handler. http.Handle(s.options.HTTPHandleURL, s) // Start the http server. if s.options.HTTPSocketType == HTTPSocketTypeUnix { // Listen on the unix socket. l, err := net.Listen("unix", s.options.HTTPListenAddress) if err != nil { return fmt.Errorf("Listen: %v", err) } // Start the http server. err = http.Serve(l, nil) if err != nil { return fmt.Errorf("Serve: %v", err) } } else if s.options.HTTPSocketType == HTTPSocketTypeTCP { // Start the http server. err := http.ListenAndServe(s.options.HTTPListenAddress, nil) if err != nil { return fmt.Errorf("ListenAndServe: %v", err) } } else { return fmt.Errorf("invalid socket options type: %v", s.options.HTTPSocketType) } } else { // HINT: This is only a placeholder until the internal glue TCP server is implemented. w := make(chan struct{}) <-w } return nil }
go
func (s *Server) Run() error { // Skip if set to none. if s.options.HTTPSocketType != HTTPSocketTypeNone { // Set the base glue HTTP handler. http.Handle(s.options.HTTPHandleURL, s) // Start the http server. if s.options.HTTPSocketType == HTTPSocketTypeUnix { // Listen on the unix socket. l, err := net.Listen("unix", s.options.HTTPListenAddress) if err != nil { return fmt.Errorf("Listen: %v", err) } // Start the http server. err = http.Serve(l, nil) if err != nil { return fmt.Errorf("Serve: %v", err) } } else if s.options.HTTPSocketType == HTTPSocketTypeTCP { // Start the http server. err := http.ListenAndServe(s.options.HTTPListenAddress, nil) if err != nil { return fmt.Errorf("ListenAndServe: %v", err) } } else { return fmt.Errorf("invalid socket options type: %v", s.options.HTTPSocketType) } } else { // HINT: This is only a placeholder until the internal glue TCP server is implemented. w := make(chan struct{}) <-w } return nil }
[ "func", "(", "s", "*", "Server", ")", "Run", "(", ")", "error", "{", "// Skip if set to none.", "if", "s", ".", "options", ".", "HTTPSocketType", "!=", "HTTPSocketTypeNone", "{", "// Set the base glue HTTP handler.", "http", ".", "Handle", "(", "s", ".", "opti...
// Run starts the server and listens for incoming socket connections. // This is a blocking method.
[ "Run", "starts", "the", "server", "and", "listens", "for", "incoming", "socket", "connections", ".", "This", "is", "a", "blocking", "method", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/server.go#L169-L204
17,433
desertbit/glue
utils/utils.go
UnmarshalValues
func UnmarshalValues(data string) (first, second string, err error) { // Find the delimiter. pos := strings.Index(data, delimiter) if pos < 0 { err = fmt.Errorf("unmarshal values: no delimiter found: '%s'", data) return } // Extract the value length integer of the first value. l, err := strconv.Atoi(data[:pos]) if err != nil { err = fmt.Errorf("invalid value length: '%s'", data[:pos]) return } // Remove the value length from the data string. data = data[pos+1:] // Validate the value length. if l < 0 || l > len(data) { err = fmt.Errorf("invalid value length: out of bounds: '%v'", l) return } // Split the first value from the second. first = data[:l] second = data[l:] return }
go
func UnmarshalValues(data string) (first, second string, err error) { // Find the delimiter. pos := strings.Index(data, delimiter) if pos < 0 { err = fmt.Errorf("unmarshal values: no delimiter found: '%s'", data) return } // Extract the value length integer of the first value. l, err := strconv.Atoi(data[:pos]) if err != nil { err = fmt.Errorf("invalid value length: '%s'", data[:pos]) return } // Remove the value length from the data string. data = data[pos+1:] // Validate the value length. if l < 0 || l > len(data) { err = fmt.Errorf("invalid value length: out of bounds: '%v'", l) return } // Split the first value from the second. first = data[:l] second = data[l:] return }
[ "func", "UnmarshalValues", "(", "data", "string", ")", "(", "first", ",", "second", "string", ",", "err", "error", ")", "{", "// Find the delimiter.", "pos", ":=", "strings", ".", "Index", "(", "data", ",", "delimiter", ")", "\n", "if", "pos", "<", "0", ...
// UnmarshalValues splits two values from a single string. // This function is chainable to extract multiple values.
[ "UnmarshalValues", "splits", "two", "values", "from", "a", "single", "string", ".", "This", "function", "is", "chainable", "to", "extract", "multiple", "values", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L55-L84
17,434
desertbit/glue
utils/utils.go
MarshalValues
func MarshalValues(first, second string) string { return strconv.Itoa(len(first)) + delimiter + first + second }
go
func MarshalValues(first, second string) string { return strconv.Itoa(len(first)) + delimiter + first + second }
[ "func", "MarshalValues", "(", "first", ",", "second", "string", ")", "string", "{", "return", "strconv", ".", "Itoa", "(", "len", "(", "first", ")", ")", "+", "delimiter", "+", "first", "+", "second", "\n", "}" ]
// MarshalValues joins two values into a single string. // They can be decoded by the UnmarshalValues function.
[ "MarshalValues", "joins", "two", "values", "into", "a", "single", "string", ".", "They", "can", "be", "decoded", "by", "the", "UnmarshalValues", "function", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L88-L90
17,435
desertbit/glue
utils/utils.go
RemovePortFromRemoteAddr
func RemovePortFromRemoteAddr(remoteAddr string) string { pos := strings.LastIndex(remoteAddr, ":") if pos < 0 { return remoteAddr } return remoteAddr[:pos] }
go
func RemovePortFromRemoteAddr(remoteAddr string) string { pos := strings.LastIndex(remoteAddr, ":") if pos < 0 { return remoteAddr } return remoteAddr[:pos] }
[ "func", "RemovePortFromRemoteAddr", "(", "remoteAddr", "string", ")", "string", "{", "pos", ":=", "strings", ".", "LastIndex", "(", "remoteAddr", ",", "\"", "\"", ")", "\n", "if", "pos", "<", "0", "{", "return", "remoteAddr", "\n", "}", "\n\n", "return", ...
// RemovePortFromRemoteAddr removes the port if present from the remote address.
[ "RemovePortFromRemoteAddr", "removes", "the", "port", "if", "present", "from", "the", "remote", "address", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/utils/utils.go#L125-L132
17,436
desertbit/glue
backend/sockets/ajaxsocket/socket.go
newSocket
func newSocket(s *Server) *Socket { a := &Socket{ writeChan: make(chan string, global.WriteChanSize), readChan: make(chan string, global.ReadChanSize), } // Set the closer function. a.closer = closer.New(func() { // Remove the ajax socket from the map. if len(a.uid) > 0 { func() { s.socketsMutex.Lock() defer s.socketsMutex.Unlock() delete(s.sockets, a.uid) }() } }) return a }
go
func newSocket(s *Server) *Socket { a := &Socket{ writeChan: make(chan string, global.WriteChanSize), readChan: make(chan string, global.ReadChanSize), } // Set the closer function. a.closer = closer.New(func() { // Remove the ajax socket from the map. if len(a.uid) > 0 { func() { s.socketsMutex.Lock() defer s.socketsMutex.Unlock() delete(s.sockets, a.uid) }() } }) return a }
[ "func", "newSocket", "(", "s", "*", "Server", ")", "*", "Socket", "{", "a", ":=", "&", "Socket", "{", "writeChan", ":", "make", "(", "chan", "string", ",", "global", ".", "WriteChanSize", ")", ",", "readChan", ":", "make", "(", "chan", "string", ",",...
// Create a new ajax socket.
[ "Create", "a", "new", "ajax", "socket", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/ajaxsocket/socket.go#L43-L63
17,437
desertbit/glue
options.go
SetDefaults
func (o *Options) SetDefaults() { // Set the socket type. if o.HTTPSocketType != HTTPSocketTypeNone && o.HTTPSocketType != HTTPSocketTypeTCP && o.HTTPSocketType != HTTPSocketTypeUnix { o.HTTPSocketType = HTTPSocketTypeTCP } // Set the listen address. if len(o.HTTPListenAddress) == 0 { o.HTTPListenAddress = ":80" } // Set the handle URL. if len(o.HTTPHandleURL) == 0 { o.HTTPHandleURL = "/glue/" } // Be sure that the handle URL ends with a slash. if !strings.HasSuffix(o.HTTPHandleURL, "/") { o.HTTPHandleURL += "/" } // Set the default check origin function if not set. if o.CheckOrigin == nil { o.CheckOrigin = checkSameOrigin } }
go
func (o *Options) SetDefaults() { // Set the socket type. if o.HTTPSocketType != HTTPSocketTypeNone && o.HTTPSocketType != HTTPSocketTypeTCP && o.HTTPSocketType != HTTPSocketTypeUnix { o.HTTPSocketType = HTTPSocketTypeTCP } // Set the listen address. if len(o.HTTPListenAddress) == 0 { o.HTTPListenAddress = ":80" } // Set the handle URL. if len(o.HTTPHandleURL) == 0 { o.HTTPHandleURL = "/glue/" } // Be sure that the handle URL ends with a slash. if !strings.HasSuffix(o.HTTPHandleURL, "/") { o.HTTPHandleURL += "/" } // Set the default check origin function if not set. if o.CheckOrigin == nil { o.CheckOrigin = checkSameOrigin } }
[ "func", "(", "o", "*", "Options", ")", "SetDefaults", "(", ")", "{", "// Set the socket type.", "if", "o", ".", "HTTPSocketType", "!=", "HTTPSocketTypeNone", "&&", "o", ".", "HTTPSocketType", "!=", "HTTPSocketTypeTCP", "&&", "o", ".", "HTTPSocketType", "!=", "...
// SetDefaults sets unset option values to its default value.
[ "SetDefaults", "sets", "unset", "option", "values", "to", "its", "default", "value", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/options.go#L78-L105
17,438
desertbit/glue
backend/server.go
ServeHTTP
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Get the URL path. path := r.URL.Path // Call this in an inline function to handle errors. statusCode, err := func() (int, error) { // Check the origin. if !s.checkOriginFunc(r) { return http.StatusForbidden, fmt.Errorf("origin not allowed") } // Set the required HTTP headers for cross origin requests if enabled. if s.enableCORS { // Parse the origin url. origin := r.Header["Origin"] if len(origin) == 0 || len(origin[0]) == 0 { return 400, fmt.Errorf("failed to set header: Access-Control-Allow-Origin: HTTP request origin header is empty") } w.Header().Set("Access-Control-Allow-Origin", origin[0]) // Set allowed origin. w.Header().Set("Access-Control-Allow-Methods", "POST,GET") // Only allow POST and GET requests. } // Strip the base URL. if len(path) < s.httpURLStripLength { return http.StatusBadRequest, fmt.Errorf("invalid request") } path = path[s.httpURLStripLength:] // Route the HTTP request in a very simple way by comparing the strings. if path == httpURLWebSocketSuffix { // Handle the websocket request. s.webSocketServer.HandleRequest(w, r) } else if path == httpURLAjaxSocketSuffix { // Handle the ajax request. s.ajaxSocketServer.HandleRequest(w, r) } else { return http.StatusBadRequest, fmt.Errorf("invalid request") } return http.StatusAccepted, nil }() // Handle the error. if err != nil { // Set the HTTP status code. w.WriteHeader(statusCode) // Get the remote address and user agent. remoteAddr, _ := utils.RemoteAddress(r) userAgent := r.Header.Get("User-Agent") // Log the invalid request. log.L.WithFields(logrus.Fields{ "remoteAddress": remoteAddr, "userAgent": userAgent, "url": r.URL.Path, }).Warningf("handle HTTP request: %v", err) } }
go
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Get the URL path. path := r.URL.Path // Call this in an inline function to handle errors. statusCode, err := func() (int, error) { // Check the origin. if !s.checkOriginFunc(r) { return http.StatusForbidden, fmt.Errorf("origin not allowed") } // Set the required HTTP headers for cross origin requests if enabled. if s.enableCORS { // Parse the origin url. origin := r.Header["Origin"] if len(origin) == 0 || len(origin[0]) == 0 { return 400, fmt.Errorf("failed to set header: Access-Control-Allow-Origin: HTTP request origin header is empty") } w.Header().Set("Access-Control-Allow-Origin", origin[0]) // Set allowed origin. w.Header().Set("Access-Control-Allow-Methods", "POST,GET") // Only allow POST and GET requests. } // Strip the base URL. if len(path) < s.httpURLStripLength { return http.StatusBadRequest, fmt.Errorf("invalid request") } path = path[s.httpURLStripLength:] // Route the HTTP request in a very simple way by comparing the strings. if path == httpURLWebSocketSuffix { // Handle the websocket request. s.webSocketServer.HandleRequest(w, r) } else if path == httpURLAjaxSocketSuffix { // Handle the ajax request. s.ajaxSocketServer.HandleRequest(w, r) } else { return http.StatusBadRequest, fmt.Errorf("invalid request") } return http.StatusAccepted, nil }() // Handle the error. if err != nil { // Set the HTTP status code. w.WriteHeader(statusCode) // Get the remote address and user agent. remoteAddr, _ := utils.RemoteAddress(r) userAgent := r.Header.Get("User-Agent") // Log the invalid request. log.L.WithFields(logrus.Fields{ "remoteAddress": remoteAddr, "userAgent": userAgent, "url": r.URL.Path, }).Warningf("handle HTTP request: %v", err) } }
[ "func", "(", "s", "*", "Server", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// Get the URL path.", "path", ":=", "r", ".", "URL", ".", "Path", "\n\n", "// Call this in an inline function to ha...
// ServeHTTP implements the HTTP Handler interface of the http package.
[ "ServeHTTP", "implements", "the", "HTTP", "Handler", "interface", "of", "the", "http", "package", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/server.go#L97-L156
17,439
desertbit/glue
backend/sockets/websocket/socket.go
newSocket
func newSocket(ws *websocket.Conn) *Socket { w := &Socket{ ws: ws, writeChan: make(chan string, global.WriteChanSize), readChan: make(chan string, global.ReadChanSize), } // Set the closer function. w.closer = closer.New(func() { // Send a close message to the client. // Ignore errors. w.write(websocket.CloseMessage, []byte{}) // Close the socket. w.ws.Close() }) return w }
go
func newSocket(ws *websocket.Conn) *Socket { w := &Socket{ ws: ws, writeChan: make(chan string, global.WriteChanSize), readChan: make(chan string, global.ReadChanSize), } // Set the closer function. w.closer = closer.New(func() { // Send a close message to the client. // Ignore errors. w.write(websocket.CloseMessage, []byte{}) // Close the socket. w.ws.Close() }) return w }
[ "func", "newSocket", "(", "ws", "*", "websocket", ".", "Conn", ")", "*", "Socket", "{", "w", ":=", "&", "Socket", "{", "ws", ":", "ws", ",", "writeChan", ":", "make", "(", "chan", "string", ",", "global", ".", "WriteChanSize", ")", ",", "readChan", ...
// Create a new websocket value.
[ "Create", "a", "new", "websocket", "value", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/websocket/socket.go#L67-L85
17,440
desertbit/glue
backend/sockets/websocket/socket.go
write
func (w *Socket) write(mt int, payload []byte) error { w.writeMutex.Lock() defer w.writeMutex.Unlock() w.ws.SetWriteDeadline(time.Now().Add(writeWait)) return w.ws.WriteMessage(mt, payload) }
go
func (w *Socket) write(mt int, payload []byte) error { w.writeMutex.Lock() defer w.writeMutex.Unlock() w.ws.SetWriteDeadline(time.Now().Add(writeWait)) return w.ws.WriteMessage(mt, payload) }
[ "func", "(", "w", "*", "Socket", ")", "write", "(", "mt", "int", ",", "payload", "[", "]", "byte", ")", "error", "{", "w", ".", "writeMutex", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "writeMutex", ".", "Unlock", "(", ")", "\n\n", "w", "....
// write writes a message with the given message type and payload. // This method is thread-safe.
[ "write", "writes", "a", "message", "with", "the", "given", "message", "type", "and", "payload", ".", "This", "method", "is", "thread", "-", "safe", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/sockets/websocket/socket.go#L186-L192
17,441
desertbit/glue
handler.go
New
func (h *handler) New() chan struct{} { // Lock the mutex. h.mutex.Lock() defer h.mutex.Unlock() // Signal the stop request by closing the channel if open. if !h.stopChanClosed { close(h.stopChan) } // Create a new stop channel. h.stopChan = make(chan struct{}) // Update the flag. h.stopChanClosed = false return h.stopChan }
go
func (h *handler) New() chan struct{} { // Lock the mutex. h.mutex.Lock() defer h.mutex.Unlock() // Signal the stop request by closing the channel if open. if !h.stopChanClosed { close(h.stopChan) } // Create a new stop channel. h.stopChan = make(chan struct{}) // Update the flag. h.stopChanClosed = false return h.stopChan }
[ "func", "(", "h", "*", "handler", ")", "New", "(", ")", "chan", "struct", "{", "}", "{", "// Lock the mutex.", "h", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "// Signal the stop request by c...
// New creates a new handler and stopps the previous handler if present. // A stop channel is returned, which is closed as soon as the handler is stopped.
[ "New", "creates", "a", "new", "handler", "and", "stopps", "the", "previous", "handler", "if", "present", ".", "A", "stop", "channel", "is", "returned", "which", "is", "closed", "as", "soon", "as", "the", "handler", "is", "stopped", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/handler.go#L42-L59
17,442
desertbit/glue
handler.go
Stop
func (h *handler) Stop() { // Lock the mutex. h.mutex.Lock() defer h.mutex.Unlock() // Signal the stop request by closing the channel if open. if !h.stopChanClosed { close(h.stopChan) h.stopChanClosed = true } }
go
func (h *handler) Stop() { // Lock the mutex. h.mutex.Lock() defer h.mutex.Unlock() // Signal the stop request by closing the channel if open. if !h.stopChanClosed { close(h.stopChan) h.stopChanClosed = true } }
[ "func", "(", "h", "*", "handler", ")", "Stop", "(", ")", "{", "// Lock the mutex.", "h", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "// Signal the stop request by closing the channel if open.", "if...
// Stop the handler if present.
[ "Stop", "the", "handler", "if", "present", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/handler.go#L62-L72
17,443
desertbit/glue
backend/closer/closer.go
Close
func (c *Closer) Close() { // Lock the mutex c.mutex.Lock() defer c.mutex.Unlock() // Just return if already closed. if c.IsClosed() { return } // Close the channel. close(c.IsClosedChan) // Emit the function. c.f() }
go
func (c *Closer) Close() { // Lock the mutex c.mutex.Lock() defer c.mutex.Unlock() // Just return if already closed. if c.IsClosed() { return } // Close the channel. close(c.IsClosedChan) // Emit the function. c.f() }
[ "func", "(", "c", "*", "Closer", ")", "Close", "(", ")", "{", "// Lock the mutex", "c", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "// Just return if already closed.", "if", "c", ".", "IsClos...
// Close calls the function and sets the IsClosed boolean.
[ "Close", "calls", "the", "function", "and", "sets", "the", "IsClosed", "boolean", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/backend/closer/closer.go#L45-L60
17,444
desertbit/glue
channel.go
Write
func (c *Channel) Write(data string) { // Prepend the socket command and send the channel name and data. c.s.write(cmdChannelData + utils.MarshalValues(c.name, data)) }
go
func (c *Channel) Write(data string) { // Prepend the socket command and send the channel name and data. c.s.write(cmdChannelData + utils.MarshalValues(c.name, data)) }
[ "func", "(", "c", "*", "Channel", ")", "Write", "(", "data", "string", ")", "{", "// Prepend the socket command and send the channel name and data.", "c", ".", "s", ".", "write", "(", "cmdChannelData", "+", "utils", ".", "MarshalValues", "(", "c", ".", "name", ...
// Write data to the channel.
[ "Write", "data", "to", "the", "channel", "." ]
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L68-L71
17,445
desertbit/glue
channel.go
Read
func (c *Channel) Read(timeout ...time.Duration) (string, error) { timeoutChan := make(chan (struct{})) // Create a timeout timer if a timeout is specified. if len(timeout) > 0 && timeout[0] > 0 { timer := time.AfterFunc(timeout[0], func() { // Trigger the timeout by closing the channel. close(timeoutChan) }) // Always stop the timer on defer. defer timer.Stop() } select { case data := <-c.readChan: return data, nil case <-c.s.isClosedChan: // The connection was closed. // Return an error. return "", ErrSocketClosed case <-timeoutChan: // The timeout was reached. // Return an error. return "", ErrReadTimeout } }
go
func (c *Channel) Read(timeout ...time.Duration) (string, error) { timeoutChan := make(chan (struct{})) // Create a timeout timer if a timeout is specified. if len(timeout) > 0 && timeout[0] > 0 { timer := time.AfterFunc(timeout[0], func() { // Trigger the timeout by closing the channel. close(timeoutChan) }) // Always stop the timer on defer. defer timer.Stop() } select { case data := <-c.readChan: return data, nil case <-c.s.isClosedChan: // The connection was closed. // Return an error. return "", ErrSocketClosed case <-timeoutChan: // The timeout was reached. // Return an error. return "", ErrReadTimeout } }
[ "func", "(", "c", "*", "Channel", ")", "Read", "(", "timeout", "...", "time", ".", "Duration", ")", "(", "string", ",", "error", ")", "{", "timeoutChan", ":=", "make", "(", "chan", "(", "struct", "{", "}", ")", ")", "\n\n", "// Create a timeout timer i...
// Read the next message from the channel. This method is blocking. // One variadic argument sets a timeout duration. // If no timeout is specified, this method will block forever. // ErrSocketClosed is returned, if the socket connection is closed. // ErrReadTimeout is returned, if the timeout is reached.
[ "Read", "the", "next", "message", "from", "the", "channel", ".", "This", "method", "is", "blocking", ".", "One", "variadic", "argument", "sets", "a", "timeout", "duration", ".", "If", "no", "timeout", "is", "specified", "this", "method", "will", "block", "...
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L78-L104
17,446
desertbit/glue
channel.go
OnRead
func (c *Channel) OnRead(f OnReadFunc) { // Create a new read handler for this channel. // Previous handlers are stopped first. handlerStopped := c.readHandler.New() // Start the handler goroutine. go func() { for { select { case data := <-c.readChan: // Call the callback in a new goroutine. go func() { // Recover panics and log the error. defer func() { if e := recover(); e != nil { log.L.Errorf("glue: panic while calling onRead function: %v\n%s", e, debug.Stack()) } }() // Trigger the on read event function. f(data) }() case <-c.s.isClosedChan: // Release this goroutine if the socket is closed. return case <-handlerStopped: // Release this goroutine. return } } }() }
go
func (c *Channel) OnRead(f OnReadFunc) { // Create a new read handler for this channel. // Previous handlers are stopped first. handlerStopped := c.readHandler.New() // Start the handler goroutine. go func() { for { select { case data := <-c.readChan: // Call the callback in a new goroutine. go func() { // Recover panics and log the error. defer func() { if e := recover(); e != nil { log.L.Errorf("glue: panic while calling onRead function: %v\n%s", e, debug.Stack()) } }() // Trigger the on read event function. f(data) }() case <-c.s.isClosedChan: // Release this goroutine if the socket is closed. return case <-handlerStopped: // Release this goroutine. return } } }() }
[ "func", "(", "c", "*", "Channel", ")", "OnRead", "(", "f", "OnReadFunc", ")", "{", "// Create a new read handler for this channel.", "// Previous handlers are stopped first.", "handlerStopped", ":=", "c", ".", "readHandler", ".", "New", "(", ")", "\n\n", "// Start the...
// OnRead sets the function which is triggered if new data is received on the channel. // If this event function based method of reading data from the socket is used, // then don't use the socket Read method. // Either use the OnRead or the Read approach.
[ "OnRead", "sets", "the", "function", "which", "is", "triggered", "if", "new", "data", "is", "received", "on", "the", "channel", ".", "If", "this", "event", "function", "based", "method", "of", "reading", "data", "from", "the", "socket", "is", "used", "then...
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L110-L141
17,447
desertbit/glue
channel.go
DiscardRead
func (c *Channel) DiscardRead() { // Create a new read handler for this channel. // Previous handlers are stopped first. handlerStopped := c.readHandler.New() // Start the handler goroutine. go func() { for { select { case <-c.readChan: // Don't do anything. // Just discard the data. case <-c.s.isClosedChan: // Release this goroutine if the socket is closed. return case <-handlerStopped: // Release this goroutine. return } } }() }
go
func (c *Channel) DiscardRead() { // Create a new read handler for this channel. // Previous handlers are stopped first. handlerStopped := c.readHandler.New() // Start the handler goroutine. go func() { for { select { case <-c.readChan: // Don't do anything. // Just discard the data. case <-c.s.isClosedChan: // Release this goroutine if the socket is closed. return case <-handlerStopped: // Release this goroutine. return } } }() }
[ "func", "(", "c", "*", "Channel", ")", "DiscardRead", "(", ")", "{", "// Create a new read handler for this channel.", "// Previous handlers are stopped first.", "handlerStopped", ":=", "c", ".", "readHandler", ".", "New", "(", ")", "\n\n", "// Start the handler goroutine...
// DiscardRead ignores and discars the data received from this channel. // Call this method during initialization, if you don't read any data from // this channel. If received data is not discarded, then the read buffer will block as soon // as it is full, which will also block the keep-alive mechanism of the socket. The result // would be a closed socket...
[ "DiscardRead", "ignores", "and", "discars", "the", "data", "received", "from", "this", "channel", ".", "Call", "this", "method", "during", "initialization", "if", "you", "don", "t", "read", "any", "data", "from", "this", "channel", ".", "If", "received", "da...
09c14070c2b18be76289ee6e7745772d39377776
https://github.com/desertbit/glue/blob/09c14070c2b18be76289ee6e7745772d39377776/channel.go#L148-L169
17,448
scottdware/go-bigip
ltm.go
SnatPools
func (b *BigIP) SnatPools() (*SnatPools, error) { var snatPools SnatPools err, _ := b.getForEntity(&snatPools, uriLtm, uriSnatPool) if err != nil { return nil, err } return &snatPools, nil }
go
func (b *BigIP) SnatPools() (*SnatPools, error) { var snatPools SnatPools err, _ := b.getForEntity(&snatPools, uriLtm, uriSnatPool) if err != nil { return nil, err } return &snatPools, nil }
[ "func", "(", "b", "*", "BigIP", ")", "SnatPools", "(", ")", "(", "*", "SnatPools", ",", "error", ")", "{", "var", "snatPools", "SnatPools", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "snatPools", ",", "uriLtm", ",", "uriSnatPool...
// SnatPools returns a list of snatpools.
[ "SnatPools", "returns", "a", "list", "of", "snatpools", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1042-L1050
17,449
scottdware/go-bigip
ltm.go
CreateSnatPool
func (b *BigIP) CreateSnatPool(name string, members []string) error { config := &SnatPool{ Name: name, Members: members, } return b.post(config, uriLtm, uriSnatPool) }
go
func (b *BigIP) CreateSnatPool(name string, members []string) error { config := &SnatPool{ Name: name, Members: members, } return b.post(config, uriLtm, uriSnatPool) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateSnatPool", "(", "name", "string", ",", "members", "[", "]", "string", ")", "error", "{", "config", ":=", "&", "SnatPool", "{", "Name", ":", "name", ",", "Members", ":", "members", ",", "}", "\n\n", "return"...
// CreateSnatPool adds a new snatpool to the BIG-IP system.
[ "CreateSnatPool", "adds", "a", "new", "snatpool", "to", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1053-L1060
17,450
scottdware/go-bigip
ltm.go
AddSnatPool
func (b *BigIP) AddSnatPool(config *SnatPool) error { return b.post(config, uriLtm, uriSnatPool) }
go
func (b *BigIP) AddSnatPool(config *SnatPool) error { return b.post(config, uriLtm, uriSnatPool) }
[ "func", "(", "b", "*", "BigIP", ")", "AddSnatPool", "(", "config", "*", "SnatPool", ")", "error", "{", "return", "b", ".", "post", "(", "config", ",", "uriLtm", ",", "uriSnatPool", ")", "\n", "}" ]
// AddSnatPool adds a new snatpool by config to the BIG-IP system.
[ "AddSnatPool", "adds", "a", "new", "snatpool", "by", "config", "to", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1063-L1066
17,451
scottdware/go-bigip
ltm.go
GetSnatPool
func (b *BigIP) GetSnatPool(name string) (*SnatPool, error) { var snatPool SnatPool err, ok := b.getForEntity(&snatPool, uriLtm, uriSnatPool, name) if err != nil { return nil, err } if !ok { return nil, nil } return &snatPool, nil }
go
func (b *BigIP) GetSnatPool(name string) (*SnatPool, error) { var snatPool SnatPool err, ok := b.getForEntity(&snatPool, uriLtm, uriSnatPool, name) if err != nil { return nil, err } if !ok { return nil, nil } return &snatPool, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetSnatPool", "(", "name", "string", ")", "(", "*", "SnatPool", ",", "error", ")", "{", "var", "snatPool", "SnatPool", "\n", "err", ",", "ok", ":=", "b", ".", "getForEntity", "(", "&", "snatPool", ",", "uriLtm", ...
// GetSnatPool retrieves a SnatPool by name. Returns nil if the snatpool does not exist
[ "GetSnatPool", "retrieves", "a", "SnatPool", "by", "name", ".", "Returns", "nil", "if", "the", "snatpool", "does", "not", "exist" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1069-L1080
17,452
scottdware/go-bigip
ltm.go
DeleteSnatPool
func (b *BigIP) DeleteSnatPool(name string) error { return b.delete(uriLtm, uriSnatPool, name) }
go
func (b *BigIP) DeleteSnatPool(name string) error { return b.delete(uriLtm, uriSnatPool, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteSnatPool", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriSnatPool", ",", "name", ")", "\n", "}" ]
// DeleteSnatPool removes a snatpool.
[ "DeleteSnatPool", "removes", "a", "snatpool", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1083-L1085
17,453
scottdware/go-bigip
ltm.go
ModifySnatPool
func (b *BigIP) ModifySnatPool(name string, config *SnatPool) error { return b.put(config, uriLtm, uriSnatPool, name) }
go
func (b *BigIP) ModifySnatPool(name string, config *SnatPool) error { return b.put(config, uriLtm, uriSnatPool, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifySnatPool", "(", "name", "string", ",", "config", "*", "SnatPool", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriSnatPool", ",", "name", ")", "\n", "}" ]
// ModifySnatPool allows you to change any attribute of a snatpool. Fields that // can be modified are referenced in the Snatpool struct.
[ "ModifySnatPool", "allows", "you", "to", "change", "any", "attribute", "of", "a", "snatpool", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "Snatpool", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1089-L1091
17,454
scottdware/go-bigip
ltm.go
ServerSSLProfiles
func (b *BigIP) ServerSSLProfiles() (*ServerSSLProfiles, error) { var serverSSLProfiles ServerSSLProfiles err, _ := b.getForEntity(&serverSSLProfiles, uriLtm, uriProfile, uriServerSSL) if err != nil { return nil, err } return &serverSSLProfiles, nil }
go
func (b *BigIP) ServerSSLProfiles() (*ServerSSLProfiles, error) { var serverSSLProfiles ServerSSLProfiles err, _ := b.getForEntity(&serverSSLProfiles, uriLtm, uriProfile, uriServerSSL) if err != nil { return nil, err } return &serverSSLProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "ServerSSLProfiles", "(", ")", "(", "*", "ServerSSLProfiles", ",", "error", ")", "{", "var", "serverSSLProfiles", "ServerSSLProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "serverSSLProfiles", ...
// ServerSSLProfiles returns a list of server-ssl profiles.
[ "ServerSSLProfiles", "returns", "a", "list", "of", "server", "-", "ssl", "profiles", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1094-L1102
17,455
scottdware/go-bigip
ltm.go
GetServerSSLProfile
func (b *BigIP) GetServerSSLProfile(name string) (*ServerSSLProfile, error) { var serverSSLProfile ServerSSLProfile err, ok := b.getForEntity(&serverSSLProfile, uriLtm, uriProfile, uriServerSSL, name) if err != nil { return nil, err } if !ok { return nil, nil } return &serverSSLProfile, nil }
go
func (b *BigIP) GetServerSSLProfile(name string) (*ServerSSLProfile, error) { var serverSSLProfile ServerSSLProfile err, ok := b.getForEntity(&serverSSLProfile, uriLtm, uriProfile, uriServerSSL, name) if err != nil { return nil, err } if !ok { return nil, nil } return &serverSSLProfile, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetServerSSLProfile", "(", "name", "string", ")", "(", "*", "ServerSSLProfile", ",", "error", ")", "{", "var", "serverSSLProfile", "ServerSSLProfile", "\n", "err", ",", "ok", ":=", "b", ".", "getForEntity", "(", "&", ...
// GetServerSSLProfile gets a server-ssl profile by name. Returns nil if the server-ssl profile does not exist
[ "GetServerSSLProfile", "gets", "a", "server", "-", "ssl", "profile", "by", "name", ".", "Returns", "nil", "if", "the", "server", "-", "ssl", "profile", "does", "not", "exist" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1105-L1116
17,456
scottdware/go-bigip
ltm.go
CreateServerSSLProfile
func (b *BigIP) CreateServerSSLProfile(name string, parent string) error { config := &ServerSSLProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriServerSSL) }
go
func (b *BigIP) CreateServerSSLProfile(name string, parent string) error { config := &ServerSSLProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriServerSSL) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateServerSSLProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "ServerSSLProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "re...
// CreateServerSSLProfile creates a new server-ssl profile on the BIG-IP system.
[ "CreateServerSSLProfile", "creates", "a", "new", "server", "-", "ssl", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1119-L1126
17,457
scottdware/go-bigip
ltm.go
AddServerSSLProfile
func (b *BigIP) AddServerSSLProfile(config *ServerSSLProfile) error { return b.post(config, uriLtm, uriProfile, uriServerSSL) }
go
func (b *BigIP) AddServerSSLProfile(config *ServerSSLProfile) error { return b.post(config, uriLtm, uriProfile, uriServerSSL) }
[ "func", "(", "b", "*", "BigIP", ")", "AddServerSSLProfile", "(", "config", "*", "ServerSSLProfile", ")", "error", "{", "return", "b", ".", "post", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriServerSSL", ")", "\n", "}" ]
// AddServerSSLProfile adds a new server-ssl profile on the BIG-IP system.
[ "AddServerSSLProfile", "adds", "a", "new", "server", "-", "ssl", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1129-L1131
17,458
scottdware/go-bigip
ltm.go
DeleteServerSSLProfile
func (b *BigIP) DeleteServerSSLProfile(name string) error { return b.delete(uriLtm, uriProfile, uriServerSSL, name) }
go
func (b *BigIP) DeleteServerSSLProfile(name string) error { return b.delete(uriLtm, uriProfile, uriServerSSL, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteServerSSLProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriServerSSL", ",", "name", ")", "\n", "}" ]
// DeleteServerSSLProfile removes a server-ssl profile.
[ "DeleteServerSSLProfile", "removes", "a", "server", "-", "ssl", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1134-L1136
17,459
scottdware/go-bigip
ltm.go
ModifyServerSSLProfile
func (b *BigIP) ModifyServerSSLProfile(name string, config *ServerSSLProfile) error { return b.put(config, uriLtm, uriProfile, uriServerSSL, name) }
go
func (b *BigIP) ModifyServerSSLProfile(name string, config *ServerSSLProfile) error { return b.put(config, uriLtm, uriProfile, uriServerSSL, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyServerSSLProfile", "(", "name", "string", ",", "config", "*", "ServerSSLProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriServerSSL", ",", "name", ...
// ModifyServerSSLProfile allows you to change any attribute of a sever-ssl profile. // Fields that can be modified are referenced in the VirtualServer struct.
[ "ModifyServerSSLProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "sever", "-", "ssl", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "VirtualServer", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1140-L1142
17,460
scottdware/go-bigip
ltm.go
ClientSSLProfiles
func (b *BigIP) ClientSSLProfiles() (*ClientSSLProfiles, error) { var clientSSLProfiles ClientSSLProfiles err, _ := b.getForEntity(&clientSSLProfiles, uriLtm, uriProfile, uriClientSSL) if err != nil { return nil, err } return &clientSSLProfiles, nil }
go
func (b *BigIP) ClientSSLProfiles() (*ClientSSLProfiles, error) { var clientSSLProfiles ClientSSLProfiles err, _ := b.getForEntity(&clientSSLProfiles, uriLtm, uriProfile, uriClientSSL) if err != nil { return nil, err } return &clientSSLProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "ClientSSLProfiles", "(", ")", "(", "*", "ClientSSLProfiles", ",", "error", ")", "{", "var", "clientSSLProfiles", "ClientSSLProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "clientSSLProfiles", ...
// ClientSSLProfiles returns a list of client-ssl profiles.
[ "ClientSSLProfiles", "returns", "a", "list", "of", "client", "-", "ssl", "profiles", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1145-L1153
17,461
scottdware/go-bigip
ltm.go
GetClientSSLProfile
func (b *BigIP) GetClientSSLProfile(name string) (*ClientSSLProfile, error) { var clientSSLProfile ClientSSLProfile err, ok := b.getForEntity(&clientSSLProfile, uriLtm, uriProfile, uriClientSSL, name) if err != nil { return nil, err } if !ok { return nil, nil } return &clientSSLProfile, nil }
go
func (b *BigIP) GetClientSSLProfile(name string) (*ClientSSLProfile, error) { var clientSSLProfile ClientSSLProfile err, ok := b.getForEntity(&clientSSLProfile, uriLtm, uriProfile, uriClientSSL, name) if err != nil { return nil, err } if !ok { return nil, nil } return &clientSSLProfile, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetClientSSLProfile", "(", "name", "string", ")", "(", "*", "ClientSSLProfile", ",", "error", ")", "{", "var", "clientSSLProfile", "ClientSSLProfile", "\n", "err", ",", "ok", ":=", "b", ".", "getForEntity", "(", "&", ...
// GetClientSSLProfile gets a client-ssl profile by name. Returns nil if the client-ssl profile does not exist
[ "GetClientSSLProfile", "gets", "a", "client", "-", "ssl", "profile", "by", "name", ".", "Returns", "nil", "if", "the", "client", "-", "ssl", "profile", "does", "not", "exist" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1156-L1167
17,462
scottdware/go-bigip
ltm.go
CreateClientSSLProfile
func (b *BigIP) CreateClientSSLProfile(name string, parent string) error { config := &ClientSSLProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriClientSSL) }
go
func (b *BigIP) CreateClientSSLProfile(name string, parent string) error { config := &ClientSSLProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriClientSSL) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateClientSSLProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "ClientSSLProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "re...
// CreateClientSSLProfile creates a new client-ssl profile on the BIG-IP system.
[ "CreateClientSSLProfile", "creates", "a", "new", "client", "-", "ssl", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1170-L1177
17,463
scottdware/go-bigip
ltm.go
AddClientSSLProfile
func (b *BigIP) AddClientSSLProfile(config *ClientSSLProfile) error { return b.post(config, uriLtm, uriProfile, uriClientSSL) }
go
func (b *BigIP) AddClientSSLProfile(config *ClientSSLProfile) error { return b.post(config, uriLtm, uriProfile, uriClientSSL) }
[ "func", "(", "b", "*", "BigIP", ")", "AddClientSSLProfile", "(", "config", "*", "ClientSSLProfile", ")", "error", "{", "return", "b", ".", "post", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriClientSSL", ")", "\n", "}" ]
// AddClientSSLProfile adds a new client-ssl profile on the BIG-IP system.
[ "AddClientSSLProfile", "adds", "a", "new", "client", "-", "ssl", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1180-L1182
17,464
scottdware/go-bigip
ltm.go
DeleteClientSSLProfile
func (b *BigIP) DeleteClientSSLProfile(name string) error { return b.delete(uriLtm, uriProfile, uriClientSSL, name) }
go
func (b *BigIP) DeleteClientSSLProfile(name string) error { return b.delete(uriLtm, uriProfile, uriClientSSL, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteClientSSLProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriClientSSL", ",", "name", ")", "\n", "}" ]
// DeleteClientSSLProfile removes a client-ssl profile.
[ "DeleteClientSSLProfile", "removes", "a", "client", "-", "ssl", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1185-L1187
17,465
scottdware/go-bigip
ltm.go
ModifyClientSSLProfile
func (b *BigIP) ModifyClientSSLProfile(name string, config *ClientSSLProfile) error { return b.put(config, uriLtm, uriProfile, uriClientSSL, name) }
go
func (b *BigIP) ModifyClientSSLProfile(name string, config *ClientSSLProfile) error { return b.put(config, uriLtm, uriProfile, uriClientSSL, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyClientSSLProfile", "(", "name", "string", ",", "config", "*", "ClientSSLProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriClientSSL", ",", "name", ...
// ModifyClientSSLProfile allows you to change any attribute of a client-ssl profile. // Fields that can be modified are referenced in the ClientSSLProfile struct.
[ "ModifyClientSSLProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "client", "-", "ssl", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "ClientSSLProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1191-L1193
17,466
scottdware/go-bigip
ltm.go
TcpProfiles
func (b *BigIP) TcpProfiles() (*TcpProfiles, error) { var tcpProfiles TcpProfiles err, _ := b.getForEntity(&tcpProfiles, uriLtm, uriProfile, uriTcp) if err != nil { return nil, err } return &tcpProfiles, nil }
go
func (b *BigIP) TcpProfiles() (*TcpProfiles, error) { var tcpProfiles TcpProfiles err, _ := b.getForEntity(&tcpProfiles, uriLtm, uriProfile, uriTcp) if err != nil { return nil, err } return &tcpProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "TcpProfiles", "(", ")", "(", "*", "TcpProfiles", ",", "error", ")", "{", "var", "tcpProfiles", "TcpProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "tcpProfiles", ",", "uriLtm", ",", "u...
// TcpProfiles returns a list of Tcp profiles
[ "TcpProfiles", "returns", "a", "list", "of", "Tcp", "profiles" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1196-L1204
17,467
scottdware/go-bigip
ltm.go
CreateTcpProfile
func (b *BigIP) CreateTcpProfile(name string, parent string) error { config := &TcpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriTcp) }
go
func (b *BigIP) CreateTcpProfile(name string, parent string) error { config := &TcpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriTcp) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateTcpProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "TcpProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "return", "b"...
// CreateTcpProfile creates a new tcp profile on the BIG-IP system.
[ "CreateTcpProfile", "creates", "a", "new", "tcp", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1221-L1228
17,468
scottdware/go-bigip
ltm.go
DeleteTcpProfile
func (b *BigIP) DeleteTcpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriTcp, name) }
go
func (b *BigIP) DeleteTcpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriTcp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteTcpProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriTcp", ",", "name", ")", "\n", "}" ]
// DeleteTcpProfile removes a tcp profile.
[ "DeleteTcpProfile", "removes", "a", "tcp", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1235-L1237
17,469
scottdware/go-bigip
ltm.go
ModifyTcpProfile
func (b *BigIP) ModifyTcpProfile(name string, config *TcpProfile) error { return b.put(config, uriLtm, uriProfile, uriTcp, name) }
go
func (b *BigIP) ModifyTcpProfile(name string, config *TcpProfile) error { return b.put(config, uriLtm, uriProfile, uriTcp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyTcpProfile", "(", "name", "string", ",", "config", "*", "TcpProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriTcp", ",", "name", ")", "\n", "}...
// ModifyTcpProfile allows you to change any attribute of a tcp profile. // Fields that can be modified are referenced in the TcpProfile struct.
[ "ModifyTcpProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "tcp", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "TcpProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1241-L1243
17,470
scottdware/go-bigip
ltm.go
UdpProfiles
func (b *BigIP) UdpProfiles() (*UdpProfiles, error) { var udpProfiles UdpProfiles err, _ := b.getForEntity(&udpProfiles, uriLtm, uriProfile, uriUdp) if err != nil { return nil, err } return &udpProfiles, nil }
go
func (b *BigIP) UdpProfiles() (*UdpProfiles, error) { var udpProfiles UdpProfiles err, _ := b.getForEntity(&udpProfiles, uriLtm, uriProfile, uriUdp) if err != nil { return nil, err } return &udpProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "UdpProfiles", "(", ")", "(", "*", "UdpProfiles", ",", "error", ")", "{", "var", "udpProfiles", "UdpProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "udpProfiles", ",", "uriLtm", ",", "u...
// UdpProfiles returns a list of Udp profiles
[ "UdpProfiles", "returns", "a", "list", "of", "Udp", "profiles" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1246-L1254
17,471
scottdware/go-bigip
ltm.go
CreateUdpProfile
func (b *BigIP) CreateUdpProfile(name string, parent string) error { config := &UdpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriUdp) }
go
func (b *BigIP) CreateUdpProfile(name string, parent string) error { config := &UdpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriUdp) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateUdpProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "UdpProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "return", "b"...
// CreateUdpProfile creates a new udp profile on the BIG-IP system.
[ "CreateUdpProfile", "creates", "a", "new", "udp", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1271-L1278
17,472
scottdware/go-bigip
ltm.go
DeleteUdpProfile
func (b *BigIP) DeleteUdpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriUdp, name) }
go
func (b *BigIP) DeleteUdpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriUdp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteUdpProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriUdp", ",", "name", ")", "\n", "}" ]
// DeleteUdpProfile removes a udp profile.
[ "DeleteUdpProfile", "removes", "a", "udp", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1285-L1287
17,473
scottdware/go-bigip
ltm.go
ModifyUdpProfile
func (b *BigIP) ModifyUdpProfile(name string, config *UdpProfile) error { return b.put(config, uriLtm, uriProfile, uriUdp, name) }
go
func (b *BigIP) ModifyUdpProfile(name string, config *UdpProfile) error { return b.put(config, uriLtm, uriProfile, uriUdp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyUdpProfile", "(", "name", "string", ",", "config", "*", "UdpProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriUdp", ",", "name", ")", "\n", "}...
// ModifyUdpProfile allows you to change any attribute of a udp profile. // Fields that can be modified are referenced in the UdpProfile struct.
[ "ModifyUdpProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "udp", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "UdpProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1291-L1293
17,474
scottdware/go-bigip
ltm.go
HttpProfiles
func (b *BigIP) HttpProfiles() (*HttpProfiles, error) { var httpProfiles HttpProfiles err, _ := b.getForEntity(&httpProfiles, uriLtm, uriProfile, uriHttp) if err != nil { return nil, err } return &httpProfiles, nil }
go
func (b *BigIP) HttpProfiles() (*HttpProfiles, error) { var httpProfiles HttpProfiles err, _ := b.getForEntity(&httpProfiles, uriLtm, uriProfile, uriHttp) if err != nil { return nil, err } return &httpProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "HttpProfiles", "(", ")", "(", "*", "HttpProfiles", ",", "error", ")", "{", "var", "httpProfiles", "HttpProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "httpProfiles", ",", "uriLtm", ",",...
// HttpProfiles returns a list of HTTP profiles
[ "HttpProfiles", "returns", "a", "list", "of", "HTTP", "profiles" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1296-L1304
17,475
scottdware/go-bigip
ltm.go
CreateHttpProfile
func (b *BigIP) CreateHttpProfile(name string, parent string) error { config := &HttpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriHttp) }
go
func (b *BigIP) CreateHttpProfile(name string, parent string) error { config := &HttpProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriHttp) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateHttpProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "HttpProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "return", "...
// CreateHttpProfile creates a new http profile on the BIG-IP system.
[ "CreateHttpProfile", "creates", "a", "new", "http", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1321-L1328
17,476
scottdware/go-bigip
ltm.go
DeleteHttpProfile
func (b *BigIP) DeleteHttpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriHttp, name) }
go
func (b *BigIP) DeleteHttpProfile(name string) error { return b.delete(uriLtm, uriProfile, uriHttp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteHttpProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriHttp", ",", "name", ")", "\n", "}" ]
// DeleteHttpProfile removes a http profile.
[ "DeleteHttpProfile", "removes", "a", "http", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1335-L1337
17,477
scottdware/go-bigip
ltm.go
ModifyHttpProfile
func (b *BigIP) ModifyHttpProfile(name string, config *HttpProfile) error { return b.put(config, uriLtm, uriProfile, uriHttp, name) }
go
func (b *BigIP) ModifyHttpProfile(name string, config *HttpProfile) error { return b.put(config, uriLtm, uriProfile, uriHttp, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyHttpProfile", "(", "name", "string", ",", "config", "*", "HttpProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriHttp", ",", "name", ")", "\n", ...
// ModifyHttpProfile allows you to change any attribute of a http profile. // Fields that can be modified are referenced in the HttpProfile struct.
[ "ModifyHttpProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "http", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "HttpProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1341-L1343
17,478
scottdware/go-bigip
ltm.go
OneconnectProfiles
func (b *BigIP) OneconnectProfiles() (*OneconnectProfiles, error) { var oneconnectProfiles OneconnectProfiles err, _ := b.getForEntity(&oneconnectProfiles, uriLtm, uriProfile, uriOneConnect) if err != nil { return nil, err } return &oneconnectProfiles, nil }
go
func (b *BigIP) OneconnectProfiles() (*OneconnectProfiles, error) { var oneconnectProfiles OneconnectProfiles err, _ := b.getForEntity(&oneconnectProfiles, uriLtm, uriProfile, uriOneConnect) if err != nil { return nil, err } return &oneconnectProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "OneconnectProfiles", "(", ")", "(", "*", "OneconnectProfiles", ",", "error", ")", "{", "var", "oneconnectProfiles", "OneconnectProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "oneconnectProfil...
// OneconnectProfiles returns a list of HTTP profiles
[ "OneconnectProfiles", "returns", "a", "list", "of", "HTTP", "profiles" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1346-L1354
17,479
scottdware/go-bigip
ltm.go
CreateOneconnectProfile
func (b *BigIP) CreateOneconnectProfile(name string, parent string) error { config := &OneconnectProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriOneConnect) }
go
func (b *BigIP) CreateOneconnectProfile(name string, parent string) error { config := &OneconnectProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriOneConnect) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateOneconnectProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "OneconnectProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "\n\n", "...
// CreateOneconnectProfile creates a new http profile on the BIG-IP system.
[ "CreateOneconnectProfile", "creates", "a", "new", "http", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1371-L1378
17,480
scottdware/go-bigip
ltm.go
DeleteOneconnectProfile
func (b *BigIP) DeleteOneconnectProfile(name string) error { return b.delete(uriLtm, uriProfile, uriOneConnect, name) }
go
func (b *BigIP) DeleteOneconnectProfile(name string) error { return b.delete(uriLtm, uriProfile, uriOneConnect, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteOneconnectProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriOneConnect", ",", "name", ")", "\n", "}" ]
// DeleteOneconnectProfile removes a http profile.
[ "DeleteOneconnectProfile", "removes", "a", "http", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1385-L1387
17,481
scottdware/go-bigip
ltm.go
ModifyOneconnectProfile
func (b *BigIP) ModifyOneconnectProfile(name string, config *OneconnectProfile) error { return b.put(config, uriLtm, uriProfile, uriOneConnect, name) }
go
func (b *BigIP) ModifyOneconnectProfile(name string, config *OneconnectProfile) error { return b.put(config, uriLtm, uriProfile, uriOneConnect, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyOneconnectProfile", "(", "name", "string", ",", "config", "*", "OneconnectProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriOneConnect", ",", "name"...
// ModifyOneconnectProfile allows you to change any attribute of a http profile. // Fields that can be modified are referenced in the OneconnectProfile struct.
[ "ModifyOneconnectProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "http", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "OneconnectProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1391-L1393
17,482
scottdware/go-bigip
ltm.go
HttpCompressionProfiles
func (b *BigIP) HttpCompressionProfiles() (*HttpCompressionProfiles, error) { var httpCompressionProfiles HttpCompressionProfiles err, _ := b.getForEntity(&httpCompressionProfiles, uriLtm, uriProfile, uriHttpCompression) if err != nil { return nil, err } return &httpCompressionProfiles, nil }
go
func (b *BigIP) HttpCompressionProfiles() (*HttpCompressionProfiles, error) { var httpCompressionProfiles HttpCompressionProfiles err, _ := b.getForEntity(&httpCompressionProfiles, uriLtm, uriProfile, uriHttpCompression) if err != nil { return nil, err } return &httpCompressionProfiles, nil }
[ "func", "(", "b", "*", "BigIP", ")", "HttpCompressionProfiles", "(", ")", "(", "*", "HttpCompressionProfiles", ",", "error", ")", "{", "var", "httpCompressionProfiles", "HttpCompressionProfiles", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&",...
// HttpCompressionProfiles returns a list of HTTP profiles
[ "HttpCompressionProfiles", "returns", "a", "list", "of", "HTTP", "profiles" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1396-L1404
17,483
scottdware/go-bigip
ltm.go
CreateHttpCompressionProfile
func (b *BigIP) CreateHttpCompressionProfile(name string, parent string) error { config := &HttpCompressionProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriHttpCompression) }
go
func (b *BigIP) CreateHttpCompressionProfile(name string, parent string) error { config := &HttpCompressionProfile{ Name: name, DefaultsFrom: parent, } return b.post(config, uriLtm, uriProfile, uriHttpCompression) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateHttpCompressionProfile", "(", "name", "string", ",", "parent", "string", ")", "error", "{", "config", ":=", "&", "HttpCompressionProfile", "{", "Name", ":", "name", ",", "DefaultsFrom", ":", "parent", ",", "}", "...
// CreateHttpCompressionProfile creates a new http profile on the BIG-IP system.
[ "CreateHttpCompressionProfile", "creates", "a", "new", "http", "profile", "on", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1421-L1428
17,484
scottdware/go-bigip
ltm.go
DeleteHttpCompressionProfile
func (b *BigIP) DeleteHttpCompressionProfile(name string) error { return b.delete(uriLtm, uriProfile, uriHttpCompression, name) }
go
func (b *BigIP) DeleteHttpCompressionProfile(name string) error { return b.delete(uriLtm, uriProfile, uriHttpCompression, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteHttpCompressionProfile", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriProfile", ",", "uriHttpCompression", ",", "name", ")", "\n", "}" ]
// DeleteHttpCompressionProfile removes a http profile.
[ "DeleteHttpCompressionProfile", "removes", "a", "http", "profile", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1435-L1437
17,485
scottdware/go-bigip
ltm.go
ModifyHttpCompressionProfile
func (b *BigIP) ModifyHttpCompressionProfile(name string, config *HttpCompressionProfile) error { return b.put(config, uriLtm, uriProfile, uriHttpCompression, name) }
go
func (b *BigIP) ModifyHttpCompressionProfile(name string, config *HttpCompressionProfile) error { return b.put(config, uriLtm, uriProfile, uriHttpCompression, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyHttpCompressionProfile", "(", "name", "string", ",", "config", "*", "HttpCompressionProfile", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriProfile", ",", "uriHttpCompression", ...
// ModifyHttpCompressionProfile allows you to change any attribute of a http profile. // Fields that can be modified are referenced in the HttpCompressionProfile struct.
[ "ModifyHttpCompressionProfile", "allows", "you", "to", "change", "any", "attribute", "of", "a", "http", "profile", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "HttpCompressionProfile", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1441-L1443
17,486
scottdware/go-bigip
ltm.go
Nodes
func (b *BigIP) Nodes() (*Nodes, error) { var nodes Nodes err, _ := b.getForEntity(&nodes, uriLtm, uriNode) if err != nil { return nil, err } return &nodes, nil }
go
func (b *BigIP) Nodes() (*Nodes, error) { var nodes Nodes err, _ := b.getForEntity(&nodes, uriLtm, uriNode) if err != nil { return nil, err } return &nodes, nil }
[ "func", "(", "b", "*", "BigIP", ")", "Nodes", "(", ")", "(", "*", "Nodes", ",", "error", ")", "{", "var", "nodes", "Nodes", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "nodes", ",", "uriLtm", ",", "uriNode", ")", "\n", "if"...
// Nodes returns a list of nodes.
[ "Nodes", "returns", "a", "list", "of", "nodes", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1446-L1454
17,487
scottdware/go-bigip
ltm.go
AddNode
func (b *BigIP) AddNode(config *Node) error { return b.post(config, uriLtm, uriNode) }
go
func (b *BigIP) AddNode(config *Node) error { return b.post(config, uriLtm, uriNode) }
[ "func", "(", "b", "*", "BigIP", ")", "AddNode", "(", "config", "*", "Node", ")", "error", "{", "return", "b", ".", "post", "(", "config", ",", "uriLtm", ",", "uriNode", ")", "\n", "}" ]
// AddNode adds a new node to the BIG-IP system using a spec
[ "AddNode", "adds", "a", "new", "node", "to", "the", "BIG", "-", "IP", "system", "using", "a", "spec" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1457-L1459
17,488
scottdware/go-bigip
ltm.go
CreateFQDNNode
func (b *BigIP) CreateFQDNNode(name, address, rate_limit string, connection_limit, dynamic_ratio int, monitor, state string) error { config := &Node{ Name: name, RateLimit: rate_limit, ConnectionLimit: connection_limit, DynamicRatio: dynamic_ratio, Monitor: monitor, State: state, } config.FQDN.Name = address return b.post(config, uriLtm, uriNode) }
go
func (b *BigIP) CreateFQDNNode(name, address, rate_limit string, connection_limit, dynamic_ratio int, monitor, state string) error { config := &Node{ Name: name, RateLimit: rate_limit, ConnectionLimit: connection_limit, DynamicRatio: dynamic_ratio, Monitor: monitor, State: state, } config.FQDN.Name = address return b.post(config, uriLtm, uriNode) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateFQDNNode", "(", "name", ",", "address", ",", "rate_limit", "string", ",", "connection_limit", ",", "dynamic_ratio", "int", ",", "monitor", ",", "state", "string", ")", "error", "{", "config", ":=", "&", "Node", ...
// CreateFQDNNode adds a new FQDN based node to the BIG-IP system.
[ "CreateFQDNNode", "adds", "a", "new", "FQDN", "based", "node", "to", "the", "BIG", "-", "IP", "system", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1485-L1496
17,489
scottdware/go-bigip
ltm.go
GetNode
func (b *BigIP) GetNode(name string) (*Node, error) { var node Node err, ok := b.getForEntity(&node, uriLtm, uriNode, name) if err != nil { return nil, err } if !ok { return nil, nil } return &node, nil }
go
func (b *BigIP) GetNode(name string) (*Node, error) { var node Node err, ok := b.getForEntity(&node, uriLtm, uriNode, name) if err != nil { return nil, err } if !ok { return nil, nil } return &node, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetNode", "(", "name", "string", ")", "(", "*", "Node", ",", "error", ")", "{", "var", "node", "Node", "\n", "err", ",", "ok", ":=", "b", ".", "getForEntity", "(", "&", "node", ",", "uriLtm", ",", "uriNode", ...
// Get a Node by name. Returns nil if the node does not exist
[ "Get", "a", "Node", "by", "name", ".", "Returns", "nil", "if", "the", "node", "does", "not", "exist" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1499-L1510
17,490
scottdware/go-bigip
ltm.go
DeleteNode
func (b *BigIP) DeleteNode(name string) error { return b.delete(uriLtm, uriNode, name) }
go
func (b *BigIP) DeleteNode(name string) error { return b.delete(uriLtm, uriNode, name) }
[ "func", "(", "b", "*", "BigIP", ")", "DeleteNode", "(", "name", "string", ")", "error", "{", "return", "b", ".", "delete", "(", "uriLtm", ",", "uriNode", ",", "name", ")", "\n", "}" ]
// DeleteNode removes a node.
[ "DeleteNode", "removes", "a", "node", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1513-L1515
17,491
scottdware/go-bigip
ltm.go
ModifyNode
func (b *BigIP) ModifyNode(name string, config *Node) error { return b.put(config, uriLtm, uriNode, name) }
go
func (b *BigIP) ModifyNode(name string, config *Node) error { return b.put(config, uriLtm, uriNode, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyNode", "(", "name", "string", ",", "config", "*", "Node", ")", "error", "{", "return", "b", ".", "put", "(", "config", ",", "uriLtm", ",", "uriNode", ",", "name", ")", "\n", "}" ]
// ModifyNode allows you to change any attribute of a node. Fields that // can be modified are referenced in the Node struct.
[ "ModifyNode", "allows", "you", "to", "change", "any", "attribute", "of", "a", "node", ".", "Fields", "that", "can", "be", "modified", "are", "referenced", "in", "the", "Node", "struct", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1519-L1521
17,492
scottdware/go-bigip
ltm.go
InternalDataGroups
func (b *BigIP) InternalDataGroups() (*DataGroups, error) { var dataGroups DataGroups err, _ := b.getForEntity(&dataGroups, uriLtm, uriDatagroup, uriInternal) if err != nil { return nil, err } return &dataGroups, nil }
go
func (b *BigIP) InternalDataGroups() (*DataGroups, error) { var dataGroups DataGroups err, _ := b.getForEntity(&dataGroups, uriLtm, uriDatagroup, uriInternal) if err != nil { return nil, err } return &dataGroups, nil }
[ "func", "(", "b", "*", "BigIP", ")", "InternalDataGroups", "(", ")", "(", "*", "DataGroups", ",", "error", ")", "{", "var", "dataGroups", "DataGroups", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "dataGroups", ",", "uriLtm", ",", ...
// InternalDataGroups returns a list of internal data groups.
[ "InternalDataGroups", "returns", "a", "list", "of", "internal", "data", "groups", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1544-L1552
17,493
scottdware/go-bigip
ltm.go
CreateInternalDataGroup
func (b *BigIP) CreateInternalDataGroup(name string, datatype string) error { config := &DataGroup{ Name: name, Type: datatype, } return b.post(config, uriLtm, uriDatagroup, uriInternal) }
go
func (b *BigIP) CreateInternalDataGroup(name string, datatype string) error { config := &DataGroup{ Name: name, Type: datatype, } return b.post(config, uriLtm, uriDatagroup, uriInternal) }
[ "func", "(", "b", "*", "BigIP", ")", "CreateInternalDataGroup", "(", "name", "string", ",", "datatype", "string", ")", "error", "{", "config", ":=", "&", "DataGroup", "{", "Name", ":", "name", ",", "Type", ":", "datatype", ",", "}", "\n\n", "return", "...
// Create an internal data group; dataype must bee one of "ip", "string", or "integer"
[ "Create", "an", "internal", "data", "group", ";", "dataype", "must", "bee", "one", "of", "ip", "string", "or", "integer" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1570-L1577
17,494
scottdware/go-bigip
ltm.go
ModifyInternalDataGroupRecords
func (b *BigIP) ModifyInternalDataGroupRecords(name string, records *[]DataGroupRecord) error { config := &DataGroup{ Records: *records, } return b.put(config, uriLtm, uriDatagroup, uriInternal, name) }
go
func (b *BigIP) ModifyInternalDataGroupRecords(name string, records *[]DataGroupRecord) error { config := &DataGroup{ Records: *records, } return b.put(config, uriLtm, uriDatagroup, uriInternal, name) }
[ "func", "(", "b", "*", "BigIP", ")", "ModifyInternalDataGroupRecords", "(", "name", "string", ",", "records", "*", "[", "]", "DataGroupRecord", ")", "error", "{", "config", ":=", "&", "DataGroup", "{", "Records", ":", "*", "records", ",", "}", "\n", "ret...
// Modify a named internal data group, REPLACING all the records
[ "Modify", "a", "named", "internal", "data", "group", "REPLACING", "all", "the", "records" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1588-L1593
17,495
scottdware/go-bigip
ltm.go
GetInternalDataGroupRecords
func (b *BigIP) GetInternalDataGroupRecords(name string) (*[]DataGroupRecord, error) { var dataGroup DataGroup err, _ := b.getForEntity(&dataGroup, uriLtm, uriDatagroup, uriInternal, name) if err != nil { return nil, err } return &dataGroup.Records, nil }
go
func (b *BigIP) GetInternalDataGroupRecords(name string) (*[]DataGroupRecord, error) { var dataGroup DataGroup err, _ := b.getForEntity(&dataGroup, uriLtm, uriDatagroup, uriInternal, name) if err != nil { return nil, err } return &dataGroup.Records, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetInternalDataGroupRecords", "(", "name", "string", ")", "(", "*", "[", "]", "DataGroupRecord", ",", "error", ")", "{", "var", "dataGroup", "DataGroup", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", ...
// Get the internal data group records for a named internal data group
[ "Get", "the", "internal", "data", "group", "records", "for", "a", "named", "internal", "data", "group" ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1596-L1604
17,496
scottdware/go-bigip
ltm.go
Pools
func (b *BigIP) Pools() (*Pools, error) { var pools Pools err, _ := b.getForEntity(&pools, uriLtm, uriPool) if err != nil { return nil, err } return &pools, nil }
go
func (b *BigIP) Pools() (*Pools, error) { var pools Pools err, _ := b.getForEntity(&pools, uriLtm, uriPool) if err != nil { return nil, err } return &pools, nil }
[ "func", "(", "b", "*", "BigIP", ")", "Pools", "(", ")", "(", "*", "Pools", ",", "error", ")", "{", "var", "pools", "Pools", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "pools", ",", "uriLtm", ",", "uriPool", ")", "\n", "if"...
// Pools returns a list of pools.
[ "Pools", "returns", "a", "list", "of", "pools", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1607-L1615
17,497
scottdware/go-bigip
ltm.go
PoolMembers
func (b *BigIP) PoolMembers(name string) (*PoolMembers, error) { var poolMembers PoolMembers err, _ := b.getForEntity(&poolMembers, uriLtm, uriPool, name, uriPoolMember) if err != nil { return nil, err } return &poolMembers, nil }
go
func (b *BigIP) PoolMembers(name string) (*PoolMembers, error) { var poolMembers PoolMembers err, _ := b.getForEntity(&poolMembers, uriLtm, uriPool, name, uriPoolMember) if err != nil { return nil, err } return &poolMembers, nil }
[ "func", "(", "b", "*", "BigIP", ")", "PoolMembers", "(", "name", "string", ")", "(", "*", "PoolMembers", ",", "error", ")", "{", "var", "poolMembers", "PoolMembers", "\n", "err", ",", "_", ":=", "b", ".", "getForEntity", "(", "&", "poolMembers", ",", ...
// PoolMembers returns a list of pool members for the given pool.
[ "PoolMembers", "returns", "a", "list", "of", "pool", "members", "for", "the", "given", "pool", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1618-L1626
17,498
scottdware/go-bigip
ltm.go
GetPoolMember
func (b *BigIP) GetPoolMember(pool string, member string) (*PoolMember, error) { var poolMember PoolMember err, ok := b.getForEntity(&poolMember, uriLtm, uriPool, pool, uriPoolMember, member) if err != nil { return nil, err } if !ok { return nil, nil } return &poolMember, nil }
go
func (b *BigIP) GetPoolMember(pool string, member string) (*PoolMember, error) { var poolMember PoolMember err, ok := b.getForEntity(&poolMember, uriLtm, uriPool, pool, uriPoolMember, member) if err != nil { return nil, err } if !ok { return nil, nil } return &poolMember, nil }
[ "func", "(", "b", "*", "BigIP", ")", "GetPoolMember", "(", "pool", "string", ",", "member", "string", ")", "(", "*", "PoolMember", ",", "error", ")", "{", "var", "poolMember", "PoolMember", "\n", "err", ",", "ok", ":=", "b", ".", "getForEntity", "(", ...
// GetPoolMember returns the details of a member in the specified pool.
[ "GetPoolMember", "returns", "the", "details", "of", "a", "member", "in", "the", "specified", "pool", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1639-L1651
17,499
scottdware/go-bigip
ltm.go
CreatePoolMember
func (b *BigIP) CreatePoolMember(pool string, config *PoolMember) error { return b.post(config, uriLtm, uriPool, pool, uriPoolMember) }
go
func (b *BigIP) CreatePoolMember(pool string, config *PoolMember) error { return b.post(config, uriLtm, uriPool, pool, uriPoolMember) }
[ "func", "(", "b", "*", "BigIP", ")", "CreatePoolMember", "(", "pool", "string", ",", "config", "*", "PoolMember", ")", "error", "{", "return", "b", ".", "post", "(", "config", ",", "uriLtm", ",", "uriPool", ",", "pool", ",", "uriPoolMember", ")", "\n",...
// CreatePoolMember creates a pool member for the specified pool.
[ "CreatePoolMember", "creates", "a", "pool", "member", "for", "the", "specified", "pool", "." ]
089ab35c13547ce4bcde55918adacdba00708753
https://github.com/scottdware/go-bigip/blob/089ab35c13547ce4bcde55918adacdba00708753/ltm.go#L1654-L1656