This commit is contained in:
@@ -17,8 +17,8 @@ import (
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/internal/server"
|
||||
"tunnel_pls/internal/transport"
|
||||
"tunnel_pls/internal/types"
|
||||
"tunnel_pls/internal/version"
|
||||
"tunnel_pls/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"tunnel_pls/internal/port"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package config
|
||||
|
||||
import "tunnel_pls/types"
|
||||
import (
|
||||
"tunnel_pls/internal/types"
|
||||
)
|
||||
|
||||
type Config interface {
|
||||
Domain() string
|
||||
|
||||
@@ -3,7 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
@@ -32,7 +32,7 @@ type config struct {
|
||||
|
||||
bufferSize int
|
||||
headerSize int
|
||||
|
||||
|
||||
pprofEnabled bool
|
||||
pprofPort string
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
"tunnel_pls/internal/config"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"tunnel_pls/internal/session/interaction"
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"tunnel_pls/internal/port"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/types"
|
||||
|
||||
proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"tunnel_pls/internal/session/interaction"
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
)
|
||||
|
||||
type Key = types.SessionKey
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"tunnel_pls/internal/session/interaction"
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"sync"
|
||||
"tunnel_pls/internal/config"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"tunnel_pls/internal/config"
|
||||
"tunnel_pls/internal/random"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/charmbracelet/bubbles/help"
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/bubbles/list"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
"tunnel_pls/internal/random"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/charmbracelet/bubbles/help"
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
|
||||
@@ -3,7 +3,7 @@ package interaction
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/bubbles/textinput"
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
portUtil "tunnel_pls/internal/port"
|
||||
"tunnel_pls/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"testing"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/internal/transport"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"tunnel_pls/internal/config"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"tunnel_pls/internal/http/stream"
|
||||
"tunnel_pls/internal/middleware"
|
||||
"tunnel_pls/internal/registry"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"tunnel_pls/internal/session/interaction"
|
||||
"tunnel_pls/internal/session/lifecycle"
|
||||
"tunnel_pls/internal/session/slug"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
"tunnel_pls/internal/config"
|
||||
"tunnel_pls/types"
|
||||
"tunnel_pls/internal/types"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
type SessionStatus int
|
||||
|
||||
const (
|
||||
SessionStatusINITIALIZING SessionStatus = iota
|
||||
SessionStatusRUNNING
|
||||
SessionStatusCLOSED
|
||||
)
|
||||
|
||||
type InteractiveMode int
|
||||
|
||||
const (
|
||||
InteractiveModeINTERACTIVE InteractiveMode = iota + 1
|
||||
InteractiveModeHEADLESS
|
||||
)
|
||||
|
||||
type TunnelType int
|
||||
|
||||
const (
|
||||
TunnelTypeUNKNOWN TunnelType = iota
|
||||
TunnelTypeHTTP
|
||||
TunnelTypeTCP
|
||||
)
|
||||
|
||||
type ServerMode int
|
||||
|
||||
const (
|
||||
ServerModeSTANDALONE = iota + 1
|
||||
ServerModeNODE
|
||||
)
|
||||
|
||||
type SessionKey struct {
|
||||
Id string
|
||||
Type TunnelType
|
||||
}
|
||||
|
||||
type Detail struct {
|
||||
ForwardingType string `json:"forwarding_type,omitempty"`
|
||||
Slug string `json:"slug,omitempty"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
StartedAt time.Time `json:"started_at,omitempty"`
|
||||
}
|
||||
|
||||
var BadGatewayResponse = []byte("HTTP/1.1 502 Bad Gateway\r\n" +
|
||||
"Content-Length: 11\r\n" +
|
||||
"Content-Type: text/plain\r\n\r\n" +
|
||||
"Bad Gateway")
|
||||
Reference in New Issue
Block a user