Documentation
¶
Overview ¶
portdetector/deno.go
portdetector/elixir.go
portdetector/go.go
portdetector/java.go
portdetector/node.go
portdetector/php.go
portdetector/python.go
portdetector/ruby.go
portdetector/rust.go
Index ¶
- type DenoRegexes
- type ElixirRegexes
- type GoRegexes
- type JavaRegexes
- type NodeRegexes
- type PHPRegexes
- type PortDetector
- func (pd *PortDetector) DetectDenoPort(root string) (*int, error)
- func (pd *PortDetector) DetectElixirPort(root string) (*int, error)
- func (pd *PortDetector) DetectGoPort(root string) (*int, error)
- func (pd *PortDetector) DetectJavaPort(root string) (*int, error)
- func (pd *PortDetector) DetectNodePort(root string) (*int, error)
- func (pd *PortDetector) DetectPHPPort(root string) (*int, error)
- func (self *PortDetector) DetectPort() (*int, error)
- func (pd *PortDetector) DetectPythonPort(root string) (*int, error)
- func (pd *PortDetector) DetectRubyPort(root string) (*int, error)
- func (pd *PortDetector) DetectRustPort(root string) (*int, error)
- type PythonRegexes
- type RubyRegexes
- type RustRegexes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DenoRegexes ¶
type DenoRegexes struct { InlineEnv *regexp.Regexp // PORT=9000 deno run … FlagPort *regexp.Regexp // deno run --port 9000 FlagListen *regexp.Regexp // deno run --listen 0.0.0.0:9000 EnvGet *regexp.Regexp // Deno.env.get("PORT") ?? 9000 ServeOption *regexp.Regexp // serve(handler, { port: 9000 }) ListenAndServe *regexp.Regexp // listenAndServe(":9000", …) DenoListen *regexp.Regexp // Deno.listen({ port: 9000 }) ListenLiteral *regexp.Regexp // app.listen(8000) ListenFallback *regexp.Regexp // app.listen(PORT || 8000) }
func NewDenoRegexes ¶
func NewDenoRegexes() *DenoRegexes
type ElixirRegexes ¶
type ElixirRegexes struct { InlineEnv *regexp.Regexp // PORT=4001 mix phx.server MixFlag *regexp.Regexp // mix phx.server --port 4001 SystemEnvFallback *regexp.Regexp // System.get_env("PORT") || 4001 ConfigPort *regexp.Regexp // port: 4001 (in *.exs) CowboyPort *regexp.Regexp // Plug.Cowboy.http(..., port: 4001) }
func NewElixirRegexes ¶
func NewElixirRegexes() *ElixirRegexes
type GoRegexes ¶
type GoRegexes struct { InlineEnv *regexp.Regexp FlagVar *regexp.Regexp PortVar *regexp.Regexp ListenLiteral *regexp.Regexp ColonLiteral *regexp.Regexp }
func NewGoRegexes ¶
func NewGoRegexes() *GoRegexes
type JavaRegexes ¶
type JavaRegexes struct { InlineEnv *regexp.Regexp // PORT=8080 java -jar … SpringFlag *regexp.Regexp // --server.port=8080 SystemProperty *regexp.Regexp // -Dserver.port=8080 PropsFile *regexp.Regexp // server.port = 8080 YamlPort *regexp.Regexp // server.port: 8080 (or under server:) ListenLiteral *regexp.Regexp // new Server(8080) | .listen(8080) }
func NewJavaRegexes ¶
func NewJavaRegexes() *JavaRegexes
type NodeRegexes ¶
type NodeRegexes struct { InlineEnv *regexp.Regexp FlagPort *regexp.Regexp ProcessEnvAssign *regexp.Regexp ListenLiteral *regexp.Regexp ListenFallback *regexp.Regexp ServeOption *regexp.Regexp // serve({ … port: 8787 }) }
---------------------------------------------------------------------- Regex catalogue --------------------------------------------------------------------
func NewNodeRegexes ¶
func NewNodeRegexes() *NodeRegexes
type PHPRegexes ¶
type PHPRegexes struct { InlineEnv *regexp.Regexp // PORT=9000 php … ArtisanServe *regexp.Regexp // php artisan serve --port=9000 BuiltinServer *regexp.Regexp // php -S 0.0.0.0:9000 -t public EnvAssign *regexp.Regexp // $_ENV['PORT'] = '9000' ListenLiteral *regexp.Regexp // ->listen(9000) | ->run('0.0.0.0', 9000) EnvFilePort *regexp.Regexp // APP_PORT=9000 (Laravel .env) }
func NewPHPRegexes ¶
func NewPHPRegexes() *PHPRegexes
type PortDetector ¶
func (*PortDetector) DetectDenoPort ¶
func (pd *PortDetector) DetectDenoPort(root string) (*int, error)
DetectDenoPort returns the first explicit port number it can prove in a Deno repo. If nothing matches you get (nil, nil) and the caller may fall back to a framework default (Fresh = 8000, etc.) if desired.
func (*PortDetector) DetectElixirPort ¶
func (pd *PortDetector) DetectElixirPort(root string) (*int, error)
DetectElixirPort returns the first explicit port number it can prove inside an Elixir/Phoenix repo. If nothing matches you get (nil, nil) and *no* default is applied by this detector.
func (*PortDetector) DetectGoPort ¶
func (pd *PortDetector) DetectGoPort(root string) (*int, error)
DetectGoPort returns the first **explicit** port it can prove in a Go repo. It does NOT invent a default; if all regexes fail you get (nil, nil).
func (*PortDetector) DetectJavaPort ¶
func (pd *PortDetector) DetectJavaPort(root string) (*int, error)
DetectJavaPort returns the first **explicit** port number it can prove inside a Java/Kotlin/Groovy repo. If nothing matches you get (nil, nil) so the caller can fall back; the only framework default you care about is Spring-Boot (8080) – add that in detector.go.
func (*PortDetector) DetectNodePort ¶
func (pd *PortDetector) DetectNodePort(root string) (*int, error)
----------------------------------------------------------------------
Public-facing API -------------------------------------------------------------------- DetectNodePort tries, in order: 1. PORT=… or --port … in an npm/yarn/pnpm script 2. process.env.PORT = … (runtime assignment) 3. app.listen(…) (hard-coded literal or fallback) 4. Return nil → caller falls back to (framework default)
func (*PortDetector) DetectPHPPort ¶
func (pd *PortDetector) DetectPHPPort(root string) (*int, error)
DetectPHPPort inspects a PHP repo and returns the first *explicit* port number it can prove. If nothing matches you get (nil, nil); the caller should then fall back (Laravel default = 8000).
func (*PortDetector) DetectPort ¶
func (self *PortDetector) DetectPort() (*int, error)
func (*PortDetector) DetectPythonPort ¶
func (pd *PortDetector) DetectPythonPort(root string) (*int, error)
------------------------------------------------------------------
Public-facing entry point ----------------------------------------------------------------- DetectPythonPort scans .py / Dockerfile / Procfile / shell scripts and returns the first explicit port it can prove.
func (*PortDetector) DetectRubyPort ¶
func (pd *PortDetector) DetectRubyPort(root string) (*int, error)
DetectRubyPort returns the first explicit port number it can prove inside a Ruby repo. If nothing matches → (nil, nil); caller then falls back (Rails default = 3000).
func (*PortDetector) DetectRustPort ¶
func (pd *PortDetector) DetectRustPort(root string) (*int, error)
DetectRustPort returns the first **explicit** port number it can prove in a Rust repo. If nothing matches you get (nil, nil); the caller should then fall back (Rocket default = 8000).
type PythonRegexes ¶
type PythonRegexes struct { InlineEnv *regexp.Regexp UvicornFlag *regexp.Regexp GunicornBind *regexp.Regexp DjangoRun *regexp.Regexp FlaskRun *regexp.Regexp }
------------------------------------------------------------------ Regexes (case-insensitive, DOTALL where needed) -----------------------------------------------------------------
func NewPythonRegexes ¶
func NewPythonRegexes() *PythonRegexes
type RubyRegexes ¶
type RubyRegexes struct { InlineEnv *regexp.Regexp // PORT=5000 rails s … RailsFlag *regexp.Regexp // rails s -p 5000 RackFlag *regexp.Regexp // rackup -p 9292 PumaFlag *regexp.Regexp // puma --port 4000 EnvAssign *regexp.Regexp // ENV['PORT'] = '4000' SetPort *regexp.Regexp // set :port, 4567 (Sinatra) PumaConfig *regexp.Regexp // port ENV.fetch("PORT") { 3000 } | port 3001 TCPServer *regexp.Regexp // TCPServer.new '0.0.0.0', 4567 }
func NewRubyRegexes ¶
func NewRubyRegexes() *RubyRegexes
type RustRegexes ¶
type RustRegexes struct { InlineEnv *regexp.Regexp // PORT=9000 cargo run RocketEnv *regexp.Regexp // ROCKET_PORT=9000 cargo run BindLiteral *regexp.Regexp // .bind("0.0.0.0:9000") BindTuple *regexp.Regexp // .bind(("0.0.0.0", 9000)) RunLiteral *regexp.Regexp // .run(([0,0,0,0], 7000)) ConfigPort *regexp.Regexp // port: 8000 in Rocket::Config { … } RocketTomlPort *regexp.Regexp // port = 8000 in Rocket.toml ClapDefault *regexp.Regexp // Arg::with_name("port").default_value("8000") OptOptDefault *regexp.Regexp // optopt("p", "port", …, "8000") VarAssign *regexp.Regexp // let port = "7878"; ListenVar *regexp.Regexp // .listen(host, port) }
func NewRustRegexes ¶
func NewRustRegexes() *RustRegexes