repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/issue23536.go
testdata/issue23536.go
package main // Test case where a slice of a user-defined byte type (not uint8 or byte) is // converted to a string. Same for slice of runes. type MyByte byte type MyRune rune func main() { var y = []MyByte("hello") if string(y) != "hello" { panic("BUG") } var z = []MyRune("world") if string(z) != "world" ...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/reflect.go
testdata/reflect.go
package main import "reflect" func main() { // Regression test for issue 9462. got := reflect.SliceOf(reflect.TypeOf(byte(0))).String() if got != "[]uint8" && got != "[]byte" { // result varies by toolchain println("BUG: " + got) } }
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/mrvchain.go
testdata/mrvchain.go
// Tests of call chaining f(g()) when g has multiple return values (MRVs). // See https://code.google.com/p/go/issues/detail?id=4573. package main func assert(actual, expected int) { if actual != expected { panic(actual) } } func g() (int, int) { return 5, 7 } func g2() (float64, float64) { return 5, 7 } fun...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/range.go
testdata/range.go
package main // Tests of range loops. import "fmt" // Range over string. func init() { if x := len("Hello, 世界"); x != 13 { // bytes panic(x) } var indices []int var runes []rune for i, r := range "Hello, 世界" { runes = append(runes, r) indices = append(indices, i) } if x := fmt.Sprint(runes); x != "[72 1...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/methprom.go
testdata/methprom.go
package main // Tests of method promotion logic. type A struct{ magic int } func (a A) x() { if a.magic != 1 { panic(a.magic) } } func (a *A) y() *A { return a } type B struct{ magic int } func (b B) p() { if b.magic != 2 { panic(b.magic) } } func (b *B) q() { if b != theC.B { panic("oops") } } type ...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/pkg/pkg.go
testdata/pkg/pkg.go
package pkg import ( "fmt" ) func Add(i, j int) int { return i + j } func Println(a ...interface{}) { fmt.Println(a...) } type App struct { init bool test bool } func (p *App) initApp() { p.init = true } func (p *App) initTest(b bool) { p.test = b } func (p *App) IsInit() bool { return p.init } func (p ...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/embed/embed.go
testdata/embed/embed.go
package main import ( "embed" "fmt" "reflect" ) //go:embed testdata/data1.txt var data1 string var ( //go:embed testdata/data2.txt data2 []byte //go:embed testdata/* fs embed.FS ) var ( //go:embed "testdata/data1.txt" helloT []T //go:embed "testdata/data1.txt" helloUint8 []uint8 //go:embed "testdata/dat...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/msg/tags.go
testdata/msg/tags.go
//go:build msg // +build msg package msg const Info = "msg"
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/msg/notags.go
testdata/msg/notags.go
//go:build !msg // +build !msg package msg const Info = "nomsg"
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/testdata/info/info.go
testdata/info/info.go
package info type Info interface { Mode() int SetMode(n int) Count(a ...int) int } type MyInfo struct { mode int } func (i MyInfo) Mode() int { return i.mode } func (i *MyInfo) SetMode(mode int) { i.mode = mode } func (i *MyInfo) Count(a ...int) int { return len(a) } func NewInfo(mode int) *MyInfo { retur...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/embed_go115.go
load/embed_go115.go
//go:build !go1.16 // +build !go1.16 /* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.a...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/linkname.go
load/linkname.go
/* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/path.go
load/path.go
/* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/list.go
load/list.go
/* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/embed_go116.go
load/embed_go116.go
//go:build go1.16 // +build go1.16 /* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apa...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/test.go
load/test.go
/* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/test_go118.go
load/test_go118.go
//go:build go1.18 // +build go1.18 /* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apa...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
goplus/ixgo
https://github.com/goplus/ixgo/blob/990754f385f758cd67723ed808786649fbd95c46/load/test_go117.go
load/test_go117.go
//go:build !go1.18 // +build !go1.18 /* * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.a...
go
Apache-2.0
990754f385f758cd67723ed808786649fbd95c46
2026-01-07T09:45:41.007918Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/main.go
main.go
/* Copyright 2021. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed un...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/mocks/argocd_client_mock.go
mocks/argocd_client_mock.go
package mocks import ( "context" "errors" "sync" applicationpkg "github.com/argoproj/argo-cd/pkg/apiclient/application" argov1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" "google.golang.org/grpc" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // ArgoCDAppClientStub is a general-purpose ...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/controllers/progressivesync_state.go
controllers/progressivesync_state.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/controllers/suite_test.go
controllers/suite_test.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/controllers/progressivesync_controller_test.go
controllers/progressivesync_controller_test.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/controllers/progressivesync_controller.go
controllers/progressivesync_controller.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/api/v1alpha1/progressivesync_types_test.go
api/v1alpha1/progressivesync_types_test.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/api/v1alpha1/zz_generated.deepcopy.go
api/v1alpha1/zz_generated.deepcopy.go
//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 U...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/api/v1alpha1/groupversion_info.go
api/v1alpha1/groupversion_info.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/api/v1alpha1/progressivesync_types.go
api/v1alpha1/progressivesync_types.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/api/v1alpha1/condition_types.go
api/v1alpha1/condition_types.go
/* Copyright 2021 Skyscanner Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/internal/consts/consts.go
internal/consts/consts.go
package consts const ( ArgoCDSecretTypeLabel = "argocd.argoproj.io/secret-type" ArgoCDSecretTypeCluster = "cluster" AppSetKind = "ApplicationSet" AppSetAPIVersion = "argoproj.io/v1alpha1" ArgoCDAuthTokenKey = "ARGOCD_AUTH_TOKEN" ArgoCDInsecureKey = "ARGOCD_INSECURE" ArgoCDPlaint...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/internal/utils/utils.go
internal/utils/utils.go
package utils import ( "fmt" "hash/fnv" "sort" "strings" "github.com/Skyscanner/applicationset-progressive-sync/internal/consts" argov1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" "github.com/argoproj/gitops-engine/pkg/health" "github.com/davecgh/go-spew/spew" corev1 "k8s.io/api/core/v1...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/internal/utils/config.go
internal/utils/config.go
package utils import ( "io/ioutil" "os" "strconv" "github.com/Skyscanner/applicationset-progressive-sync/internal/consts" ) // Configuration holds the configuration to connect to the Argo CD server type Configuration struct { ArgoCDAuthToken string ArgoCDServerAddr string ArgoCDInsecure bool ArgoCDPlainte...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/internal/utils/argocd_client.go
internal/utils/argocd_client.go
package utils import ( "context" argocdclient "github.com/argoproj/argo-cd/pkg/apiclient" applicationpkg "github.com/argoproj/argo-cd/pkg/apiclient/application" "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" "google.golang.org/grpc" ) type ArgoCDAppClient interface { Sync(ctx context.Context, in *a...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
Skyscanner/applicationset-progressive-sync
https://github.com/Skyscanner/applicationset-progressive-sync/blob/e50337c0f92bb2900cc932f41a8f6a7f84def579/internal/utils/utils_test.go
internal/utils/utils_test.go
package utils import ( "testing" "github.com/Skyscanner/applicationset-progressive-sync/internal/consts" applicationset "github.com/argoproj-labs/applicationset/api/v1alpha1" argov1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "...
go
Apache-2.0
e50337c0f92bb2900cc932f41a8f6a7f84def579
2026-01-07T09:45:43.692800Z
false
ahmetb/kubectl-cond
https://github.com/ahmetb/kubectl-cond/blob/ee549df3064b1ea3b0859b2a33f66a786fca88c5/main.go
main.go
// Copyright 2024 Ahmet Alp Balkan // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
go
Apache-2.0
ee549df3064b1ea3b0859b2a33f66a786fca88c5
2026-01-07T09:45:43.911684Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/cmd/protoplex/protoplex.go
cmd/protoplex/protoplex.go
package main import ( "fmt" "os" "github.com/Pandentia/protoplex/protoplex" "github.com/Pandentia/protoplex/protoplex/protocols" "github.com/rs/zerolog" "gopkg.in/alecthomas/kingpin.v2" ) var version string func printVersion() { if version == "" { fmt.Println("Version has not been set.") os.Exit(1) ret...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/multiplexer.go
protoplex/multiplexer.go
package protoplex import ( "bytes" "net" "os" "time" "github.com/rs/zerolog" "github.com/Pandentia/protoplex/protoplex/protocols" ) // RunServer runs protoplex func RunServer(bind string, p []*protocols.Protocol, logger zerolog.Logger) { logger = logger.With().Str("module", "listener").Logger() if len(p) =...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/proxy.go
protoplex/proxy.go
package protoplex import ( "net" ) func proxy(from net.Conn, to net.Conn, closed chan bool) { data := make([]byte, 4096) // 4KiB buffer for { n, err := from.Read(data) if err != nil { closed <- true return } _, err = to.Write(data[:n]) if err != nil { closed <- true return } } }
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/socks4.go
protoplex/protocols/socks4.go
package protocols // NewSOCKS4Protocol initializes a Protocol with a SOCKS4 signature. func NewSOCKS4Protocol(targetAddress string) *Protocol { return &Protocol{ Name: "SOCKS4", Target: targetAddress, MatchStartBytes: [][]byte{{0x04}}, } }
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/ssh.go
protoplex/protocols/ssh.go
package protocols // NewSSHProtocol initializes a Protocol with a SSH signature. func NewSSHProtocol(targetAddress string) *Protocol { return &Protocol{ Name: "SSH", Target: targetAddress, MatchStartBytes: [][]byte{{'S', 'S', 'H', '-'}}, } }
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/protocol.go
protoplex/protocols/protocol.go
package protocols import "regexp" // Protocol is the implementation of a protocol signature. type Protocol struct { Name string // the protocol name for auditing Target string // the proxy target MatchStartBytes [][]byte // the bytestrings by ...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/syncthing-relay.go
protoplex/protocols/syncthing-relay.go
package protocols // NewSTRelayProtocol initializes a Protocol with a Syncthing Relay signature. // // Deprecated: This signature does not function properly and unless further developed, will not establish a working // connection. func NewSTRelayProtocol(targetAddress string) *Protocol { return &Protocol{ Name: "...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/http.go
protoplex/protocols/http.go
package protocols import "regexp" // NewHTTPProtocol initializes a Protocol with a HTTP signature. func NewHTTPProtocol(targetAddress string) *Protocol { regexes := []*regexp.Regexp{ regexp.MustCompile("^[A-Z]+ .+ HTTP/"), } return &Protocol{ Name: "HTTP", Target: targetA...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/openvpn.go
protoplex/protocols/openvpn.go
package protocols import "regexp" // NewOpenVPNProtocol initializes a Protocol with an OpenVPN signature. func NewOpenVPNProtocol(targetAddress string) *Protocol { return &Protocol{ Name: "OpenVPN", Target: targetAddress, // MatchStartBytes: [][]byte{{0x00, 0x0e, 0x38}}, MatchRegexes: []*regexp.Regexp{ ...
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/socks5.go
protoplex/protocols/socks5.go
package protocols // NewSOCKS5Protocol initializes a Protocol with a SOCKS5 signature. func NewSOCKS5Protocol(targetAddress string) *Protocol { return &Protocol{ Name: "SOCKS5", Target: targetAddress, MatchStartBytes: [][]byte{{0x05}}, } }
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
SapphicCode/protoplex
https://github.com/SapphicCode/protoplex/blob/ca5bb620f5041084dcd08ed50bb517ef85f9edbd/protoplex/protocols/tls.go
protoplex/protocols/tls.go
package protocols // NewTLSProtocol initializes a Protocol with a TLS signature. func NewTLSProtocol(targetAddress string) *Protocol { return &Protocol{ Name: "TLS", Target: targetAddress, MatchStartBytes: [][]byte{{0x16, 0x03, 0x01}}, } }
go
MIT
ca5bb620f5041084dcd08ed50bb517ef85f9edbd
2026-01-07T09:45:44.706609Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/queue_test.go
queue_test.go
package css import "testing" func TestQueue(t *testing.T) { t1 := token{tokenDelim, "*", "*", 0, 0, ""} t2 := token{tokenIdent, "foo", "foo", 0, 0, ""} t3 := token{tokenIdent, "bar", "bar", 0, 0, ""} t4 := token{tokenIdent, "spam", "spam", 0, 0, ""} _, _ = t3, t4 q := newQueue(2) q.push(t1) if got := q.get(...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/fuzz_test.go
fuzz_test.go
package css import ( "strings" "testing" "golang.org/x/net/html" ) func FuzzParse(f *testing.F) { corpus := []string{ "*", "a", "ns|a", ".red", "#demo", "[attr]", "[attr=value]", "[herf~=foo]", "[herf|=foo]", "[herf^=foo]", "[herf$=foo]", "[herf*=foo]", "[herf=foo i]", "h1 a", "h1, ...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/lex_test.go
lex_test.go
package css import ( "reflect" "testing" ) func tok(typ tokenType, s ...string) token { switch len(s) { case 1: return token{typ: typ, raw: s[0], s: s[0]} case 2: return token{typ: typ, raw: s[0], s: s[1]} } panic("invalid number of arguments") } func TestLexer(t *testing.T) { tests := []struct { s ...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/lex.go
lex.go
package css import ( "fmt" "strconv" "strings" "unicode/utf8" ) // lexer implements tokenization for CSS selectors. The algorithm follows the // spec recommentations. // // https://www.w3.org/TR/css-syntax-3/#tokenization type lexer struct { s string last int pos int } func newLexer(s string) *lexer { re...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/css.go
css.go
// Package css implements CSS selector HTML search. // // Selectors compiled by this package search through golang.org/x/net/html nodes and should // be used in conjunction with that package. // // data := `<p> // <h2 id="foo">a header</h2> // <h2 id="bar">another header</h2> // </p>` // // sel, err := css.Parse("h2#...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/css_test.go
css_test.go
package css import ( "bytes" "errors" "fmt" "reflect" "strings" "testing" "github.com/google/go-cmp/cmp" "golang.org/x/net/html" ) func (s *Selector) String() string { var b strings.Builder formatValue(reflect.ValueOf(s), &b, "") return b.String() } func formatValue(v reflect.Value, b *strings.Builder, i...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/parse_test.go
parse_test.go
package css import ( "errors" "reflect" "testing" "github.com/google/go-cmp/cmp" ) func cmpDiff(x, y interface{}) string { return cmp.Diff(x, y, cmp.AllowUnexported( attributeSelector{}, complexSelector{}, compoundSelector{}, pseudoClassSelector{}, pseudoSelector{}, subclassSelector{}, token{}, ...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/parse.go
parse.go
package css import ( "fmt" "strconv" "strings" ) type parseErr struct { msg string t token } func (p *parseErr) Error() string { return fmt.Sprintf("consuming %s: %s", p.t, p.msg) } type parser struct { l interface { next() (token, error) } // peekQueue holds tokens that have been peeked but not consum...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
ericchiang/css
https://github.com/ericchiang/css/blob/8db8860a48d3371f8c2a0182248b78062b29e49d/queue.go
queue.go
package css // queue is a ring buffer implementation of a fixed size queue. // // This is an internal implementation aimed at queueing peeks into the token // stream. Method intentionally panic when misused. type queue struct { vals []token start int n int } // newQueue creates a queue with a max of size elem...
go
MIT
8db8860a48d3371f8c2a0182248b78062b29e49d
2026-01-07T09:45:44.759531Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign.go
sign.go
package main import ( "fmt" "os" "github.com/digitorus/pdfsign/cli" ) func main() { if len(os.Args) < 2 { cli.Usage() } switch os.Args[1] { case "sign": cli.SignCommand() case "verify": cli.VerifyCommand() case "-h", "--help", "help": cli.Usage() default: fmt.Fprintf(os.Stderr, "Unknown command:...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/document.go
verify/document.go
package verify import ( "reflect" "strconv" "strings" "time" "github.com/digitorus/pdf" ) // parseDocumentInfo parses document information from PDF Info dictionary. func parseDocumentInfo(v pdf.Value, documentInfo *DocumentInfo) { keys := []string{ "Author", "CreationDate", "Creator", "Hash", "Keywords", "Mo...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/verify.go
verify/verify.go
package verify import ( "crypto/x509" "fmt" "io" "os" "time" "github.com/digitorus/pdf" ) // DefaultVerifyOptions returns the default verification options following RFC 9336 func DefaultVerifyOptions() *VerifyOptions { return &VerifyOptions{ RequiredEKUs: []x509.ExtKeyUsage{ // Document Signing EKU per R...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/signature_unit_test.go
verify/signature_unit_test.go
package verify import ( "errors" "io" "testing" ) // --- Local mock for pdf.Value --- type mockPDFValue struct { fields map[string]*mockPDFValue array []*mockPDFValue str string intVal int64 isNull bool } func (m *mockPDFValue) Key(key string) *mockPDFValue { if m.fields == nil { return &mockPDFValue{...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/external_revocation.go
verify/external_revocation.go
package verify import ( "bytes" "crypto/x509" "fmt" "io" "net/http" "time" "golang.org/x/crypto/ocsp" ) // OCSPRequestFunc allows mocking OCSP request creation for tests type OCSPRequestFunc func(cert, issuer *x509.Certificate) ([]byte, error) // performExternalOCSPCheck performs an external OCSP check for t...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/external_revocation_test.go
verify/external_revocation_test.go
package verify import ( "crypto/x509" "math/big" "net/http" "net/http/httptest" "testing" "time" ) func TestPerformExternalOCSPCheck(t *testing.T) { // Create a test certificate with OCSP server cert := &x509.Certificate{ SerialNumber: big.NewInt(12345), OCSPServer: []string{}, // Will be set by individ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/types.go
verify/types.go
package verify // This file contains type definitions used across the verify package. // Types are defined in verify.go to maintain backward compatibility. import ( "crypto/x509" "net/http" "time" "github.com/digitorus/timestamp" "golang.org/x/crypto/ocsp" ) // VerifyOptions contains options for PDF signature ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/keyusage.go
verify/keyusage.go
package verify import ( "crypto/x509" ) // validateKeyUsage validates certificate Key Usage and Extended Key Usage for PDF signing // according to RFC 9336 and common industry practices func validateKeyUsage(cert *x509.Certificate, options *VerifyOptions) (kuValid bool, kuError string, ekuValid bool, ekuError string...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/verify_test.go
verify/verify_test.go
package verify import ( "os" "path/filepath" "testing" ) func TestFile(t *testing.T) { testFilePath := filepath.Join("..", "testfiles", "testfile30.pdf") // Check if test file exists if _, err := os.Stat(testFilePath); os.IsNotExist(err) { t.Skipf("Test file %s does not exist", testFilePath) } // Open the...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/utils_test.go
verify/utils_test.go
package verify import ( "testing" "time" ) func TestParseDate(t *testing.T) { tests := []struct { input string expected bool // whether parsing should succeed name string }{ { input: "D:20240101120000+01'00'", expected: true, name: "date with positive timezone offset", }, { i...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/certificate.go
verify/certificate.go
package verify import ( "crypto/x509" "fmt" "time" "github.com/digitorus/pdfsign/revocation" "github.com/digitorus/pkcs7" "github.com/digitorus/timestamp" "golang.org/x/crypto/ocsp" ) // buildCertificateChainsWithOptions builds certificate chains with custom verification options func buildCertificateChainsWit...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/keyusage_test.go
verify/keyusage_test.go
package verify import ( "crypto/x509" "testing" "time" "github.com/digitorus/timestamp" ) func TestValidateKeyUsage(t *testing.T) { tests := []struct { name string keyUsage x509.KeyUsage extKeyUsage []x509.ExtKeyUsage options *VerifyOptions expectKU bool expectEKU bool kuError ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/revocation_timing_test.go
verify/revocation_timing_test.go
package verify import ( "crypto/x509" "testing" "time" "github.com/digitorus/timestamp" "golang.org/x/crypto/ocsp" ) func TestIsRevokedBeforeSigning(t *testing.T) { // Test times signingTime := time.Date(2024, 1, 15, 12, 0, 0, 0, time.UTC) revocationBefore := time.Date(2024, 1, 10, 12, 0, 0, 0, time.UTC) // ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/document_test.go
verify/document_test.go
package verify import ( "os" "path/filepath" "testing" ) func TestDocumentInfoParsing(t *testing.T) { testFilePath := filepath.Join("..", "testfiles", "testfile30.pdf") if _, err := os.Stat(testFilePath); os.IsNotExist(err) { t.Skipf("Test file %s does not exist", testFilePath) } file, err := os.Open(testFil...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/verify/signature.go
verify/signature.go
package verify import ( "bytes" "crypto/x509" "encoding/asn1" "fmt" "io" "github.com/digitorus/pdf" "github.com/digitorus/pdfsign/revocation" "github.com/digitorus/pkcs7" "github.com/digitorus/timestamp" ) // processSignature processes a single digital signature found in the PDF. func processSignature(v pdf...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfcatalog.go
sign/pdfcatalog.go
package sign import ( "bytes" "fmt" "io" "strconv" "github.com/digitorus/pdf" ) func (context *SignContext) createCatalog() ([]byte, error) { var catalog_buffer bytes.Buffer // Start the catalog object catalog_buffer.WriteString("<<\n") catalog_buffer.WriteString(" /Type /Catalog\n") // (Optional; PDF 1...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdftrailer.go
sign/pdftrailer.go
package sign import ( "strconv" "strings" ) func (context *SignContext) writeTrailer() error { switch context.PDFReader.XrefInformation.Type { case "table": trailer_length := context.PDFReader.XrefInformation.IncludingTrailerEndPos - context.PDFReader.XrefInformation.EndPos // Read the trailer so we can repl...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfsignature.go
sign/pdfsignature.go
package sign import ( "bytes" "crypto" "crypto/x509" "encoding/asn1" "encoding/hex" "errors" "fmt" "io" "log" "net/http" "strconv" "github.com/digitorus/pkcs7" "github.com/digitorus/timestamp" "golang.org/x/crypto/cryptobyte" cryptobyte_asn1 "golang.org/x/crypto/cryptobyte/asn1" ) const signatureByteR...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/types.go
sign/types.go
package sign import ( "crypto" "crypto/x509" "io" "time" "github.com/digitorus/pdf" "github.com/digitorus/pdfsign/revocation" "github.com/mattetti/filebuffer" ) type CatalogData struct { ObjectId uint32 RootString string } type TSA struct { URL string Username string Password string } type Revoc...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/revocation_test.go
sign/revocation_test.go
//go:build certificateExpired // +build certificateExpired // TODO: Rework tests, these currently fail because of expired certificate package sign import ( "crypto/x509" "encoding/pem" "testing" "github.com/digitorus/pdfsign/revocation" ) const certPem = `-----BEGIN CERTIFICATE----- MIIGKDCCBRCgAwIBAgIMW8J4m7hu...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/sign.go
sign/sign.go
package sign import ( "crypto" "crypto/x509" "encoding/hex" "fmt" "io" "os" "github.com/digitorus/pdf" "github.com/digitorus/pkcs7" "github.com/mattetti/filebuffer" ) func SignFile(input string, output string, sign_data SignData) error { input_file, err := os.Open(input) if err != nil { return err } ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/helpers_test.go
sign/helpers_test.go
package sign import ( "bufio" "bytes" "os" "testing" "time" "github.com/digitorus/pdf" ) func TestFindFirstPage(t *testing.T) { input_file, reader := loadHelpersTestPDF() if input_file == nil || reader == nil { t.Errorf("Failed to load test PDF") return } root := reader.Trailer().Key("Root") root_key...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfbyterange.go
sign/pdfbyterange.go
package sign import ( "bytes" "fmt" "strings" ) func (context *SignContext) updateByteRange() error { if _, err := context.OutputBuffer.Seek(0, 0); err != nil { return err } // Set ByteRangeValues by looking for the /Contents< filled with zeros contentsPlaceholder := bytes.Repeat([]byte("0"), int(context.Si...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfsignature_test.go
sign/pdfsignature_test.go
package sign import ( "fmt" "os" "testing" "time" "github.com/digitorus/pdf" ) var signatureTests = []struct { file string expectedSignatures map[CertType]string }{ { file: "../testfiles/testfile20.pdf", expectedSignatures: map[CertType]string{ CertificationSignature: "<<\n /Type /Sig\n ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref.go
sign/pdfxref.go
package sign import ( "bytes" "fmt" ) type xrefEntry struct { ID uint32 Offset int64 Generation int Free bool } const ( objectFooter = "\nendobj\n" ) func (context *SignContext) getNextObjectID() uint32 { if context.lastXrefID == 0 { lastXrefID, err := context.getLastObjectIDFromXref() ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref_test.go
sign/pdfxref_test.go
package sign import ( "bytes" "os" "strings" "testing" "github.com/digitorus/pdf" "github.com/mattetti/filebuffer" ) func TestGetLastObjectIDFromXref(t *testing.T) { testCases := []struct { fileName string expected uint32 }{ {"testfile12.pdf", 16}, {"testfile14.pdf", 15}, {"testfile16.pdf", 567}, ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/revocation.go
sign/revocation.go
package sign import ( "crypto/x509" "encoding/base64" "fmt" "io" "net/http" "strings" "github.com/digitorus/pdfsign/revocation" "golang.org/x/crypto/ocsp" ) func embedOCSPRevocationStatus(cert, issuer *x509.Certificate, i *revocation.InfoArchival) error { req, err := ocsp.CreateRequest(cert, issuer, nil) i...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfvisualsignature_test.go
sign/pdfvisualsignature_test.go
package sign import ( "os" "testing" "time" "github.com/digitorus/pdf" ) func TestVisualSignature(t *testing.T) { input_file, err := os.Open("../testfiles/testfile20.pdf") if err != nil { t.Errorf("Failed to load test PDF") return } finfo, err := input_file.Stat() if err != nil { t.Errorf("Failed to ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfcatalog_test.go
sign/pdfcatalog_test.go
package sign import ( "fmt" "os" "testing" "github.com/digitorus/pdf" ) var testFiles = []struct { file string expectedCatalogs map[CertType]string }{ { file: "../testfiles/testfile20.pdf", expectedCatalogs: map[CertType]string{ CertificationSignature: "<<\n /Type /Catalog\n /Metadata 2 0...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref_stream_test.go
sign/pdfxref_stream_test.go
package sign import ( "bytes" "compress/zlib" "io" "os" "strings" "testing" "github.com/digitorus/pdf" "github.com/mattetti/filebuffer" ) func TestWriteXrefStreamLine(t *testing.T) { tests := []struct { name string xreftype byte offset int gen byte expected []byte }{ { name: "...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref_table_test.go
sign/pdfxref_table_test.go
package sign import ( "bytes" "testing" "github.com/mattetti/filebuffer" ) func TestWriteIncrXrefTable(t *testing.T) { // Test setup context := &SignContext{ OutputBuffer: &filebuffer.Buffer{ Buff: new(bytes.Buffer), }, lastXrefID: 100, updatedXrefEntries: []xrefEntry{ {ID: 50, Offset: 1234}, {...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref_table.go
sign/pdfxref_table.go
package sign import ( "fmt" ) // writeIncrXrefTable writes the incremental cross-reference table to the output buffer. func (context *SignContext) writeIncrXrefTable() error { // Write xref header if _, err := context.OutputBuffer.Write([]byte("xref\n")); err != nil { return fmt.Errorf("failed to write increment...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfvisualsignature.go
sign/pdfvisualsignature.go
package sign import ( "bytes" "fmt" "strconv" "github.com/digitorus/pdf" ) // Define annotation flag constants. const ( AnnotationFlagInvisible = 1 << 0 AnnotationFlagHidden = 1 << 1 AnnotationFlagPrint = 1 << 2 AnnotationFlagNoZoom = 1 << 3 AnnotationFlagNoRotate = 1 << ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/sign_test.go
sign/sign_test.go
package sign import ( "crypto" "crypto/rsa" "crypto/x509" "encoding/pem" "fmt" "io" "os" "path/filepath" "testing" "time" "github.com/digitorus/pdf" "github.com/digitorus/pdfsign/revocation" "github.com/digitorus/pdfsign/verify" "github.com/mattetti/filebuffer" ) const signCertPem = `-----BEGIN CERTIFI...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/certtype_string.go
sign/certtype_string.go
// Code generated by "stringer -type=CertType"; DO NOT EDIT. package sign import "strconv" func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[CertificationSignature-1] _ = x[Approva...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/docmdpperm_string.go
sign/docmdpperm_string.go
// Code generated by "stringer -type=DocMDPPerm"; DO NOT EDIT. package sign import "strconv" func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[DoNotAllowAnyChangesPerms-1] _ = x[Al...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/pdfxref_stream.go
sign/pdfxref_stream.go
package sign import ( "bytes" "compress/zlib" "encoding/binary" "encoding/hex" "errors" "fmt" "io" ) const ( xrefStreamColumns = 6 // Column width (1+4+1) xrefStreamPredictor = 12 defaultPredictor = 1 // No prediction (the default value) pngSubPredictor = 11 // PNG prediction (on encoding, PNG Su...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/helpers.go
sign/helpers.go
package sign import ( "crypto" "encoding/asn1" "errors" "fmt" "io" "math" "strings" "time" "github.com/digitorus/pdf" "golang.org/x/text/encoding/unicode" "golang.org/x/text/transform" ) func findFirstPage(parent pdf.Value) (pdf.Value, error) { value_type := parent.Key("Type").String() if value_type == ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/sign/appearance.go
sign/appearance.go
package sign import ( "bytes" "compress/zlib" "fmt" "image" _ "image/jpeg" // register JPEG format _ "image/png" // register PNG format ) // Helper functions for PDF resource components // writeAppearanceHeader writes the header for the appearance stream. // // Should be closed by writeFormTypeAndLength. func...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/revocation/revocation.go
revocation/revocation.go
package revocation import ( "crypto/x509" "encoding/asn1" ) // InfoArchival is the pkcs7 container containing the revocation information for // all embedded certificates. // // Currently the internal structure is exposed but I don't like to expose the // asn1.RawValue objects. We can probably make them private and ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/cli/commands.go
cli/commands.go
package cli import ( "fmt" "os" ) func Usage() { fmt.Printf("Usage: %s <command> [options] <args>\n\n", os.Args[0]) fmt.Println("Commands:") fmt.Println(" sign Sign a PDF file") fmt.Println(" verify Verify a PDF signature") fmt.Println("") fmt.Printf("Use '%s <command> -h' for command-specific help\n", ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/cli/verify.go
cli/verify.go
package cli import ( "encoding/json" "flag" "fmt" "log" "os" "time" "github.com/digitorus/pdfsign/verify" ) func VerifyCommand() { verifyFlags := flag.NewFlagSet("verify", flag.ExitOnError) var enableExternalRevocation bool var requireDigitalSignatureKU bool var requireNonRepudiation bool var trustSigna...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/cli/cli_test.go
cli/cli_test.go
package cli import ( "os" "testing" "github.com/digitorus/pdfsign/sign" ) func TestParseCertType(t *testing.T) { tests := []struct { name string input string expected sign.CertType wantErr bool }{ {"Valid CertificationSignature", "CertificationSignature", sign.CertificationSignature, false}, ...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/cli/sign.go
cli/sign.go
package cli import ( "crypto" "crypto/x509" "encoding/pem" "errors" "flag" "fmt" "log" "os" "time" "github.com/digitorus/pdfsign/sign" ) var ( InfoName, InfoLocation, InfoReason, InfoContact, TSA string CertType string ) func ParseCertType(s string) (sign.Cert...
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false
digitorus/pdfsign
https://github.com/digitorus/pdfsign/blob/a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8/cli/exit.go
cli/exit.go
package cli import "os" // Patchable os.Exit for testing var osExit = os.Exit
go
BSD-2-Clause
a2800162ff5c30f83eef4fad0a6b35ae3deb1fe8
2026-01-07T09:45:42.848014Z
false