-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is part of the host-config refactor which enables easier encoding to / decoding from `redsocks.conf`. Signed-off-by: Christina Ying Wang <[email protected]>
- Loading branch information
Showing
5 changed files
with
378 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as t from 'io-ts'; | ||
import { NumericIdentifier } from '../types'; | ||
|
||
export const ProxyConfig = t.intersection([ | ||
t.type({ | ||
type: t.union([ | ||
t.literal('socks4'), | ||
t.literal('socks5'), | ||
t.literal('http-connect'), | ||
t.literal('http-relay'), | ||
]), | ||
ip: t.string, | ||
port: NumericIdentifier, | ||
}), | ||
// login & password are optional fields | ||
t.partial({ | ||
login: t.string, | ||
password: t.string, | ||
}), | ||
]); | ||
export type ProxyConfig = t.TypeOf<typeof ProxyConfig>; | ||
|
||
export const RedsocksConfig = t.partial({ | ||
redsocks: ProxyConfig, | ||
}); | ||
export type RedsocksConfig = t.TypeOf<typeof RedsocksConfig>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.