forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86fbb34
commit 75b477a
Showing
19 changed files
with
156 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
package sys.fs; | ||
|
||
extern class DirEntry { | ||
function path():Path; | ||
function metadata():Metadata; | ||
import haxe.exceptions.NotImplementedException; | ||
|
||
class DirEntry { | ||
public function path():Path { | ||
throw new NotImplementedException(); | ||
} | ||
public function metadata():Metadata { | ||
throw new NotImplementedException(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,21 +1,52 @@ | ||
package sys.fs; | ||
|
||
import haxe.exceptions.NotImplementedException; | ||
import sys.fs.Metadata; | ||
import python.lib.Os; | ||
|
||
@:coreApi | ||
extern class Fs { | ||
static function metadata(path:Path):Metadata; | ||
/** | ||
Returns the metadata for `path` without following symlinks. | ||
**/ | ||
static function symlinkMetadata(path:Path):Metadata; | ||
static function setPermissions(path:Path, perm:Permissions):Void; | ||
static function copy(from:Path, to:Path):Void; | ||
static function rename(from:Path, to:Path):Void; | ||
static function readDir(path:Path):Iterator<DirEntry>; | ||
static function createDir(path:Path):Void; | ||
static function createDirRec(path:Path):Void; | ||
static function removeDir(path:Path):Void; | ||
static function removeDirRec(path:Path):Void; | ||
static function removeFile(path:Path):Void; | ||
class Fs { | ||
public static function metadata(path:Path):Metadata { | ||
return new Metadata(Os.stat(path.toString())); | ||
} | ||
|
||
public static function symlinkMetadata(path:Path):Metadata { | ||
return new Metadata(Os.lstat(path.toString())); | ||
} | ||
|
||
public static function setPermissions(path:Path, perm:Permissions):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function copy(from:Path, to:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function rename(from:Path, to:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function readDir(path:Path):Iterator<DirEntry> { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function createDir(path:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function createDirRec(path:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function removeDir(path:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function removeDirRec(path:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static function removeFile(path:Path):Void { | ||
throw new NotImplementedException(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
package sys.fs; | ||
|
||
@:coreApi | ||
extern class Permissions { | ||
class Permissions { | ||
/** | ||
Note that this does not affect the file, use `Fs.setPermissions`. | ||
**/ | ||
var readonly(get, set):Bool; | ||
public var readonly(get, set):Bool; | ||
|
||
function get_readonly():Bool { | ||
throw new haxe.exceptions.NotImplementedException(); | ||
} | ||
|
||
function set_readonly(value:Bool):Bool { | ||
throw new haxe.exceptions.NotImplementedException(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package sys.net; | ||
|
||
import haxe.io.Bytes; | ||
import sys.net.IpAddress; | ||
|
||
/** | ||
A User Datagram Protocol socket. | ||
|
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,28 @@ | ||
package sys.net; | ||
|
||
import haxe.extern.EitherType; | ||
|
||
typedef Selectable = EitherType<DatagramSocket, EitherType<TcpListener, TcpStream>>; | ||
|
||
enum abstract Event(Int) { | ||
var Read; | ||
var Write; | ||
var Other; | ||
|
||
@:op(A | B) function and(b:Event):Event; | ||
@:op(A & B) function or(b:Event):Event; | ||
} | ||
|
||
@:coreApi | ||
extern class Selector { | ||
function new(); | ||
function register<T:Selectable>(socket:T, ev:Event, data:Null<Dynamic>):SelectorKey; | ||
function modify<T:Selectable>(socket:T, ev:Event, data:Null<Dynamic>):SelectorKey; | ||
function unregister<T:Selectable>(socket:T):SelectorKey; | ||
|
||
function wait(?timeout:Float):KeyValueIterator<SelectorKey, Event>; | ||
} | ||
|
||
extern class SelectorKey { | ||
// var socket: | ||
} |
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
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,6 @@ | ||
package sys.tls; | ||
|
||
extern class Certificate { | ||
static function fromDer(bytes:haxe.io.Bytes):Certificate; | ||
static function fromPem(bytes:haxe.io.Bytes):Certificate; | ||
} |
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,6 @@ | ||
package sys.tls; | ||
|
||
extern class Identity { | ||
static function fromPkcs12(der:haxe.io.Bytes, ?pass:String):Identity; | ||
static function fromPkcs8(pem:haxe.io.Bytes, key:haxe.io.Bytes):Identity; | ||
} |
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,7 @@ | ||
package sys.tls; | ||
|
||
extern class TlsListener extends sys.net.TcpListener { | ||
static function bind(address:SocketAddress, config:TlsListenerConfig):TlsListener; | ||
|
||
override function accept():TlsStream; | ||
} |
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,5 @@ | ||
package sys.tls; | ||
|
||
@:structInit class TlsListenerConfig { | ||
var identity:Identity; | ||
} |
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,11 @@ | ||
package sys.tls; | ||
|
||
import haxe.time.Duration; | ||
import sys.net.SocketAddress; | ||
|
||
extern class TlsStream extends sys.net.TcpStream { | ||
static function connectByIp(address:SocketAddress, config:TlsStreamConfig, ?timeout:Duration):TlsStream; | ||
static function connectByName(hostname:String, port:Int, config:TlsStreamConfig, ?timeout:Duration):TlsStream; | ||
|
||
function peerCertificate():Null<Certificate>; | ||
} |
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,11 @@ | ||
package sys.tls; | ||
|
||
@:structInit class TlsStreamConfig { | ||
var use_built_in_roots:Bool; | ||
var extra_roots:Array<Certificate> = []; | ||
|
||
/** | ||
For Server Name Indication | ||
**/ | ||
var hostname:Null<String> = null; | ||
} |