samuong / alpaca

A local HTTP proxy for command-line tools. Supports PAC scripts and NTLM authentication.
Apache License 2.0
184 stars 31 forks source link

Add flag to optionally listen on all interfaces #96

Closed keilin-anz closed 2 years ago

keilin-anz commented 2 years ago

Server currently listens on localhost:${port} which is fine for most scenarios This adds the ability to optionally listen on :${port} instead (all local IPs) It's unknown whether this has far reaching implications - very much included just as a jump off point for samuong/alpaca#95 if desired

Potentially addresses samuong/alpaca#95

NB: previous commits removed since it was a tiny change and clashed with recent merges

dylanANZ commented 2 years ago

I was thinking possibly -l or --listen which set an address, say 0.0.0.0 or a regular IP. Default value is still localhost

The code is simple too: address := flag.String("l", "localhost", "address to listen on")

Addr: fmt.Sprintf("%s:%d", *address, *port),

keilin-anz commented 2 years ago

I was thinking possibly -l or --listen which set an address, say 0.0.0.0 or a regular IP. Default value is still localhost

Looks like @samuong is on board with that, will update

Amusingly, I was intentionally avoiding that implementation in some misguided attempt to make listening on :3128 easy - but the proposed approach is definitely much more flexible

keilin-anz commented 2 years ago

Resolving rebase conflicts from main was pointless, so dropped old commits and redid addressing PR comments

(very lightly) tested with default value (localhost:3128), empty value (:3128), and an arbitrary local IPv6 address