Форум: "Сети";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];
ВнизSOCKS5 server Найти похожие ветки
← →
yaJohn (2002-02-13 15:56) [0]Mojet kto vstrechal komponent ili primer programmi realizuushei SOCKS5 server?
← →
Ghost. (2002-02-13 16:23) [1]В комплекте DX есть компонент сокс4 сервера, я не разбирался как он работает, хотя эта проблема меня тоже интересовала..небыло времени пока.. а сокс 5 тоже тока с авторизацией..может разберешься напиши..
← →
yaJohn (2002-02-13 17:42) [2]Pardon... Chto takoe DX?
← →
Ghost. (2002-02-13 17:59) [3]Это такой набор интернетовских компоненот правда у меня ужасно глючит и я ими не пользуюсь, они есть на торри но без исходников...
Хотел закинуть суда исходник, а он не помещается...:0(
← →
yaJohn (2002-02-13 19:02) [4]A mojno na milo? yaJohn@web.de
← →
Di_wind (2002-02-13 20:25) [5]И мне на мыло. diwindsec@hotbox.ru
← →
ad_tolya (2002-02-13 23:27) [6]И мне... :)) ad_tolya@kgpu.kamchatka.ru
← →
Ghost. (2002-02-14 09:06) [7]Не господа давайте так..вы мне на мыло кому надо пишите и всем, какие нужно таки и вышлю..у меня в принципе есть полные исходники DX (хотя они на торри написано стоят аж 700 американских рублей)
← →
Ghost. (2002-02-14 18:22) [8]Какой-то сволочь мыло спер, так, что ничего я не получил..
← →
SV (2002-02-16 21:51) [9]Если не подойдет ищи на Torry ICS(Internet Component Suite)
- Хорошая вещь!
← →
Ghost. (2002-02-17 13:02) [10]unit DXSOCKSV4ServerCore;
interface
///////////////////////////////////////////////////////////////////////////////
// Component: TDXSOCKSV4ServerCore
// Author: Federico "BackDream" Simonetti
// Author: G.E. Ozz Nixon Jr. (administrator@delphix.com)
// Copyright: All code is the property of Brain Patchwork DX (tm) and part of
// the DXSock (r) product, which are (c) 1999 Brain Patchwork DX.
// Version: 2.0 (2nd Generation Code)
// ==========================================================================
///////////////////////////////////////////////////////////////////////////////
uses
Classes,
Windows, {DWORD}
DXServerCore;
{$I DXSOCK.DEF} {2.0}
type
SOCKSV4TSimpleEvent = procedure(ClientThread: TDXServerThread) of object;
SOCKSV4TOtherEvent = procedure(ClientThread: TDXServerThread; Command: string; Parm: string;Var Handled:Boolean) of object;
TDXSOCKSV4ServerCore = class(TDXServerCore)
private
fOnCommandUSER: SOCKSV4TSimpleEvent; {USER john}
fOnCommandOther: SOCKSV4TOtherEvent; {COMMAND parameters...}
fEventArray:TList;
fiTimeout:DWord;
protected
Function GetReleaseDate:String;
Procedure SetReleaseDate(value:string);
Procedure SetOnCommandUSER(value:SOCKSV4TSimpleEvent);
public
{$IFDEF OBJECTS_ONLY}
constructor Create;
{$ELSE}
constructor Create(AOwner:TComponent); override;
{$ENDIF}
destructor Destroy; override;
procedure ProcessSession(ClientThread: TDXServerThread);
Procedure AddBasicEvent(Command:String;EventProc:SOCKSV4TSimpleEvent);
published
property Timeout:DWord read fiTimeout
write fiTimeout;
property OnCommandUSER: SOCKSV4TSimpleEvent read fOnCommandUSER
write SetOnCommandUSER;
property OnCommandOther: SOCKSV4TOtherEvent read fOnCommandOther
write fOnCommandOther;
property ReleaseDate:string read GetReleaseDate
write SetReleaseDate;
end;
implementation
Uses
DXString;
Type
PSOCKSV4SimpleEvent=^TSOCKSV4SimpleEvent;
TSOCKSV4SimpleEvent=record
Tag:Integer;
Command:MySmallString;
EventProcedure:SOCKSV4TSimpleEvent;
End;
(******************************************************************************
*RELEASEDATE:
Used internally to show the date of this release in the object
inspector. Only useful when reporting bugs to development team.
******************************************************************************)
Function TDXSOCKSV4ServerCore.GetReleaseDate:String;
Begin
Result:=BPDX_RELEASE_DATE;
End;
Procedure TDXSOCKSV4ServerCore.SetReleaseDate(value:string);
Begin
// Absorb!
End;
(******************************************************************************
CREATE:
Define the Default Port number to Listen On.
******************************************************************************)
{$IFDEF OBJECTS_ONLY}
constructor TDXSOCKSV4ServerCore.Create;
{$ELSE}
constructor TDXSOCKSV4ServerCore.Create(AOwner:TComponent);
{$ENDIF}
begin
{$IFDEF OBJECTS_ONLY}
inherited Create;
{$ELSE}
inherited Create(AOwner);
{$ENDIF}
ServerPort:=53;
ProtocolToBind:=wpUDPOnly;
fEventArray:=TList.Create;
fiTimeout:=30000;
end;
← →
Ghost. (2002-02-17 13:03) [11](******************************************************************************
DESTROY:
Destory this object.
******************************************************************************)
destructor TDXSOCKSV4ServerCore.Destroy;
Var
PSimpleEvent:PSOCKSV4SimpleEvent;
begin
While fEventArray.Count>0 do Begin
Case PSOCKSV4SimpleEvent(fEventArray[0]).Tag of
1:Begin
PSimpleEvent:=fEventArray[0];
Dispose(PSimpleEvent);
End;
End;
fEventArray.Delete(0);
End;
inherited Destroy;
end;
(******************************************************************************
ADDSimpleEVENT:
Allows you to dynamically assign a new command to the internal
parser. This allows the servercore to support the "pre-defined"
OnCommand* events, plus you can add other commands dynamically
at run-time in your application without requiring a source code
modification to our components!
To make support easier for us, we ask that you use the Add*Event
procedures to expand our code, reducing code changes when an
upgrade is released!
See documentation for complete information on how this works.
Example Usage: AddSimpleEvent("CDROM",MySpecialEvent);
******************************************************************************)
Procedure TDXSOCKSV4ServerCore.AddBasicEvent(Command:String;EventProc:SOCKSV4TSimpleEvent);
Var
PSimpleEvent:PSOCKSV4SimpleEvent;
Loop:Integer;
Begin
Command:=Uppercase(Command);
Loop:=0;
While Loop<fEventArray.Count do Begin
If PSOCKSV4SimpleEvent(fEventArray[Loop]).Command=Command then Begin
PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure:=EventProc;
Exit;
End
Else Inc(Loop);
End;
New(PSimpleEvent);
PSimpleEvent.Tag:=1; // Denotes Event in fEventArray is a TSimpleEvent!
PSimpleEvent.Command:=Command;
PSimpleEvent.EventProcedure:=EventProc;
fEventArray.Add(PSimpleEvent);
End;
Procedure TDXSOCKSV4ServerCore.SetOnCommandUSER(value:SOCKSV4TSimpleEvent);
Begin
fOnCommandUSER:=Value;
AddBasicEvent("USER",Value);
End;
(******************************************************************************
PROCESSSESSION:
If you want this CORE to process the parsing, you should call
this from your "OnNewConnect" implementation. This should be
right after your call to SayHello (optional).
******************************************************************************)
procedure TDXSOCKSV4ServerCore.ProcessSession(ClientThread: TDXServerThread);
var
s, sCmd: string;
Loop:Integer;
WasHandled:Boolean;
procedure NotHandled(CMD: string);
Var
Ws:String;
begin
Ws:="500 command not recognized (" + CMD + ")";
ClientThread.Socket.Writeln(Ws);
end;
begin
with ClientThread.Socket do begin
s:=ReadLn(fiTimeout);
If LastReadTimeout or Not ValidSocket then Exit;
sCmd:=UpperCase(Fetch(s,#32,False));
Loop:=0;
WasHandled:=False;
While (Loop<fEventArray.Count) and (Not WasHandled) do Begin
If PSOCKSV4SimpleEvent(fEventArray[Loop]).Command=sCMD then Begin
Case PSOCKSV4SimpleEvent(fEventArray[Loop]).Tag of
1:if Assigned(PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure) then
SOCKSV4TSimpleEvent(PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure)(ClientThread);
End;
WasHandled:=True;
End
Else Inc(Loop);
End; {while}
If Not WasHandled then Begin
if assigned(OnCommandOther) then
OnCommandOther(ClientThread,sCmd,s,WasHandled);
end;
if not WasHandled then NotHandled(sCmd);
end; {with}
end; {doExecute}
end.
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];
Память: 0.5 MB
Время: 0.008 c