forked from Silverfish/proton-bridge
Other: Add v2 to module name
This commit is contained in:
@ -97,7 +97,7 @@ func newTestDir(t *testing.T, subdirs ...string) string {
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, target := range subdirs {
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(dir, target), 0700))
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(dir, target), 0o700))
|
||||
}
|
||||
|
||||
return dir
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||
"github.com/docker/docker-credential-helpers/credentials"
|
||||
)
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pool"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pool"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/emersion/go-textwrapper"
|
||||
)
|
||||
|
||||
@ -27,9 +27,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/message/mocks"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/message/parser"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/message/mocks"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/message/parser"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -28,7 +28,7 @@ import (
|
||||
|
||||
"github.com/ProtonMail/go-rfc5322"
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/emersion/go-message/textproto"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/constants"
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-message"
|
||||
)
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/message/mocks"
|
||||
tests "github.com/ProtonMail/proton-bridge/test"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/message/mocks"
|
||||
tests "github.com/ProtonMail/proton-bridge/v2/test"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -27,7 +27,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
"github.com/emersion/go-message/textproto"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -22,7 +22,7 @@ import (
|
||||
"net/textproto"
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-imap"
|
||||
)
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-imap"
|
||||
)
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ package message
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/go-rfc5322"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
)
|
||||
|
||||
func init() { //nolint:gochecknoinits
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/ProtonMail/proton-bridge/pkg/message (interfaces: Fetcher)
|
||||
// Source: github.com/ProtonMail/proton-bridge/v2/pkg/message (interfaces: Fetcher)
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
@ -10,7 +10,7 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
crypto "github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/go-rfc5322"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/message/parser"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/message/parser"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/jaytaylor/html2text"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
@ -36,7 +36,6 @@ func newTestParser(t *testing.T, msg string) *Parser {
|
||||
|
||||
func getFileReader(filename string) io.ReadCloser {
|
||||
f, err := os.Open(filepath.Join("testdata", filename))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
"mime"
|
||||
"unicode/utf8"
|
||||
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
func TestEndOfMailTrimmer(t *testing.T) {
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
in string
|
||||
out string
|
||||
}{
|
||||
|
||||
@ -25,7 +25,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/pkg/message/parser"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/message/parser"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/text/encoding/charmap"
|
||||
@ -604,7 +604,6 @@ func getFileReader(filename string) io.Reader {
|
||||
|
||||
func readerToString(r io.Reader) string {
|
||||
b, err := ioutil.ReadAll(r)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
"github.com/emersion/go-imap"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/vmihailenco/msgpack/v5"
|
||||
|
||||
@ -341,7 +341,8 @@ var testPaths = []struct {
|
||||
path []int
|
||||
expectedSection, expectedBody string
|
||||
}{
|
||||
{[]int{},
|
||||
{
|
||||
[]int{},
|
||||
sampleMail,
|
||||
`main summary
|
||||
|
||||
@ -434,7 +435,8 @@ Content-Type: text/html
|
||||
`,
|
||||
},
|
||||
|
||||
{[]int{1},
|
||||
{
|
||||
[]int{1},
|
||||
`Content-Type: text/plain
|
||||
|
||||
1. main message
|
||||
@ -446,7 +448,8 @@ Content-Type: text/html
|
||||
|
||||
`,
|
||||
},
|
||||
{[]int{3},
|
||||
{
|
||||
[]int{3},
|
||||
`Subject: Inside mail 3
|
||||
From: Mary Smith <mary@example.net>
|
||||
To: John Doe <jdoe@machine.example>
|
||||
@ -488,7 +491,8 @@ Content-Transfer-Encoding: base64
|
||||
|
||||
`,
|
||||
},
|
||||
{[]int{3, 1},
|
||||
{
|
||||
[]int{3, 1},
|
||||
`Content-Type: text/plain
|
||||
|
||||
3.1 message text
|
||||
@ -498,7 +502,8 @@ Content-Transfer-Encoding: base64
|
||||
|
||||
`,
|
||||
},
|
||||
{[]int{3, 2},
|
||||
{
|
||||
[]int{3, 2},
|
||||
`Content-Type: application/octet-stream
|
||||
Content-Disposition: attachment; filename="msg_3_signature.sig"
|
||||
Content-Transfer-Encoding: base64
|
||||
@ -510,7 +515,8 @@ Content-Transfer-Encoding: base64
|
||||
|
||||
`,
|
||||
},
|
||||
{[]int{4, 2, 2, 1},
|
||||
{
|
||||
[]int{4, 2, 2, 1},
|
||||
`Content-Type: text/plain
|
||||
|
||||
4.2.2.1 plain text
|
||||
@ -520,7 +526,8 @@ Content-Transfer-Encoding: base64
|
||||
|
||||
`,
|
||||
},
|
||||
{[]int{4, 2, 2, 2},
|
||||
{
|
||||
[]int{4, 2, 2, 2},
|
||||
`Content-Type: text/html
|
||||
|
||||
<h1>4.2.2.2 html text</h1>
|
||||
|
||||
@ -126,21 +126,21 @@ func TestGetEncoding(t *testing.T) {
|
||||
// All MIME charsets with aliases can be found here:
|
||||
// https://www.iana.org/assignments/character-sets/character-sets.xhtml
|
||||
mimesets := map[string][]string{
|
||||
"utf-8": []string{ // MIB 16
|
||||
"utf-8": { // MIB 16
|
||||
"utf8",
|
||||
"csutf8",
|
||||
"unicode-1-1-utf-8",
|
||||
"iso-utf-8",
|
||||
"utf8mb4",
|
||||
},
|
||||
"gbk": []string{
|
||||
"gbk": {
|
||||
"gb2312", // MIB 2025
|
||||
//"euc-cn": []string{
|
||||
"euccn",
|
||||
"ibm-euccn",
|
||||
},
|
||||
//"utf7": []string{"utf-7", "unicode-1-1-utf-7"},
|
||||
"iso-8859-2": []string{ // MIB 5
|
||||
"iso-8859-2": { // MIB 5
|
||||
"iso-ir-101",
|
||||
"iso_8859-2",
|
||||
"iso8859-2",
|
||||
@ -150,27 +150,27 @@ func TestGetEncoding(t *testing.T) {
|
||||
"ibm852",
|
||||
//"FAILEDibm852",
|
||||
},
|
||||
"iso-8859-3": []string{ // MIB 6
|
||||
"iso-8859-3": { // MIB 6
|
||||
"iso-ir-109",
|
||||
"iso_8859-3",
|
||||
"latin3",
|
||||
"l3",
|
||||
"csisolatin3",
|
||||
},
|
||||
"iso-8859-4": []string{ // MIB 7
|
||||
"iso-8859-4": { // MIB 7
|
||||
"iso-ir-110",
|
||||
"iso_8859-4",
|
||||
"latin4",
|
||||
"l4",
|
||||
"csisolatin4",
|
||||
},
|
||||
"iso-8859-5": []string{ // MIB 8
|
||||
"iso-8859-5": { // MIB 8
|
||||
"iso-ir-144",
|
||||
"iso_8859-5",
|
||||
"cyrillic",
|
||||
"csisolatincyrillic",
|
||||
},
|
||||
"iso-8859-6": []string{ // MIB 9
|
||||
"iso-8859-6": { // MIB 9
|
||||
"iso-ir-127",
|
||||
"iso_8859-6",
|
||||
"ecma-114",
|
||||
@ -182,16 +182,18 @@ func TestGetEncoding(t *testing.T) {
|
||||
"iso-8859-6-e",
|
||||
//"iso-8859-6i": []string{ // MIB 82
|
||||
"csiso88596i",
|
||||
"iso-8859-6-i"},
|
||||
"iso-8859-7": []string{ // MIB 10
|
||||
"iso-8859-6-i",
|
||||
},
|
||||
"iso-8859-7": { // MIB 10
|
||||
"iso-ir-126",
|
||||
"iso_8859-7",
|
||||
"elot_928",
|
||||
"ecma-118",
|
||||
"greek",
|
||||
"greek8",
|
||||
"csisolatingreek"},
|
||||
"iso-8859-8": []string{ // MIB 11
|
||||
"csisolatingreek",
|
||||
},
|
||||
"iso-8859-8": { // MIB 11
|
||||
"iso-ir-138",
|
||||
"iso_8859-8",
|
||||
"hebrew",
|
||||
@ -200,33 +202,36 @@ func TestGetEncoding(t *testing.T) {
|
||||
"csiso88598e",
|
||||
"iso-8859-8-e",
|
||||
},
|
||||
"iso-8859-8-i": []string{ // MIB 85
|
||||
"iso-8859-8-i": { // MIB 85
|
||||
"logical",
|
||||
"csiso88598i",
|
||||
"iso-8859-8-i", // Hebrew, the "i" means right-to-left, probably unnecessary with ISO cleaning above.
|
||||
},
|
||||
"iso-8859-10": []string{ // MIB 13
|
||||
"iso-8859-10": { // MIB 13
|
||||
"iso-ir-157",
|
||||
"l6",
|
||||
"iso_8859-10:1992",
|
||||
"csisolatin6",
|
||||
"latin6"},
|
||||
"iso-8859-13": []string{ // MIB 109
|
||||
"latin6",
|
||||
},
|
||||
"iso-8859-13": { // MIB 109
|
||||
"csiso885913"},
|
||||
"iso-8859-14": []string{ // MIB 110
|
||||
"iso-8859-14": { // MIB 110
|
||||
"iso-ir-199",
|
||||
"iso_8859-14:1998",
|
||||
"iso_8859-14",
|
||||
"latin8",
|
||||
"iso-celtic",
|
||||
"l8",
|
||||
"csiso885914"},
|
||||
"iso-8859-15": []string{ // MIB 111
|
||||
"csiso885914",
|
||||
},
|
||||
"iso-8859-15": { // MIB 111
|
||||
"iso_8859-15",
|
||||
"latin-9",
|
||||
"csiso885915",
|
||||
"ISO8859-15"},
|
||||
"iso-8859-16": []string{ // MIB 112
|
||||
"ISO8859-15",
|
||||
},
|
||||
"iso-8859-16": { // MIB 112
|
||||
"iso-ir-226",
|
||||
"iso_8859-16:2001",
|
||||
"iso_8859-16",
|
||||
@ -234,21 +239,21 @@ func TestGetEncoding(t *testing.T) {
|
||||
"l10",
|
||||
"csiso885916",
|
||||
},
|
||||
"windows-874": []string{ // MIB 2109
|
||||
"windows-874": { // MIB 2109
|
||||
"cswindows874",
|
||||
"cp874",
|
||||
"iso-8859-11",
|
||||
"tis-620",
|
||||
},
|
||||
"windows-1250": []string{ // MIB 2250
|
||||
"windows-1250": { // MIB 2250
|
||||
"cswindows1250",
|
||||
"cp1250",
|
||||
},
|
||||
"windows-1251": []string{ // MIB 2251
|
||||
"windows-1251": { // MIB 2251
|
||||
"cswindows1251",
|
||||
"cp1251",
|
||||
},
|
||||
"windows-1252": []string{ // MIB 2252
|
||||
"windows-1252": { // MIB 2252
|
||||
"cswindows1252",
|
||||
"cp1252",
|
||||
"3dwindows-1252",
|
||||
@ -278,20 +283,20 @@ func TestGetEncoding(t *testing.T) {
|
||||
"iso-ir-6",
|
||||
"we8iso8859p1",
|
||||
},
|
||||
"windows-1253": []string{"cswindows1253", "cp1253"}, // MIB 2253
|
||||
"windows-1254": []string{"cswindows1254", "cp1254"}, // MIB 2254
|
||||
"windows-1255": []string{"cSwindows1255", "cp1255"}, // MIB 2255
|
||||
"windows-1256": []string{"cswIndows1256", "cp1256"}, // MIB 2256
|
||||
"windows-1257": []string{"cswinDows1257", "cp1257"}, // MIB 2257
|
||||
"windows-1258": []string{"cswindoWs1258", "cp1258"}, // MIB 2257
|
||||
"koi8-r": []string{"cskoi8r", "koi8r"}, // MIB 2084
|
||||
"koi8-u": []string{"cskoi8u", "koi8u"}, // MIB 2088
|
||||
"macintosh": []string{"mac", "macroman", "csmacintosh"}, // MIB 2027
|
||||
"big5": []string{
|
||||
"windows-1253": {"cswindows1253", "cp1253"}, // MIB 2253
|
||||
"windows-1254": {"cswindows1254", "cp1254"}, // MIB 2254
|
||||
"windows-1255": {"cSwindows1255", "cp1255"}, // MIB 2255
|
||||
"windows-1256": {"cswIndows1256", "cp1256"}, // MIB 2256
|
||||
"windows-1257": {"cswinDows1257", "cp1257"}, // MIB 2257
|
||||
"windows-1258": {"cswindoWs1258", "cp1258"}, // MIB 2257
|
||||
"koi8-r": {"cskoi8r", "koi8r"}, // MIB 2084
|
||||
"koi8-u": {"cskoi8u", "koi8u"}, // MIB 2088
|
||||
"macintosh": {"mac", "macroman", "csmacintosh"}, // MIB 2027
|
||||
"big5": {
|
||||
"zht16mswin950", // cp950
|
||||
"cp950",
|
||||
},
|
||||
"euc-kr": []string{
|
||||
"euc-kr": {
|
||||
"euckr", // MIB 38
|
||||
"ibm-euckr",
|
||||
//"uhc": []string{ // Korea
|
||||
@ -299,11 +304,11 @@ func TestGetEncoding(t *testing.T) {
|
||||
"ksc5601",
|
||||
"cp949",
|
||||
},
|
||||
"euc-jp": []string{
|
||||
"euc-jp": {
|
||||
"eucjp",
|
||||
"ibm-eucjp",
|
||||
},
|
||||
"shift_jis": []string{
|
||||
"shift_jis": {
|
||||
"CP932",
|
||||
"MS932",
|
||||
"Windows-932",
|
||||
@ -312,7 +317,7 @@ func TestGetEncoding(t *testing.T) {
|
||||
"IBM-943",
|
||||
"CP943",
|
||||
},
|
||||
"iso-2022-jp": []string{ // MIB 39
|
||||
"iso-2022-jp": { // MIB 39
|
||||
"iso2022jp",
|
||||
"csiso2022jp",
|
||||
},
|
||||
@ -424,14 +429,14 @@ func TestEncodeReader(t *testing.T) {
|
||||
|
||||
// run tests
|
||||
for _, val := range testData {
|
||||
//fmt.Println("Testing ", val)
|
||||
// fmt.Println("Testing ", val)
|
||||
expected := []byte(val.message)
|
||||
decoded, err := DecodeCharset(val.original, "text/plain; charset="+val.charset)
|
||||
if len(expected) == 0 {
|
||||
if err == nil {
|
||||
t.Error("Expected err but have ", err)
|
||||
} else {
|
||||
//fmt.Println("Expected err: ", err)
|
||||
// fmt.Println("Expected err: ", err)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -31,7 +31,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build build_qa
|
||||
// +build build_qa
|
||||
|
||||
package pmapi
|
||||
|
||||
@ -28,7 +28,7 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
|
||||
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
|
||||
r "github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ func (m *manager) authRefresh(ctx context.Context, uid, ref string) (*AuthRefres
|
||||
m.refreshingAuth.Lock()
|
||||
defer m.refreshingAuth.Unlock()
|
||||
|
||||
var req = authRefreshReq{
|
||||
req := authRefreshReq{
|
||||
UID: uid,
|
||||
RefreshToken: ref,
|
||||
ResponseType: "token",
|
||||
|
||||
@ -24,10 +24,8 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
// retryConnectionSleeps defines a smooth cool down in seconds.
|
||||
retryConnectionSleeps = []int{2, 5, 10, 30, 60} //nolint:gochecknoglobals
|
||||
)
|
||||
// retryConnectionSleeps defines a smooth cool down in seconds.
|
||||
var retryConnectionSleeps = []int{2, 5, 10, 30, 60} //nolint:gochecknoglobals
|
||||
|
||||
func (m *manager) pingUntilSuccess() {
|
||||
if m.isPingOngoing() {
|
||||
|
||||
@ -27,8 +27,10 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const testMessageCleartext = `<div>jeej saas<br></div><div><br></div><div class="protonmail_signature_block"><div>Sent from <a href="https://protonmail.ch">ProtonMail</a>, encrypted email based in Switzerland.<br></div><div><br></div></div>`
|
||||
const testMessageCleartextLegacy = `<div>flkasjfkjasdklfjasd<br></div><div>fasd<br></div><div>jfasjdfjasd<br></div><div>fj<br></div><div>asdfj<br></div><div>sadjf<br></div><div>sadjf<br></div><div>asjdf<br></div><div>jasd<br></div><div>fj<br></div><div>asdjf<br></div><div>asdjfsad<br></div><div>fasdlkfjasdjfkljsadfljsdfjsdljflkdsjfkljsdlkfjsdlk<br></div><div>jasfd<br></div><div>jsd<br></div><div>jf<br></div><div>sdjfjsdf<br></div><div><br></div><div>djfskjsladf<br></div><div>asd<br></div><div>fja<br></div><div>sdjfajsf<br></div><div>jas<br></div><div>fas<br></div><div>fj<br></div><div>afj<br></div><div>ajf<br></div><div>af<br></div><div>asdfasdfasd<br></div><div>Sent from <a href="https://protonmail.ch">ProtonMail</a>, encrypted email based in Switzerland.<br></div><div>dshfljsadfasdf<br></div><div>as<br></div><div>df<br></div><div>asd<br></div><div>fasd<br></div><div>f<br></div><div>asd<br></div><div>fasdflasdklfjsadlkjf</div><div>asd<br></div><div>fasdlkfjasdlkfjklasdjflkasjdflaslkfasdfjlasjflkasflksdjflkjasdf<br></div><div>asdflkasdjflajsfljaslkflasf<br></div><div>asdfkas<br></div><div>dfjas<br></div><div>djf<br></div><div>asjf<br></div><div>asj<br></div><div>faj<br></div><div>f<br></div><div>afj<br></div><div>sdjaf<br></div><div>jas<br></div><div>sdfj<br></div><div>ajf<br></div><div>aj<br></div><div>ajsdafafdaaf<br></div><div>a<br></div><div>f<br></div><div>lasl;ga<br></div><div>sags<br></div><div>ad<br></div><div>gags<br></div><div>g<br></div><div>ga<br></div><div>a<br></div><div>gg<br></div><div>a<br></div><div>ag<br></div><div>ag<br></div><div>agga.g.ga,ag.ag./ga<br></div><div><br></div><div>dsga<br></div><div>sg<br></div><div><br></div><div>gasga\g\g\g\g\g\n\y\t\r\\r\r\\n\n\n\<br></div><div><br></div><div><br></div><div>sd<br></div><div>asdf<br></div><div>asdf<br></div><div>dsa<br></div><div>fasd<br></div><div>f</div>`
|
||||
const (
|
||||
testMessageCleartext = `<div>jeej saas<br></div><div><br></div><div class="protonmail_signature_block"><div>Sent from <a href="https://protonmail.ch">ProtonMail</a>, encrypted email based in Switzerland.<br></div><div><br></div></div>`
|
||||
testMessageCleartextLegacy = `<div>flkasjfkjasdklfjasd<br></div><div>fasd<br></div><div>jfasjdfjasd<br></div><div>fj<br></div><div>asdfj<br></div><div>sadjf<br></div><div>sadjf<br></div><div>asjdf<br></div><div>jasd<br></div><div>fj<br></div><div>asdjf<br></div><div>asdjfsad<br></div><div>fasdlkfjasdjfkljsadfljsdfjsdljflkdsjfkljsdlkfjsdlk<br></div><div>jasfd<br></div><div>jsd<br></div><div>jf<br></div><div>sdjfjsdf<br></div><div><br></div><div>djfskjsladf<br></div><div>asd<br></div><div>fja<br></div><div>sdjfajsf<br></div><div>jas<br></div><div>fas<br></div><div>fj<br></div><div>afj<br></div><div>ajf<br></div><div>af<br></div><div>asdfasdfasd<br></div><div>Sent from <a href="https://protonmail.ch">ProtonMail</a>, encrypted email based in Switzerland.<br></div><div>dshfljsadfasdf<br></div><div>as<br></div><div>df<br></div><div>asd<br></div><div>fasd<br></div><div>f<br></div><div>asd<br></div><div>fasdflasdklfjsadlkjf</div><div>asd<br></div><div>fasdlkfjasdlkfjklasdjflkasjdflaslkfasdfjlasjflkasflksdjflkjasdf<br></div><div>asdflkasdjflajsfljaslkflasf<br></div><div>asdfkas<br></div><div>dfjas<br></div><div>djf<br></div><div>asjf<br></div><div>asj<br></div><div>faj<br></div><div>f<br></div><div>afj<br></div><div>sdjaf<br></div><div>jas<br></div><div>sdfj<br></div><div>ajf<br></div><div>aj<br></div><div>ajsdafafdaaf<br></div><div>a<br></div><div>f<br></div><div>lasl;ga<br></div><div>sags<br></div><div>ad<br></div><div>gags<br></div><div>g<br></div><div>ga<br></div><div>a<br></div><div>gg<br></div><div>a<br></div><div>ag<br></div><div>ag<br></div><div>agga.g.ga,ag.ag./ga<br></div><div><br></div><div>dsga<br></div><div>sg<br></div><div><br></div><div>gasga\g\g\g\g\g\n\y\t\r\\r\r\\n\n\n\<br></div><div><br></div><div><br></div><div>sd<br></div><div>asdf<br></div><div>asdf<br></div><div>dsa<br></div><div>fasd<br></div><div>f</div>`
|
||||
)
|
||||
|
||||
const testMessageEncrypted = `-----BEGIN PGP MESSAGE-----
|
||||
Version: OpenPGP.js v1.2.0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/ProtonMail/proton-bridge/pkg/pmapi (interfaces: Client,Manager)
|
||||
// Source: github.com/ProtonMail/proton-bridge/v2/pkg/pmapi (interfaces: Client,Manager)
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
@ -12,7 +12,7 @@ import (
|
||||
time "time"
|
||||
|
||||
crypto "github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
logrus "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -24,8 +24,10 @@ import (
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
)
|
||||
|
||||
const testMailboxPassword = "apple"
|
||||
const testMailboxPasswordLegacy = "123"
|
||||
const (
|
||||
testMailboxPassword = "apple"
|
||||
testMailboxPasswordLegacy = "123"
|
||||
)
|
||||
|
||||
var (
|
||||
testPrivateKeyRing *crypto.KeyRing
|
||||
|
||||
@ -20,7 +20,7 @@ package pool
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pchan"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pchan"
|
||||
)
|
||||
|
||||
type WorkFunc func(interface{}, int) (interface{}, error)
|
||||
|
||||
@ -20,7 +20,7 @@ package pool_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pool"
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pool"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -75,7 +75,7 @@ func createFiles(t *testing.T, root string, paths ...string) {
|
||||
}
|
||||
|
||||
func makeFile(t *testing.T, path string) {
|
||||
require.NoError(t, os.MkdirAll(filepath.Dir(path), 0700))
|
||||
require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o700))
|
||||
|
||||
f, err := os.Create(path)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user